Qrack  9.13
General classical-emulating-quantum development framework
Public Member Functions | Protected Attributes | List of all members
Qrack::StateVector Class Referenceabstract

#include <statevector.hpp>

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

Public Member Functions

 StateVector (bitCapIntOcl cap)
 
virtual ~StateVector ()
 
virtual complex read (const bitCapIntOcl &i)=0
 
virtual void write (const bitCapIntOcl &i, const complex &c)=0
 
virtual void write2 (const bitCapIntOcl &i1, const complex &c1, const bitCapIntOcl &i2, const complex &c2)=0
 Optimized "write" that is only guaranteed to write if either amplitude is nonzero. More...
 
virtual void clear ()=0
 
virtual void copy_in (const complex *inArray)=0
 
virtual void copy_in (const complex *copyIn, const bitCapIntOcl offset, const bitCapIntOcl length)=0
 
virtual void copy_in (StateVectorPtr copyInSv, const bitCapIntOcl srcOffset, const bitCapIntOcl dstOffset, const bitCapIntOcl length)=0
 
virtual void copy_out (complex *outArray)=0
 
virtual void copy_out (complex *copyIn, const bitCapIntOcl offset, const bitCapIntOcl length)=0
 
virtual void copy (StateVectorPtr toCopy)=0
 
virtual void shuffle (StateVectorPtr svp)=0
 
virtual void get_probs (real1 *outArray)=0
 
- Public Member Functions inherited from Qrack::ParallelFor
 ParallelFor ()
 
void SetConcurrencyLevel (unsigned num)
 
unsigned GetConcurrencyLevel ()
 
bitCapIntOcl GetStride ()
 
bitLenInt GetPreferredConcurrencyPower ()
 
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 std::vector< bitCapIntOcl > &maskArray, 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...
 
real1_f par_norm (const bitCapIntOcl maxQPower, const StateVectorPtr stateArray, real1_f norm_thresh=ZERO_R1_F)
 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 Attributes

bitCapIntOcl capacity
 

Constructor & Destructor Documentation

◆ StateVector()

Qrack::StateVector::StateVector ( bitCapIntOcl  cap)
inline

◆ ~StateVector()

virtual Qrack::StateVector::~StateVector ( )
inlinevirtual

Member Function Documentation

◆ clear()

virtual void Qrack::StateVector::clear ( )
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy()

virtual void Qrack::StateVector::copy ( StateVectorPtr  toCopy)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy_in() [1/3]

virtual void Qrack::StateVector::copy_in ( const complex copyIn,
const bitCapIntOcl  offset,
const bitCapIntOcl  length 
)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy_in() [2/3]

virtual void Qrack::StateVector::copy_in ( const complex inArray)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy_in() [3/3]

virtual void Qrack::StateVector::copy_in ( StateVectorPtr  copyInSv,
const bitCapIntOcl  srcOffset,
const bitCapIntOcl  dstOffset,
const bitCapIntOcl  length 
)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy_out() [1/2]

virtual void Qrack::StateVector::copy_out ( complex copyIn,
const bitCapIntOcl  offset,
const bitCapIntOcl  length 
)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ copy_out() [2/2]

virtual void Qrack::StateVector::copy_out ( complex outArray)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ get_probs()

virtual void Qrack::StateVector::get_probs ( real1 outArray)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ read()

virtual complex Qrack::StateVector::read ( const bitCapIntOcl i)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ shuffle()

virtual void Qrack::StateVector::shuffle ( StateVectorPtr  svp)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ write()

virtual void Qrack::StateVector::write ( const bitCapIntOcl i,
const complex c 
)
pure virtual

Implemented in Qrack::StateVectorArray.

◆ write2()

virtual void Qrack::StateVector::write2 ( const bitCapIntOcl i1,
const complex c1,
const bitCapIntOcl i2,
const complex c2 
)
pure virtual

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

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

Implemented in Qrack::StateVectorArray.

Member Data Documentation

◆ capacity

bitCapIntOcl Qrack::StateVector::capacity
protected

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