qbm.simulation package
Submodules
qbm.simulation.simulation module
- qbm.simulation.simulation.compute_H(h, J, A, B, n_qubits, pauli_kron)
Computes the Hamiltonian of the annealer at relative time s.
- Parameters:
h – Linear Ising terms.
J – Quadratic Ising terms.
A – Coefficient of the off-diagonal terms, e.g. A(s).
B – Coefficient of the diagonal terms, e.g. B(s).
n_qubits – Number of qubits.
pauli_kron – Kronecker product Pauli matrices dict.
- Returns:
Hamiltonian matrix H.
- qbm.simulation.simulation.compute_rho(H, beta, diagonal=False)
Computes the trace normalized density matrix rho.
- Parameters:
H – Hamiltonian matrix.
beta – Inverse temperature beta = 1 / (k_B * T).
diagonal – Flag to indicate whether H is a diagonal matrix or not.
- Returns:
Density matrix rho.
- qbm.simulation.simulation.get_pauli_kron(n_visible, n_hidden)
Computes the necessary Pauli Kronecker product (sparse) matrices for a n_visible + n_hidden qubit problem. Used as an argument to compute_H, e.g. one would instantiate pauli_kron as pauli_kron = get_pauli_kron(n_visible, n_hidden), then pass to compute_H when computing the Hamiltonian.
- Parameters:
n_visible – Number of visible units.
n_hidden – Number of hidden units.
- Returns:
A dictionary of Kronecker product Pauli matrices.
- qbm.simulation.simulation.sparse_kron(i, n_qubits, A)
Compute I_{2^i} ⊗ A ⊗ I_{2^(n_qubits-i-1)}.
- Parameters:
i – Index of the “A” matrix.
n_qubits – Total number of qubits.
A – Matrix to tensor with identities.
- Returns:
I_{2^i} ⊗ A ⊗ I_{2^(n_qubits-i-1)}.
Module contents
- qbm.simulation.compute_H(h, J, A, B, n_qubits, pauli_kron)
Computes the Hamiltonian of the annealer at relative time s.
- Parameters:
h – Linear Ising terms.
J – Quadratic Ising terms.
A – Coefficient of the off-diagonal terms, e.g. A(s).
B – Coefficient of the diagonal terms, e.g. B(s).
n_qubits – Number of qubits.
pauli_kron – Kronecker product Pauli matrices dict.
- Returns:
Hamiltonian matrix H.
- qbm.simulation.compute_rho(H, beta, diagonal=False)
Computes the trace normalized density matrix rho.
- Parameters:
H – Hamiltonian matrix.
beta – Inverse temperature beta = 1 / (k_B * T).
diagonal – Flag to indicate whether H is a diagonal matrix or not.
- Returns:
Density matrix rho.
- qbm.simulation.get_pauli_kron(n_visible, n_hidden)
Computes the necessary Pauli Kronecker product (sparse) matrices for a n_visible + n_hidden qubit problem. Used as an argument to compute_H, e.g. one would instantiate pauli_kron as pauli_kron = get_pauli_kron(n_visible, n_hidden), then pass to compute_H when computing the Hamiltonian.
- Parameters:
n_visible – Number of visible units.
n_hidden – Number of hidden units.
- Returns:
A dictionary of Kronecker product Pauli matrices.
- qbm.simulation.sparse_kron(i, n_qubits, A)
Compute I_{2^i} ⊗ A ⊗ I_{2^(n_qubits-i-1)}.
- Parameters:
i – Index of the “A” matrix.
n_qubits – Total number of qubits.
A – Matrix to tensor with identities.
- Returns:
I_{2^i} ⊗ A ⊗ I_{2^(n_qubits-i-1)}.