Qrack  1.7
General classical-emulating-quantum development framework
Public Types | 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 Types

typedef std::function< void(const bitCapInt, const int cpu)> ParallelFunc
 Called once per value between begin and end. More...
 
typedef std::function< bitCapInt(const bitCapInt, const int cpu)> IncrementFunc
 

Public Member Functions

 ParallelFor ()
 
virtual ~ParallelFor ()
 
void SetConcurrencyLevel (int32_t num)
 
int32_t GetConcurrencyLevel ()
 
void par_for_inc (const bitCapInt begin, const bitCapInt 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 bitCapInt begin, const bitCapInt end, ParallelFunc fn)
 Call fn once for every numerical value between begin and end. More...
 
void par_for_skip (const bitCapInt begin, const bitCapInt end, const bitCapInt skipPower, const bitLenInt skipBitCount, ParallelFunc fn)
 Skip over the skipPower bits. More...
 
void par_for_mask (const bitCapInt, const bitCapInt, const bitCapInt *maskArray, const bitLenInt maskLen, ParallelFunc fn)
 Skip over the bits listed in maskArray in the same fashion as par_for_skip. More...
 
real1 par_norm (const bitCapInt maxQPower, const complex *stateArray)
 Calculate the normal for the array. More...
 

Private Attributes

int32_t numCores
 

Member Typedef Documentation

typedef std::function<bitCapInt(const bitCapInt, const int cpu)> Qrack::ParallelFor::IncrementFunc
typedef std::function<void(const bitCapInt, const int cpu)> Qrack::ParallelFor::ParallelFunc

Called once per value between begin and end.

Constructor & Destructor Documentation

Qrack::ParallelFor::ParallelFor ( )
inline
virtual Qrack::ParallelFor::~ParallelFor ( )
inlinevirtual

Member Function Documentation

int32_t Qrack::ParallelFor::GetConcurrencyLevel ( )
inline
void Qrack::ParallelFor::par_for ( const bitCapInt  begin,
const bitCapInt  end,
ParallelFunc  fn 
)

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

void Qrack::ParallelFor::par_for_inc ( const bitCapInt  begin,
const bitCapInt  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'.

void Qrack::ParallelFor::par_for_mask ( const bitCapInt  begin,
const bitCapInt  end,
const bitCapInt maskArray,
const bitLenInt  maskLen,
ParallelFunc  fn 
)

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

void Qrack::ParallelFor::par_for_skip ( const bitCapInt  begin,
const bitCapInt  end,
const bitCapInt  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.

real1 Qrack::ParallelFor::par_norm ( const bitCapInt  maxQPower,
const complex stateArray 
)

Calculate the normal for the array.

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

Member Data Documentation

int32_t Qrack::ParallelFor::numCores
private

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