Quantum Information API Reference
This page documents the classes and functions available in the skq.quantum_info
module. This module provides tools for working with quantum states, density matrices, quantum channels, Hamiltonians, and other quantum information concepts.
State Representations
Statevector
The Statevector
class provides a representation for pure quantum states.
from skq.quantum_info import Statevector
# Create a state vector
state = Statevector([1/np.sqrt(2), 1/np.sqrt(2)])
print(state.num_qubits) # 1
print(state.is_normalized()) # True
skq.quantum_info.Statevector
Bases: ndarray
Statevector representation for a quantum (qubit) state. NOTE: Input is assumed to be in big-endian format. Little-endian -> Least significant qubit (LSB) is on the right. Like |q1 q0> where q0 is the LSB. Big-endian -> Least significant qubit (LSB) is on the left. Like |q0 q1> where q0 is the LSB.
Source code in src/skq/quantum_info/state.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
num_qubits
property
Number of qubits in the state vector.
bloch_vector()
Bloch vector representation of the quantum state.
Source code in src/skq/quantum_info/state.py
103 104 105 |
|
conjugate_transpose()
Conjugate transpose (Hermitian adjoint) of the state vector.
Source code in src/skq/quantum_info/state.py
107 108 109 |
|
density_matrix()
Return the density matrix representation of the state vector.
Source code in src/skq/quantum_info/state.py
65 66 67 |
|
expectation(operator)
Expectation value of an observable with respect to the quantum state. computes <ψ|O|ψ> :param operator: The observable (Hermitian matrix) as a 2D numpy array. :return: Expectation value.
Source code in src/skq/quantum_info/state.py
54 55 56 57 58 59 60 61 62 63 |
|
from_pyquil(statevector)
staticmethod
Convert a PyQuil object to a scikit-q StateVector object. PyQuil uses little-endian convention. :return: scikit-q StateVector object
Source code in src/skq/quantum_info/state.py
161 162 163 164 165 166 167 168 |
|
from_qiskit(statevector)
staticmethod
Convert a Qiskit StateVector object to a scikit-q StateVector. Qiskit uses little-endian convention. :param statevector: Qiskit StateVector object :return: scikit-q StateVector object
Source code in src/skq/quantum_info/state.py
143 144 145 146 147 148 149 150 151 |
|
is_1d()
State vector is 1D.
Source code in src/skq/quantum_info/state.py
29 30 31 |
|
is_indistinguishable(other)
Two state vectors are indistinguishable if their density matrices are the same.
Source code in src/skq/quantum_info/state.py
46 47 48 |
|
is_multi_qubit()
State vector represents a multi-qubit state.
Source code in src/skq/quantum_info/state.py
42 43 44 |
|
is_normalized()
State vector is normalized: ||ψ|| = 1.
Source code in src/skq/quantum_info/state.py
33 34 35 |
|
is_power_of_two_len()
Check if a number is a power of two
Source code in src/skq/quantum_info/state.py
37 38 39 40 |
|
magnitude()
Magnitude (or norm) of the state vector. sqrt(<ψ|ψ>)
Source code in src/skq/quantum_info/state.py
50 51 52 |
|
measure_bitstring()
Simulate a measurement of the state vector and get a bitstring representing the sample. :return: Bitstring representation of the measured state. For example: |0> -> "0" |00> -> "00" |11> -> "11"
Source code in src/skq/quantum_info/state.py
84 85 86 87 88 89 90 91 92 93 |
|
measure_index()
Simulate a measurement of the state and get a sampled index. :return: Index of the measured state. For example: |0> -> 0 |00> -> 0 |11> -> 3
Source code in src/skq/quantum_info/state.py
73 74 75 76 77 78 79 80 81 82 |
|
orthonormal_basis()
Orthonormal basis using the Gram-Schmidt process. :return: 2D array representing the orthonormal basis.
Source code in src/skq/quantum_info/state.py
111 112 113 114 115 116 |
|
probabilities()
Probabilities of all possible states.
Source code in src/skq/quantum_info/state.py
69 70 71 |
|
reverse()
Reverse the order of the state vector to account for endianness. For example Qiskit uses little endian convention. Little-endian -> Least significant qubit (LSB) is on the right. Like |q1 q0> where q0 is the LSB. Big-endian -> Least significant qubit (LSB) is on the left. Like |q0 q1> where q0 is the LSB.
Source code in src/skq/quantum_info/state.py
95 96 97 98 99 100 101 |
|
schmidt_decomposition()
Perform Schmidt decomposition on a quantum state. :return: Tuple of Schmidt coefficients, Basis A and Basis B
Source code in src/skq/quantum_info/state.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
to_pyquil()
Convert the state vector to a PyQuil object. PyQuil uses little-endian convention. :return: PyQuil object
Source code in src/skq/quantum_info/state.py
153 154 155 156 157 158 159 |
|
to_qiskit()
Convert the state vector to a Qiskit QuantumCircuit object. Qiskit uses little-endian convention. :return: Qiskit StateVector object
Source code in src/skq/quantum_info/state.py
135 136 137 138 139 140 141 |
|
Predefined States
SKQ provides several predefined quantum states:
skq.quantum_info.ZeroState
Bases: Statevector
Zero state |0...0>
Source code in src/skq/quantum_info/state.py
171 172 173 174 175 |
|
skq.quantum_info.OneState
Bases: Statevector
One state |1...1>
Source code in src/skq/quantum_info/state.py
178 179 180 181 182 |
|
skq.quantum_info.PlusState
Bases: Statevector
Single Qubit |+> superposition state
Source code in src/skq/quantum_info/state.py
185 186 187 188 189 |
|
skq.quantum_info.MinusState
Bases: Statevector
Single Qubit |-> superposition state
Source code in src/skq/quantum_info/state.py
192 193 194 195 196 |
|
Bell States
skq.quantum_info.PhiPlusState
Bases: Statevector
Bell state |Φ+>
Source code in src/skq/quantum_info/state.py
199 200 201 202 203 |
|
skq.quantum_info.PhiMinusState
Bases: Statevector
Bell state |Φ->
Source code in src/skq/quantum_info/state.py
206 207 208 209 210 |
|
skq.quantum_info.PsiPlusState
Bases: Statevector
Bell state |Ψ+>
Source code in src/skq/quantum_info/state.py
213 214 215 216 217 |
|
skq.quantum_info.PsiMinusState
Bases: Statevector
Bell state |Ψ->
Source code in src/skq/quantum_info/state.py
220 221 222 223 224 |
|
Multi-qubit States
skq.quantum_info.GHZState
Bases: Statevector
GHZ state |0...0> + |1...1>
Source code in src/skq/quantum_info/state.py
227 228 229 230 231 232 233 234 235 |
|
skq.quantum_info.WState
Bases: Statevector
W state |001> + |010> + |100>
Source code in src/skq/quantum_info/state.py
238 239 240 241 242 243 244 245 246 |
|
Density Matrices
Density matrices represent both pure and mixed quantum states.
from skq.quantum_info import DensityMatrix
# Create a density matrix
rho = DensityMatrix(np.array([[0.5, 0], [0, 0.5]]))
print(rho.is_pure()) # False
print(rho.is_mixed()) # True
skq.quantum_info.DensityMatrix
Bases: HermitianOperator
Density matrix representation of a qubit state.
Source code in src/skq/quantum_info/density.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
num_qubits
property
Number of qubits in the density matrix.
bloch_vector()
Bloch vector of the density matrix.
Source code in src/skq/quantum_info/density.py
59 60 61 62 63 64 65 66 67 68 |
|
distance(other)
Trace norm distance between two density matrices.
Source code in src/skq/quantum_info/density.py
54 55 56 57 |
|
entropy()
von Neumann entropy.
Source code in src/skq/quantum_info/density.py
80 81 82 83 84 85 |
|
from_pennylane(density_matrix)
staticmethod
Convert a PennyLane QubitDensityMarix object to a scikit-q StateVector. :param density_matrix: PennyLane QubitDensityMatrix object :return: scikit-q StateVector object
Source code in src/skq/quantum_info/density.py
120 121 122 123 124 125 126 127 |
|
from_probabilities(probabilities)
staticmethod
Create a density matrix from a list of probabilities. :param probabilities: A 1D array of probabilities :return: Density matrix
Source code in src/skq/quantum_info/density.py
129 130 131 132 133 134 135 136 137 138 |
|
from_qiskit(density_matrix)
staticmethod
Create a DensityMatrix object from a Qiskit DensityMatrix object. :param density_matrix: Qiskit DensityMatrix object :return: DensityMatrix object
Source code in src/skq/quantum_info/density.py
102 103 104 105 106 107 108 109 |
|
internal_energy(hamiltonian)
Expected value of the Hamiltonian. :param hamiltonian: Hamiltonian matrix :return: Expected value of the Hamiltonian
Source code in src/skq/quantum_info/density.py
87 88 89 90 91 92 93 |
|
is_mixed()
Check if density matrix is mixed.
Source code in src/skq/quantum_info/density.py
34 35 36 |
|
is_multi_qubit()
Check if the density matrix represents a multi-qubit state.
Source code in src/skq/quantum_info/density.py
46 47 48 |
|
is_positive_semidefinite()
Matrix is positive semidefinite.
Source code in src/skq/quantum_info/density.py
25 26 27 28 |
|
is_pure()
Check if density matrix is pure.
Source code in src/skq/quantum_info/density.py
30 31 32 |
|
kron(other)
Kronecker (tensor) product of two density matrices. This can be used to create so-called "product states" that represent the independence between two quantum systems. :param other: DensityMatrix object :return: Kronecker product of the two density matrices
Source code in src/skq/quantum_info/density.py
70 71 72 73 74 75 76 77 78 |
|
probabilities()
Probabilities of all possible state measurements.
Source code in src/skq/quantum_info/density.py
42 43 44 |
|
to_pennylane(wires=None)
Convert the density matrix to a PennyLane QubitDensityMatrix. :param wires: List of wires to apply the density matrix to :return: PennyLane QubitDensityMatrix object
Source code in src/skq/quantum_info/density.py
111 112 113 114 115 116 117 118 |
|
to_qiskit()
Convert the density matrix to a Qiskit DensityMatrix object. :return: Qiskit DensityMatrix object
Source code in src/skq/quantum_info/density.py
95 96 97 98 99 100 |
|
trace_equal_to_one()
Trace of density matrix is equal to one.
Source code in src/skq/quantum_info/density.py
38 39 40 |
|
trace_norm()
Trace norm of the density matrix.
Source code in src/skq/quantum_info/density.py
50 51 52 |
|
Thermal States
skq.quantum_info.GibbsState
Bases: DensityMatrix
Gibbs (mixed) state representation of a quantum state in thermal equilibrium. :param hamiltonian: Hamiltonian matrix of the system :param temperature: Temperature of the system in Kelvin
Source code in src/skq/quantum_info/density.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
free_energy()
Helmholtz free energy.
Source code in src/skq/quantum_info/density.py
157 158 159 |
|
heat_capacity()
Calculate the heat capacity.
Source code in src/skq/quantum_info/density.py
161 162 163 164 165 166 |
|
Quantum Channels
Quantum channels represent physical operations on quantum states.
from skq.quantum_info import DepolarizingChannel
# Create a depolarizing channel with 10% noise
channel = DepolarizingChannel(0.1)
skq.quantum_info.QuantumChannel
Bases: SuperOperator
Quantum Channel representation in choi, stinespring, or kraus form.
Source code in src/skq/quantum_info/channel.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
_choi_to_kraus()
Convert choi matrix to kraus operators.
Source code in src/skq/quantum_info/channel.py
183 184 185 186 187 188 189 190 191 192 |
|
_choi_to_stinespring()
Convert choi matrix to stinespring representation.
Source code in src/skq/quantum_info/channel.py
161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
_kraus_to_choi()
Convert Kraus representation to Choi matrix using vectorization.
Source code in src/skq/quantum_info/channel.py
175 176 177 178 179 180 181 |
|
_kraus_to_stinespring()
Convert kraus representation to stinespring representation.
Source code in src/skq/quantum_info/channel.py
194 195 196 197 198 199 200 201 |
|
_stinespring_to_choi()
Convert stinespring representation to choi matrix.
Source code in src/skq/quantum_info/channel.py
157 158 159 |
|
_stinespring_to_kraus()
Convert stinespring representation to kraus operators.
Source code in src/skq/quantum_info/channel.py
203 204 205 206 207 208 209 210 |
|
_validate_choi()
Validate if the input matrix is a valid choi matrix.
Source code in src/skq/quantum_info/channel.py
26 27 28 29 30 31 |
|
_validate_kraus()
Validate if the input list of matrices is a valid kraus representation.
Source code in src/skq/quantum_info/channel.py
39 40 41 42 43 44 |
|
_validate_stinespring()
Validate if the input matrix is a valid stinespring matrix.
Source code in src/skq/quantum_info/channel.py
33 34 35 36 37 |
|
compose(other)
Compose quantum channels. :param other: QuantumChannel object to compose with. :return: Composed QuantumChannel object in the Kraus representation.
Source code in src/skq/quantum_info/channel.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
fidelity(other)
Fidelity between two quantum channels. :param other: QuantumChannel object to calculate fidelity with. :return: Fidelity in range [0...1].
Source code in src/skq/quantum_info/channel.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
from_qiskit(channel)
Convert a Qiskit channel to a QuantumChannel object.
Source code in src/skq/quantum_info/channel.py
229 230 231 232 233 234 235 236 237 238 |
|
is_isometry()
Check if the quantum channel is an isometry. An isometry is a linear transformation that preserves distances (V^dagger V = I)
Source code in src/skq/quantum_info/channel.py
74 75 76 77 78 79 |
|
is_nd(n)
Channel is an n-dimensional matrix.
Source code in src/skq/quantum_info/channel.py
46 47 48 |
|
is_positive_semidefinite()
Check if channel is positive semidefinite (i.e. all eigenvalues are non-negative). Requirement for choi matrices.
Source code in src/skq/quantum_info/channel.py
54 55 56 57 58 |
|
is_square()
Check if the superoperator is represented by a square matrix.
Source code in src/skq/quantum_info/channel.py
50 51 52 |
|
is_trace_preserving()
Check if the quantum channel is trace-preserving.
Source code in src/skq/quantum_info/channel.py
60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
tensor(other)
Tensor product with another channel. :param other: QuantumChannel object to tensor with. :return: QuantumChannel object in the Choi representation
Source code in src/skq/quantum_info/channel.py
102 103 104 105 106 107 108 109 |
|
to_choi()
Convert the channel to the choi matrix representation.
Source code in src/skq/quantum_info/channel.py
130 131 132 133 134 135 136 137 |
|
to_kraus()
Convert the channel to the kraus representation.
Source code in src/skq/quantum_info/channel.py
148 149 150 151 152 153 154 155 |
|
to_qiskit()
Convert the channel to a Qiskit object.
Source code in src/skq/quantum_info/channel.py
218 219 220 221 222 223 224 225 226 227 |
|
to_stinespring()
Convert the channel to the stinespring representation.
Source code in src/skq/quantum_info/channel.py
139 140 141 142 143 144 145 146 |
|
Predefined Channels
skq.quantum_info.QubitResetChannel
Bases: QuantumChannel
Reset channel for a qubit system. Initialized in the Kraus representation.
Source code in src/skq/quantum_info/channel.py
241 242 243 244 245 246 247 248 249 |
|
skq.quantum_info.DepolarizingChannel
Bases: QuantumChannel
Depolarizing noise (qubit) channel as Kraus representation. Special case of PauliNoiseChannel for p_x = p_y = p_z. :param p: Probability of depolarization.
Source code in src/skq/quantum_info/channel.py
252 253 254 255 256 257 258 259 260 261 262 263 |
|
skq.quantum_info.PauliNoiseChannel
Bases: QuantumChannel
Pauli noise channel as Kraus representation. :param p_x: Probability of X error. :param p_y: Probability of Y error. :param p_z: Probability of Z error.
Source code in src/skq/quantum_info/channel.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
skq.quantum_info.CompletelyDephasingChannel
Bases: QuantumChannel
Dephases a quantum (qubit) state in the computational basis. Initialized in the Kraus representation.
Source code in src/skq/quantum_info/channel.py
287 288 289 290 291 292 293 294 295 |
|
skq.quantum_info.AmplitudeDampingChannel
Bases: QuantumChannel
Amplitude Damping Channel for a quantum (qubit) system. :param gamma: Damping parameter in range [0...1].
Source code in src/skq/quantum_info/channel.py
298 299 300 301 302 303 304 305 306 307 308 |
|
skq.quantum_info.PhaseFlipChannel
Bases: QuantumChannel
Phase flip channel for a qubit system. Initialized in the Kraus representation. :param p: Probability of phase flip.
Source code in src/skq/quantum_info/channel.py
311 312 313 314 315 316 317 318 319 320 321 322 |
|
Hamiltonians
Hamiltonians represent the energy of quantum systems.
from skq.quantum_info import Hamiltonian, IsingHamiltonian
# Create an Ising model Hamiltonian for 3 qubits
H = IsingHamiltonian(num_qubits=3, J=1.0, h=0.5)
print(H.ground_state_energy())
skq.quantum_info.Hamiltonian
Bases: HermitianOperator
Class representing a Hamiltonian in quantum computing.
:param input_array: The input array representing the Hamiltonian. Will be converted to a complex numpy array. :param hbar: The reduced Planck constant. Default is 1.0 (natural units). If you want to use the actual physical value, set hbar to 1.0545718e-34.
Source code in src/skq/quantum_info/hamiltonian.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
num_qubits
property
Number of qubits in the Hamiltonian.
add_noise(noise_strength, noise_operator)
Add noise to the Hamiltonian. :param noise_strength: Strength of the noise. Generally in range [0.0001, 0.5]. :param noise_operator: Operator representing the noise. For example Pauli matrices. :return: A new Hamiltonian with noise added.
Source code in src/skq/quantum_info/hamiltonian.py
53 54 55 56 57 58 59 60 61 |
|
convert_endianness()
Hamiltonian from big-endian to little-endian and vice versa.
Source code in src/skq/quantum_info/hamiltonian.py
48 49 50 51 |
|
from_pennylane(hamiltonian)
staticmethod
Convert a PennyLane Hamiltonian object to a scikit-q Hamiltonian object. :param hamiltonian: PennyLane Hamiltonian object :return: Hamiltonian object
Source code in src/skq/quantum_info/hamiltonian.py
93 94 95 96 97 98 99 100 101 |
|
from_qiskit(operator)
staticmethod
Create a scikit-q Hamiltonian object from a Qiskit Operator object. Qiskit using little endian convention, so we permute the order of the qubits. :param operator: Qiskit Operator object :return: Hamiltonian object
Source code in src/skq/quantum_info/hamiltonian.py
71 72 73 74 75 76 77 78 79 |
|
ground_state()
The eigenvector corresponding to the smallest eigenvalue.
Source code in src/skq/quantum_info/hamiltonian.py
43 44 45 46 |
|
ground_state_energy()
Ground state energy. i.e. the smallest eigenvalue.
Source code in src/skq/quantum_info/hamiltonian.py
38 39 40 41 |
|
is_multi_qubit()
Check if Hamiltonian involves multiple qubits.
Source code in src/skq/quantum_info/hamiltonian.py
30 31 32 |
|
time_evolution_operator(t)
Time evolution operator U(t) = exp(-iHt/hbar).
Source code in src/skq/quantum_info/hamiltonian.py
34 35 36 |
|
to_pennylane(wires=None, **kwargs)
Convert the scikit-q Hamiltonian to a PennyLane Hamiltonian. :param wires: List of wires to apply the Hamiltonian to kwargs are passed to the PennyLane Hamiltonian constructor. :return: PennyLane Hamiltonian object
Source code in src/skq/quantum_info/hamiltonian.py
81 82 83 84 85 86 87 88 89 90 91 |
|
to_qiskit()
Convert the scikit-q Hamiltonian to a Qiskit Operator object. Qiskit using little endian convention, so we permute the order of the qubits. :return: Qiskit Operator object
Source code in src/skq/quantum_info/hamiltonian.py
63 64 65 66 67 68 69 |
|
Predefined Hamiltonians
skq.quantum_info.IsingHamiltonian
Bases: Hamiltonian
Hamiltonian for the Ising model. :param num_qubits: Number of qubits in the system. :param J: Interaction strength between qubits. :param h: Transverse field strength. :param hbar: The reduced Planck constant. Default is 1.0 (natural units).
Source code in src/skq/quantum_info/hamiltonian.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
skq.quantum_info.HeisenbergHamiltonian
Bases: Hamiltonian
Hamiltonian for the Heisenberg model. :param num_qubits: Number of qubits in the system. :param J: Interaction strength between qubits. :param hbar: The reduced Planck constant. Default is 1.0 (natural units).
Source code in src/skq/quantum_info/hamiltonian.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
Hadamard Matrices
Hadamard matrices are useful in quantum information theory and quantum algorithms.
from skq.quantum_info import generate_hadamard_matrix
# Generate a Hadamard matrix of order 4
H = generate_hadamard_matrix(4)
skq.quantum_info.HadamardMatrix
Bases: Operator
Hadamard matrix representation.
Source code in src/skq/quantum_info/hadamard.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
determinant()
Determinant of the Hadamard matrix.
Source code in src/skq/quantum_info/hadamard.py
32 33 34 |
|
equivalence(other)
Hadamard matrices are equivalent if row/column permutations and sign flips are equal.
Source code in src/skq/quantum_info/hadamard.py
36 37 38 39 |
|
is_binary()
All elements are +1 or -1.
Source code in src/skq/quantum_info/hadamard.py
18 19 20 |
|
is_hadamard_order()
Order of the Hadamard matrix is 1, 2, or a multiple of 4.
Source code in src/skq/quantum_info/hadamard.py
27 28 29 30 |
|
is_orthogonal()
Rows and columns are orthogonal.
Source code in src/skq/quantum_info/hadamard.py
22 23 24 25 |
|
permutations_and_sign_flips()
Generate all matrix permutations by permuting rows/columns and flipping signs.
Source code in src/skq/quantum_info/hadamard.py
47 48 49 50 51 52 53 54 55 56 57 |
|
spectral_norm()
Spectral norm of the Hadamard matrix. :return: largest singular value (i.e. spectral norm) of the Hadamard matrix.
Source code in src/skq/quantum_info/hadamard.py
41 42 43 44 45 |
|
skq.quantum_info.generate_hadamard_matrix(order)
Hadamard matrix of the given order using Sylvester's construction method. :param order: The order of the Hadamard matrix. Must be a power of 2. :return: HadamardMatrix of the specified order.
Source code in src/skq/quantum_info/hadamard.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
Superoperators
Superoperators are linear maps that transform operators to operators.
skq.quantum_info.SuperOperator
Bases: ndarray
Base class for quantum superoperators. For example quantum channels.
Source code in src/skq/quantum_info/superoperator.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
conjugate_transpose()
Conjugate transpose (i.e. Hermitian adjoint or 'dagger operation') of the superoperator. 1. Transpose the matrix 2. Take the complex conjugate of each element (Flip the sign of the imaginary part)
Source code in src/skq/quantum_info/superoperator.py
33 34 35 36 37 38 39 |
|
is_at_least_nxn(n)
Superoperator is at least an n x n matrix.
Source code in src/skq/quantum_info/superoperator.py
14 15 16 |
|
is_power_of_n_shape(n)
Superoperator shape is a power of n. :param n: Number to check for power of n shape.
Source code in src/skq/quantum_info/superoperator.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|