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

#include <statevector.hpp>

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

Public Member Functions

 StateVectorArray (bitCapIntOcl cap)
 
virtual ~StateVectorArray ()
 
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 (StateVectorPtr toCopy)
 
void copy (StateVectorArrayPtr toCopy)
 
void shuffle (StateVectorPtr svp)
 
void shuffle (StateVectorArrayPtr svp)
 
void get_probs (real1 *outArray)
 
- Public Member Functions inherited from Qrack::StateVector
 StateVector (bitCapIntOcl cap)
 
virtual ~StateVector ()
 
- 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...
 

Public Attributes

std::unique_ptr< complex[], void(*)(complex *)> amplitudes
 

Protected Member Functions

std::unique_ptr< complex[], void(*)(complex *)> Alloc (bitCapIntOcl elemCount)
 
virtual void Free ()
 

Additional Inherited Members

- Protected Attributes inherited from Qrack::StateVector
bitCapIntOcl capacity
 

Constructor & Destructor Documentation

◆ StateVectorArray()

Qrack::StateVectorArray::StateVectorArray ( bitCapIntOcl  cap)
inline

◆ ~StateVectorArray()

virtual Qrack::StateVectorArray::~StateVectorArray ( )
inlinevirtual

Member Function Documentation

◆ Alloc()

std::unique_ptr<complex[], void (*)(complex*)> Qrack::StateVectorArray::Alloc ( bitCapIntOcl  elemCount)
inlineprotected

◆ clear()

void Qrack::StateVectorArray::clear ( )
inlinevirtual

Implements Qrack::StateVector.

◆ copy() [1/2]

void Qrack::StateVectorArray::copy ( StateVectorArrayPtr  toCopy)
inline

◆ copy() [2/2]

void Qrack::StateVectorArray::copy ( StateVectorPtr  toCopy)
inlinevirtual

Implements Qrack::StateVector.

◆ copy_in() [1/3]

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

Implements Qrack::StateVector.

◆ copy_in() [2/3]

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

Implements Qrack::StateVector.

◆ copy_in() [3/3]

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

Implements Qrack::StateVector.

◆ copy_out() [1/2]

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

Implements Qrack::StateVector.

◆ copy_out() [2/2]

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

Implements Qrack::StateVector.

◆ Free()

virtual void Qrack::StateVectorArray::Free ( )
inlineprotectedvirtual

◆ get_probs()

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

Implements Qrack::StateVector.

◆ read()

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

Implements Qrack::StateVector.

◆ shuffle() [1/2]

void Qrack::StateVectorArray::shuffle ( StateVectorArrayPtr  svp)
inline

◆ shuffle() [2/2]

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

Implements Qrack::StateVector.

◆ write()

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

Implements Qrack::StateVector.

◆ write2()

void Qrack::StateVectorArray::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

std::unique_ptr<complex[], void (*)(complex*)> Qrack::StateVectorArray::amplitudes

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