Qrack  9.0
General classical-emulating-quantum development framework
Public Member Functions | Private Attributes | List of all members
Qrack::ParallelFor Class Reference

#include <parallel_for.hpp>

Inheritance diagram for Qrack::ParallelFor:
Inheritance graph
[legend]

Public Member Functions

 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...
 

Private Attributes

const bitCapIntOcl pStride
 
bitLenInt dispatchThreshold
 
unsigned numCores
 

Constructor & Destructor Documentation

◆ ParallelFor()

Qrack::ParallelFor::ParallelFor ( )

Member Function Documentation

◆ GetConcurrencyLevel()

unsigned Qrack::ParallelFor::GetConcurrencyLevel ( )
inline

◆ GetPreferredConcurrencyPower()

bitLenInt Qrack::ParallelFor::GetPreferredConcurrencyPower ( )
inline

◆ GetStride()

bitCapIntOcl Qrack::ParallelFor::GetStride ( )
inline

◆ par_for()

void Qrack::ParallelFor::par_for ( const bitCapIntOcl  begin,
const bitCapIntOcl  end,
ParallelFunc  fn 
)

Call fn once for every numerical value between begin and end.

◆ par_for_inc()

void Qrack::ParallelFor::par_for_inc ( const bitCapIntOcl  begin,
const bitCapIntOcl  itemCount,
IncrementFunc  inc,
ParallelFunc  fn 
)

Iterate through the permutations a maximum of end-begin times, allowing the caller to control the incrementation offset through 'inc'.

◆ par_for_mask()

void Qrack::ParallelFor::par_for_mask ( const bitCapIntOcl  begin,
const bitCapIntOcl  end,
const std::vector< bitCapIntOcl > &  maskArray,
ParallelFunc  fn 
)

Skip over the bits listed in maskArray in the same fashion as par_for_skip.

◆ par_for_set() [1/2]

void Qrack::ParallelFor::par_for_set ( const std::set< bitCapIntOcl > &  sparseSet,
ParallelFunc  fn 
)

Iterate over a sparse state vector.

◆ par_for_set() [2/2]

void Qrack::ParallelFor::par_for_set ( const std::vector< bitCapIntOcl > &  sparseSet,
ParallelFunc  fn 
)

Iterate over a sparse state vector.

◆ par_for_skip()

void Qrack::ParallelFor::par_for_skip ( const bitCapIntOcl  begin,
const bitCapIntOcl  end,
const bitCapIntOcl  skipPower,
const bitLenInt  skipBitCount,
ParallelFunc  fn 
)

Skip over the skipPower bits.

For example, if skipPower is 2, it will count: 0000, 0001, 0100, 0101, 1000, 1001, 1100, 1101. ^ ^ ^ ^ ^ ^ ^ ^ - The second bit is untouched.

◆ par_for_sparse_compose()

void Qrack::ParallelFor::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.

◆ par_norm()

real1_f Qrack::ParallelFor::par_norm ( const bitCapIntOcl  maxQPower,
const StateVectorPtr  stateArray,
real1_f  norm_thresh = ZERO_R1_F 
)

Calculate the normal for the array, (with flooring).

◆ par_norm_exact()

real1_f Qrack::ParallelFor::par_norm_exact ( const bitCapIntOcl  maxQPower,
const StateVectorPtr  stateArray 
)

Calculate the normal for the array, (without flooring.)

◆ SetConcurrencyLevel()

void Qrack::ParallelFor::SetConcurrencyLevel ( unsigned  num)
inline

Member Data Documentation

◆ dispatchThreshold

bitLenInt Qrack::ParallelFor::dispatchThreshold
private

◆ numCores

unsigned Qrack::ParallelFor::numCores
private

◆ pStride

const bitCapIntOcl Qrack::ParallelFor::pStride
private

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