AbstractProtectedisFlag indicating whether dense or sparse representation is currently used (backward compatibility)
ProtectedconstructorCreates a Q5mState with the specified number of quantum units and optional state vector.
AbstractcalculateCalculates the state space dimension for the given number of quantum units.
Returns the effective number of quantum units (e.g., qubits) in this state.
ProtectedgetType-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.
ProtectedgetReconstruct full state vector from sparse Map representation.
ProtectedgetReconstruct 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.
ProtectedgetAbstractapplyApplies a unitary transformation to the quantum state.
Evolves the quantum state in time according to a Hamiltonian operator.
AbstractnormalizeReturns a normalized copy of this quantum state.
AbstractwithProtectedinvalidateInvalidates memoized amplitude cache when state changes.
ProtectedchooseSelects the appropriate representation for the quantum state.
ProtectedselectSelect the best representation type based on size and sparsity.
ProtectedshouldProtectedcreateCreate CSR format from sparse Map representation.
ProtectedoptimizeConvert CSR format to memory-optimized TypedArray format.
Calculates the estimated memory usage for the current quantum state.
ProtectedcalculateCalculate memory usage for CSR representation.
ProtectedapplyPerform efficient matrix-vector multiplication for CSR representation.
ProtectedapplyPerform efficient sparse matrix-vector multiplication when both matrix and vector are sparse.
ProtectedapplyApplies unitary matrix multiplication with representation-aware algorithms.
OptionalunitaryOperator: UnitaryOperatorProtectedapplyOptimized application of controlled gates for CSR representation.
ProtectedapplyOptimized application of single-qubit gates to large quantum systems.
ProtectedapplyProtectedapplyProtectedStandard dense matrix-vector multiplication. Uses optimized implementation from math/vector-matrix.ts
Dense unitary matrix
New state vector after multiplication
ProtectedapplyProtectedSparse matrix-vector multiplication for sparse Map representation. Uses optimized implementation from math/vector-matrix.ts
Dense unitary matrix
New state vector after multiplication
ProtectedstateThe total number of basis states in the Hilbert space (its dimension).
ProtectednumThe number of quantum units (e.g., qubits, qutrits) in this state.
ProtectedmaterialThe quantum material associated with this state.
Protected OptionalstateThe state vector containing quantum amplitudes for each basis state. Optional for sparse representations.
Protected OptionalsparseSparse representation using Map for memory optimization
Protected OptionalcsrCSR (Compressed Sparse Row) representation for large sparse states
Protected OptionaloptimizedOptimized CSR representation using TypedArrays
ProtectedrepCurrent representation type
ProtectedsparseConfiguration for sparse optimization
Abstract base class for quantum states with state vector representation.