Skip to main content

Q1RAM Python client for interacting with the Quantum RAM API

Project description

Q1RAM Client API Methods

Q1RAM (Quantum Random Access Memory) is a quantum memory architecture designed to enable efficient storage and retrieval of quantum data at an any arbitrary address(es) with O(1) complexity, as introduced in the paper "Q1RAM: Quantum Random Access Memory". This client API provides methods to interact with Q1RAM, allowing manipulation of quantum memory in both single and superposition states.

Authentication

Before using any method, authenticate with the API:

from q1ram import authenticate
authenticate()

1. read

Purpose:
Reads data from the Q1RAM at a specified address or in superposition.

Signature:

read(address_register=None, data_register=None, address_value=None, data_value=None)

Parameters:

  • address_register: Optional. QuantumRegister or list specifying the address qubits.
  • data_register: Optional. QuantumRegister or list specifying the data qubits.
  • address_value: Optional. List of integers specifying the classical address to read from. If omitted, reads in superposition.
  • data_value: Optional. List of integers specifying the classical data to match (rarely used for read).

Usage Examples:

  • Read from a superposition address states:
    qram.read(address_value=[0, 1])
    

2. write

Purpose:
Writes data to the Q1RAM at a single or superposition address states.

Signature:

write(address_register=None, data_register=None, address_value=None, data_value=None)

Parameters:

  • address_register: Optional. QuantumRegister or list specifying the address qubits.
  • data_register: Optional. QuantumRegister or list specifying the data qubits.
  • address_value: Optional. List of integers specifying the classical address to write to. If omitted, writes in superposition.
  • data_value: Required. List of integers specifying the data to write.

Usage Examples:

  • Write to a specific address:
    qram.write(address_value=[0, 1], data_value=[5])
    

3. read_all

Purpose:
Reads all data from Q1RAM, typically used to retrieve the full memory contents.

Signature:

read_all()

Usage Example:

qram.read_all()

Example Workflow

from q1ram_client.q1ram.circuit import Q1RAM, authenticate
from qiskit import QuantumCircuit

authenticate()
qc = QuantumCircuit()
qram = Q1RAM(qc, number_address_qubits=2, number_data_qubits=2)

# Write data to address [0, 1]
qram.write(address_value=[0, 1], data_value=[1, 0])

# Read data from address [0, 1]
qram.read(address_value=[0, 1])

# Write data in superposition
qram.write(data_value=[1, 1])

# Read all data in superposition
qram.read()

Notes

  • All API calls require valid authentication credentials, by registering on https://q1ram.com.
  • The methods interact with the Q1RAM backend via HTTP requests and update the local quantum circuit accordingly.
  • For advanced usage, you can provide custom quantum registers for address and data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

q1ram-0.1.6.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

q1ram-0.1.6-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file q1ram-0.1.6.tar.gz.

File metadata

  • Download URL: q1ram-0.1.6.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for q1ram-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6629c3fec2b64dc28c99cf7b46d2bddbd38dba4e00e1a6ba0f67a23cbf4363d6
MD5 1d1eb03f165ca68ad42e9625703da3b7
BLAKE2b-256 fc5383125ed99e8cde9d8a9a366738d24d5cb989ceaf9731660546591165f0fd

See more details on using hashes here.

File details

Details for the file q1ram-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: q1ram-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for q1ram-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5c2e9ea2e011799f84738145794e9af658318a5fc55b7a45bda9af1bc0c3afe0
MD5 49d26a788e32137e7b085f7e0fad5f79
BLAKE2b-256 17e16d3727d5cb3ccabe4f3fa45639e539b5ab3251dafc24a8a4e69b8354cdc4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page