Abstract
Protected
isFlag indicating whether dense or sparse representation is currently used (backward compatibility)
Protected
constructorCreates a Q5mState with the specified number of quantum units and optional state vector.
Abstract
calculateCalculates the state space dimension for the given number of quantum units.
Returns the effective number of quantum units (e.g., qubits) in this state.
Protected
getType-safe getter for representation state.
Returns the full array of quantum amplitudes of the quantum state. Uses memoization to reduce memory allocations for repeated access.
Array of quantum amplitudes.
Protected
getReconstruct full state vector from sparse Map representation.
Protected
getReconstruct full state vector from CSR representation.
Returns the measurement probabilities for all computational basis states.
Returns the probability of measuring a specific computational basis state.
Returns the quantum amplitude for a specific computational basis state.
Protected
getAbstract
applyApplies a unitary transformation to the quantum state.
Evolves the quantum state in time according to a Hamiltonian operator.
Abstract
normalizeReturns a normalized copy of this quantum state.
Abstract
withProtected
invalidateInvalidates memoized amplitude cache when state changes.
Protected
chooseSelects the appropriate representation for the quantum state.
Protected
selectSelect the best representation type based on size and sparsity.
Protected
shouldProtected
createCreate CSR format from sparse Map representation.
Protected
optimizeConvert CSR format to memory-optimized TypedArray format.
Calculates the estimated memory usage for the current quantum state.
Protected
calculateCalculate memory usage for CSR representation.
Protected
applyPerform efficient matrix-vector multiplication for CSR representation.
Protected
applyPerform efficient sparse matrix-vector multiplication when both matrix and vector are sparse.
Protected
applyApplies unitary matrix multiplication with representation-aware algorithms.
Optional
unitaryOperator: UnitaryOperatorProtected
applyOptimized application of controlled gates for CSR representation.
Protected
applyOptimized application of single-qubit gates to large quantum systems.
Protected
applyProtected
applyProtected
Standard dense matrix-vector multiplication. Uses optimized implementation from math/vector-matrix.ts
Dense unitary matrix
New state vector after multiplication
Protected
applyProtected
Sparse matrix-vector multiplication for sparse Map representation. Uses optimized implementation from math/vector-matrix.ts
Dense unitary matrix
New state vector after multiplication
Protected
stateThe total number of basis states in the Hilbert space (its dimension).
Protected
numThe number of quantum units (e.g., qubits, qutrits) in this state.
Protected
materialThe quantum material associated with this state.
Protected
Optional
stateThe state vector containing quantum amplitudes for each basis state. Optional for sparse representations.
Protected
Optional
sparseSparse representation using Map for memory optimization
Protected
Optional
csrCSR (Compressed Sparse Row) representation for large sparse states
Protected
Optional
optimizedOptimized CSR representation using TypedArrays
Protected
repCurrent representation type
Protected
sparseConfiguration for sparse optimization
Abstract base class for quantum states with state vector representation.