C++QEDCore  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
quantumoperator Namespace Reference

Comprises modules representing operators of special structure (tridiagonal, sparse) over Hilbert spaces of arbitrary arity. More...

Classes

class  Sigma
 Stateless class implementing the unary quantumoperator $\ket{L}\bra{R}$. More...
 
class  Tridiagonal
 Class representing a (unary) tridiagonal matrix or direct product of such matrices. More...
 
class  TridiagonalHamiltonian
 Implements the action of a Hamiltonian whose matrix consists of a sum of tridiagonal matrices. More...
 

Functions

template<int RANK, bool IS_HEAD>
const quantumdata::Types< RANK-1 >::StateVectorLow partialProject (const typename quantumdata::Types< RANK >::StateVectorLow &psi, int n)
 Helper for DirectProduct::apply. More...
 
template<int RANK>
void apply (const typename quantumdata::Types< RANK >::StateVectorLow &psi, typename quantumdata::Types< RANK >::StateVectorLow &dpsidt, const Tridiagonal< RANK > &tridiag)
 

Detailed Description

Comprises modules representing operators of special structure (tridiagonal, sparse) over Hilbert spaces of arbitrary arity.

Function Documentation

template<int RANK, bool IS_HEAD>
const quantumdata::Types<RANK-1>::StateVectorLow quantumoperator::partialProject ( const typename quantumdata::Types< RANK >::StateVectorLow &  psi,
int  n 
)

Helper for DirectProduct::apply.

Calculates the state-vector slice

\[\ket{\Psi^{\avr{1,2,3,…,\text{rank-2},\text{rank-1}}}(\iota_0=n)}\in\bigotimes_{i=1,2,3,…,\text{rank-2},\text{rank-1}}\HSpace_i\]

if IS_HEAD=true and

\[\ket{\Psi^{\avr{0,1,2,…,\text{rank-3},\text{rank-2}}}(\iota_\text{rank-1}=n)}\in\bigotimes_{i=0,1,2,…,\text{rank-3},\text{rank-2}}\HSpace_i\]

if IS_HEAD=false. The code is automatically generated for all template-parameter combinations (RANK up to BLITZ_ARRAY_LARGEST_RANK) via preprocessor metaprogramming. Cf. quantumoperator/Sigma.cc

1 g++ -P -E -Iutils/ -Iquantumoperator/ -Iquantumdata/ quantumoperator/Sigma.cc | tail -n128
Note
It’s better to convert n into a runtime variable because then we can use complete specializations of this function. Eventually it has to be converted anyway into an index of psi.