Qrack  7.0
General classical-emulating-quantum development framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Qrack::StateVectorSparse Class Reference

#include <statevector.hpp>

Inheritance diagram for Qrack::StateVectorSparse:
Inheritance graph
[legend]
Collaboration diagram for Qrack::StateVectorSparse:
Collaboration graph
[legend]

Public Member Functions

 StateVectorSparse (bitCapIntOcl cap)
 
complex read (const bitCapIntOcl &i)
 
void write (const bitCapIntOcl &i, const complex &c)
 
void write2 (const bitCapIntOcl &i1, const complex &c1, const bitCapIntOcl &i2, const complex &c2)
 Optimized "write" that is only guaranteed to write if either amplitude is nonzero. More...
 
void clear ()
 
void copy_in (const complex *copyIn)
 
void copy_in (const complex *copyIn, const bitCapIntOcl offset, const bitCapIntOcl length)
 
void copy_in (StateVectorPtr copyInSv, const bitCapIntOcl srcOffset, const bitCapIntOcl dstOffset, const bitCapIntOcl length)
 
void copy_out (complex *copyOut)
 
void copy_out (complex *copyOut, const bitCapIntOcl offset, const bitCapIntOcl length)
 
void copy (const StateVectorPtr toCopy)
 
void copy (StateVectorSparsePtr toCopy)
 
void shuffle (StateVectorPtr svp)
 
void shuffle (StateVectorSparsePtr svp)
 
void get_probs (real1 *outArray)
 
bool is_sparse ()
 
std::vector< bitCapIntOcliterable ()
 
std::set< bitCapIntOcliterable (const bitCapIntOcl &setMask, const bitCapIntOcl &filterMask=0, const bitCapIntOcl &filterValues=0)
 Returns empty if iteration should be over full set, otherwise just the iterable elements: More...
 
- Public Member Functions inherited from Qrack::StateVector
 StateVector (bitCapIntOcl cap)
 
- Public Member Functions inherited from Qrack::ParallelFor
 ParallelFor ()
 
virtual ~ParallelFor ()
 
void SetConcurrencyLevel (unsigned num)
 
unsigned GetConcurrencyLevel ()
 
bitCapIntOcl GetStride ()
 
void par_for_inc (const bitCapIntOcl begin, const bitCapIntOcl itemCount, IncrementFunc, ParallelFunc fn)
 Iterate through the permutations a maximum of end-begin times, allowing the caller to control the incrementation offset through 'inc'. More...
 
void par_for (const bitCapIntOcl begin, const bitCapIntOcl end, ParallelFunc fn)
 Call fn once for every numerical value between begin and end. More...
 
void par_for_skip (const bitCapIntOcl begin, const bitCapIntOcl end, const bitCapIntOcl skipPower, const bitLenInt skipBitCount, ParallelFunc fn)
 Skip over the skipPower bits. More...
 
void par_for_mask (const bitCapIntOcl, const bitCapIntOcl, const bitCapIntOcl *maskArray, const bitLenInt maskLen, ParallelFunc fn)
 Skip over the bits listed in maskArray in the same fashion as par_for_skip. More...
 
void par_for_set (const std::set< bitCapIntOcl > &sparseSet, ParallelFunc fn)
 Iterate over a sparse state vector. More...
 
void par_for_set (const std::vector< bitCapIntOcl > &sparseSet, ParallelFunc fn)
 Iterate over a sparse state vector. More...
 
void par_for_sparse_compose (const std::vector< bitCapIntOcl > &lowSet, const std::vector< bitCapIntOcl > &highSet, const bitLenInt &highStart, ParallelFunc fn)
 Iterate over the power set of 2 sparse state vectors. More...
 
void par_for_qbdt (const bitCapInt begin, const bitCapInt end, BdtFunc fn)
 Iterate over a QBDT tree. More...
 
real1_f par_norm (const bitCapIntOcl maxQPower, const StateVectorPtr stateArray, real1_f norm_thresh=ZERO_R1)
 Calculate the normal for the array, (with flooring). More...
 
real1_f par_norm_exact (const bitCapIntOcl maxQPower, const StateVectorPtr stateArray)
 Calculate the normal for the array, (without flooring.) More...
 

Protected Member Functions

complex readUnlocked (const bitCapIntOcl &i)
 
complex readLocked (const bitCapIntOcl &i)
 

Protected Attributes

SparseStateVecMap amplitudes
 
std::mutex mtx
 
- Protected Attributes inherited from Qrack::StateVector
bitCapIntOcl capacity
 

Additional Inherited Members

- Public Attributes inherited from Qrack::StateVector
bool isReadLocked
 

Constructor & Destructor Documentation

◆ StateVectorSparse()

Qrack::StateVectorSparse::StateVectorSparse ( bitCapIntOcl  cap)
inline

Member Function Documentation

◆ clear()

void Qrack::StateVectorSparse::clear ( )
inlinevirtual

Implements Qrack::StateVector.

◆ copy() [1/2]

void Qrack::StateVectorSparse::copy ( const StateVectorPtr  toCopy)
inlinevirtual

Implements Qrack::StateVector.

◆ copy() [2/2]

void Qrack::StateVectorSparse::copy ( StateVectorSparsePtr  toCopy)
inline

◆ copy_in() [1/3]

void Qrack::StateVectorSparse::copy_in ( const complex copyIn)
inlinevirtual

Implements Qrack::StateVector.

◆ copy_in() [2/3]

void Qrack::StateVectorSparse::copy_in ( const complex copyIn,
const bitCapIntOcl  offset,
const bitCapIntOcl  length 
)
inlinevirtual

Implements Qrack::StateVector.

◆ copy_in() [3/3]

void Qrack::StateVectorSparse::copy_in ( StateVectorPtr  copyInSv,
const bitCapIntOcl  srcOffset,
const bitCapIntOcl  dstOffset,
const bitCapIntOcl  length 
)
inlinevirtual

Implements Qrack::StateVector.

◆ copy_out() [1/2]

void Qrack::StateVectorSparse::copy_out ( complex copyOut)
inlinevirtual

Implements Qrack::StateVector.

◆ copy_out() [2/2]

void Qrack::StateVectorSparse::copy_out ( complex copyOut,
const bitCapIntOcl  offset,
const bitCapIntOcl  length 
)
inlinevirtual

Implements Qrack::StateVector.

◆ get_probs()

void Qrack::StateVectorSparse::get_probs ( real1 outArray)
inlinevirtual

Implements Qrack::StateVector.

◆ is_sparse()

bool Qrack::StateVectorSparse::is_sparse ( )
inlinevirtual

Implements Qrack::StateVector.

◆ iterable() [1/2]

std::vector<bitCapIntOcl> Qrack::StateVectorSparse::iterable ( )
inline

◆ iterable() [2/2]

std::set<bitCapIntOcl> Qrack::StateVectorSparse::iterable ( const bitCapIntOcl setMask,
const bitCapIntOcl filterMask = 0,
const bitCapIntOcl filterValues = 0 
)
inline

Returns empty if iteration should be over full set, otherwise just the iterable elements:

◆ read()

complex Qrack::StateVectorSparse::read ( const bitCapIntOcl i)
inlinevirtual

Implements Qrack::StateVector.

◆ readLocked()

complex Qrack::StateVectorSparse::readLocked ( const bitCapIntOcl i)
inlineprotected

◆ readUnlocked()

complex Qrack::StateVectorSparse::readUnlocked ( const bitCapIntOcl i)
inlineprotected

◆ shuffle() [1/2]

void Qrack::StateVectorSparse::shuffle ( StateVectorPtr  svp)
inlinevirtual

Implements Qrack::StateVector.

◆ shuffle() [2/2]

void Qrack::StateVectorSparse::shuffle ( StateVectorSparsePtr  svp)
inline

◆ write()

void Qrack::StateVectorSparse::write ( const bitCapIntOcl i,
const complex c 
)
inlinevirtual

Implements Qrack::StateVector.

◆ write2()

void Qrack::StateVectorSparse::write2 ( const bitCapIntOcl i1,
const complex c1,
const bitCapIntOcl i2,
const complex c2 
)
inlinevirtual

Optimized "write" that is only guaranteed to write if either amplitude is nonzero.

(Useful for the result of 2x2 tensor slicing.)

Implements Qrack::StateVector.

Member Data Documentation

◆ amplitudes

SparseStateVecMap Qrack::StateVectorSparse::amplitudes
protected

◆ mtx

std::mutex Qrack::StateVectorSparse::mtx
protected

The documentation for this class was generated from the following file: