C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
blitzplusplus Namespace Reference

Comprises our own extensions to Blitz++. More...

Namespaces

 basi
 The name of the namespace stands for BlitzArraySliceIterator.
 
 basi_fast
 Contains a “fast” version of BlitzArraySliceIterator.
 
 vfmsi
 The name of the namespace stands for VectorFromMatrixSliceIterator.
 

Classes

class  BinaryArrayOrderingErrorException
 Exception class thrown by binaryArray. More...
 
struct  HalfCutTinyException
 Exception class thrown by halfCutTiny. More...
 
class  NonContiguousStorageException
 Exception class thrown by unaryArray & binaryArray. More...
 
class  SlicesData
 Contains data for pre-calculated slices for basi_fast::Iterator. More...
 
struct  TinyVectorLengthTraits
 An indirection for accessing lengths of blitz::TinyVector at compile time. More...
 

Functions

bool isfinite (double d)
 
 BZ_DECLARE_FUNCTION_RET (isfinite, bool)
 
double selectNegative (double d)
 
 BZ_DECLARE_FUNCTION_RET (selectNegative, double)
 
template<typename T , int RANK>
const blitz::Array< T, 1 > unaryArray (const blitz::Array< T, RANK > &)
 Returns a unary view of array More...
 
template<typename T , int TWO_TIMES_RANK>
const blitz::Array< T, 2 > binaryArray (const blitz::Array< T, TWO_TIMES_RANK > &array)
 Returns a binary view of array. TWO_TIMES_RANK must be an even number. More...
 
template<typename T1 , typename T2 , int RANK1, int RANK2>
blitz::TinyVector< T1, RANK1+RANK2 > concatenateTinies (const blitz::TinyVector< T1, RANK1 > &tiny1, const blitz::TinyVector< T2, RANK2 > &tiny2)
 Concatenates tiny1 and tiny2 More...
 
template<typename T , int TWO_TIMES_RANK>
blitz::TinyVector< T, TWO_TIMES_RANK/2 > halfCutTiny (const blitz::TinyVector< T, TWO_TIMES_RANK > &)
 Returns the first half of a tiny vector containing two equal halves. More...
 
double sqrAbs (const dcomp &c)
 
 BZ_DECLARE_FUNCTION_RET (sqrAbs, double)
 
template<int TWO_TIMES_RANK>
void hermitianConjugateSelf (CArray< TWO_TIMES_RANK > &)
 
template<int TWO_TIMES_RANK>
const CArray< TWO_TIMES_RANK > hermitianConjugate (const CArray< TWO_TIMES_RANK > &)
 
template<bool IS_MULTIPLICATION, int RANK1, int RANK2>
const CArray< RANK1+RANK2 > doDirect (const CArray< RANK1 > &, const CArray< RANK2 > &)
 Direct product/sum. More...
 

Detailed Description

Comprises our own extensions to Blitz++.

Function Documentation

template<typename T , int TWO_TIMES_RANK>
const blitz::Array<T,2> blitzplusplus::binaryArray ( const blitz::Array< T, TWO_TIMES_RANK > &  array)

Returns a binary view of array. TWO_TIMES_RANK must be an even number.

Violation is detected @ compile time by tmptools::AssertEvenAndDivideBy2.

The same requirement of contiguity an the same warning applies as for unaryArray, and in addition, further assumptions on the storage order must be made: The storage of the two multi-indices must not be intertwined and must be layed out in the same way, so that e.g. for RANK=4, the member function array.ordering() should return an octary tiny vector like:

<1 3 2 0 | 5 7 6 4>

Violation is detected at runtime, and an exception of type BinaryArrayOrderingErrorException is thrown.

Template Parameters
Tthe type the array is based on
TWO_TIMES_RANK2*RANK, RANK being the arity of the vector space
template<typename T1 , typename T2 , int RANK1, int RANK2>
blitz::TinyVector<T1,RANK1+RANK2> blitzplusplus::concatenateTinies ( const blitz::TinyVector< T1, RANK1 > &  tiny1,
const blitz::TinyVector< T2, RANK2 > &  tiny2 
)

Concatenates tiny1 and tiny2

Implemented with the help of the compile-time–runtime facility for_each from Boost.MPL.

Template Parameters
T1basic type of one of the operand tiny vectors and the result
T2basic type of the other operand tiny vector. Must be convertible to T1.
template<bool IS_MULTIPLICATION, int RANK1, int RANK2>
const CArray<RANK1+RANK2> blitzplusplus::doDirect ( const CArray< RANK1 > &  ,
const CArray< RANK2 > &   
)

Direct product/sum.

Returns the direct product (if IS_MULTIPLICATION) $A_{i,j}=A1_i*A2_j$, or direct sum (otherwise) $A_{i,j}=A1_i+A2_j$ of array1 and array2, with $i,\ j$ running through all the multi-indices. The implementation is in terms of blitzplusplus::unaryArray views of the arguments.

Template Parameters
IS_MULTIPLICATIONgoverns whether direct product or sum is to be calculated
template<typename T , int TWO_TIMES_RANK>
blitz::TinyVector<T,TWO_TIMES_RANK/2> blitzplusplus::halfCutTiny ( const blitz::TinyVector< T, TWO_TIMES_RANK > &  )

Returns the first half of a tiny vector containing two equal halves.

In debug mode, the equality of the two halves is checked, and a HalfCutTinyException is thrown @ violation.

Template Parameters
Tbasic type of the operand tiny vector
TWO_TIMES_RANKlength of the ”
template<typename T , int RANK>
const blitz::Array<T,1> blitzplusplus::unaryArray ( const blitz::Array< T, RANK > &  )

Returns a unary view of array

This is meant to be used only if the underlying storage is contiguous, because while a multi-rank array may be able to represent a view of memory of some more or less intricate structure pattern (e.g. slices), a unary array is not capable of this. In debug mode, violation is detected at runtime via the array.isStorageContiguous() member function and an exception of type NonContiguousStorageException is thrown.

Note
The returned array does not take part in the reference-counting mechanism of blitz::Array, therefore, it does not own its data, and …
Warning
… the returned array has no means of ensuring that the referenced data still exists.
Template Parameters
Tthe type the array is based on
RANKthe arity of the vector space