4 #ifndef CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONAL_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONAL_H_INCLUDED
8 #ifndef QUANTUMOPERATOR_TRIDIAGONAL_MAX_RANK
9 #define QUANTUMOPERATOR_TRIDIAGONAL_MAX_RANK BLITZ_ARRAY_LARGEST_RANK
10 #endif // QUANTUMOPERATOR_TRIDIAGONAL_MAX_RANK
12 #include "TridiagonalFwd.h"
18 #include "BlitzTinyOfArrays.tcc"
40 apply(
const typename quantumdata::Types<RANK>::StateVectorLow& psi,
typename quantumdata::Types<RANK>::StateVectorLow& dpsidt,
41 const Tridiagonal<RANK>&);
46 const Tridiagonal<RANK>
47 furnishWithFreqs(
const Tridiagonal<RANK>& tridiag,
48 const typename Tridiagonal<RANK>::Diagonal& mainDiagonal
53 const Tridiagonal<1> zero (
size_t);
55 const Tridiagonal<1> identity(
size_t);
111 typedef blitzplusplus::TinyOfArrays<dcomp,RANK,LENGTH>
Diagonals;
121 typedef typename quantumdata::Types<RANK>::StateVectorLow StateVectorLow;
124 typedef blitz::TinyVector<blitz::TinyVector<blitz::Range,3>,RANK> Ranges;
128 typedef mpl::int_<RANK> IntRANK;
130 static const mpl::int_<1> _1_ ;
131 static const Diagonal empty;
158 const Diagonal& minus=empty,
159 const Diagonal& plus=empty,
211 void apply(
const StateVectorLow& psi, StateVectorLow& dpsidt)
const;
231 const Diagonals &
get ()
const {
return diagonals_;}
232 const Dimensions& getDifferences()
const {
return differences_;}
234 double getTime ()
const {
return tCurrent_;}
236 const Diagonals & getFreqs ()
const {
return freqs_;}
280 Tridiagonal(
const Base& base,
const Diagonals& diagonals,
const Dimensions& differences,
double tCurrent,
const Diagonals& freqs)
281 : Base(base), diagonals_(
blitzplusplus::DeepCopy(),diagonals), differences_(differences), tCurrent_(tCurrent), freqs_(
blitzplusplus::DeepCopy(),freqs) {}
285 template<
int START,
typename V_DPSIDT,
typename V_A,
typename V_PSI,
int REMAINING>
286 void doApply(mpl::int_<REMAINING>,
const Ranges&,
const StateVectorLow&, StateVectorLow&)
const;
288 template<
int START,
typename V_DPSIDT,
typename V_A,
typename V_PSI>
289 void doApply(mpl::int_<0>,
const Ranges&,
const StateVectorLow&, StateVectorLow&)
const;
291 struct FillRangesHelper
293 typedef const typename StateVectorLow::T_index Bound;
295 FillRangesHelper(Ranges& ranges,
const Bound& ubound,
const Dimensions& k) : ranges_(ranges), ubound_(ubound), k_(k) {}
297 template<
typename ICW>
void operator()(ICW);
301 const Bound& ubound_;
302 const Dimensions& k_;
306 const Ranges fillRanges(
const typename StateVectorLow::T_index&)
const;
311 Diagonals diagonals_;
313 Dimensions differences_;
327 apply(
const typename quantumdata::Types<RANK>::StateVectorLow& psi,
typename quantumdata::Types<RANK>::StateVectorLow& dpsidt,
328 const Tridiagonal<RANK>& tridiag)
330 tridiag.apply(psi,dpsidt);
335 template<
int RANK1,
int RANK2>
337 const Tridiagonal<RANK1+RANK2>
367 std::ostream& operator<<(std::ostream&, const Tridiagonal<RANK>&);
373 #endif // CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONAL_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
const Tridiagonal< RANK > tridiagMinusHC(const Tridiagonal< RANK > &tridiag)
Returns the anti-Hermitian operator .
Defines class of the same name.
Tridiagonal & propagate(double t)
Updates the elements of the matrix to time instant t using the stored frequencies.
Tridiagonal & operator*=(const dcomp &dc)
Naively implemented, could be templated if need arises – Frequencies untouched.
const Tridiagonal operator-() const
Returns a (deep) copy with negated diagonals. Frequencies remain untouched.
void apply(const StateVectorLow &psi, StateVectorLow &dpsidt) const
“Applies” the tridiagonal matrix on the state vector psiprime, in the vein of structure::Hamiltonia...
const Tridiagonal< 1 > zero(size_t)
Unary zero operator as a Tridiagonal.
Tridiagonal & operator+=(const Tridiagonal &)
Naive addition.
blitzplusplus::TinyOfArrays< dcomp, RANK, LENGTH > Diagonals
The class is implemented in terms of a blitzplusplus::TinyOfArrays, this is the class used to store t...
const dcomp DCOMP_I(0, 1)
Imaginary unit.
Tridiagonal & operator/=(const dcomp &dc)
”
IdxTiny< RANK > Idx
The type used for indexing the “rows” and the “columns”: a tiny vector of integers (multi-index) ...
Tridiagonal(const Diagonal &zero=empty, size_t k=0, const Diagonal &minus=empty, const Diagonal &plus=empty, bool toFreqs=false, IntRANK=_1_)
Constructor for unary Tridiagonal.
static const int N_RANK
Reports the class’s rank for example towards DirectProduct.
const Tridiagonal operator+() const
Returns a (deep) copy.
Defines class of the same name.
const Tridiagonal< RANK1+RANK2 > operator*(const Tridiagonal< RANK1 > &t1, const Tridiagonal< RANK2 > &t2)
Direct product.
Tridiagonal & operator*=(double d)
”
const Tridiagonal< RANK > tridiagPlusHC_overI(const Tridiagonal< RANK > &tridiag)
Returns the anti-Hermitian operator .
Stores and manipulates dimensions of constructs over composite Hilbert spaces of arbitrary arity...
const Tridiagonal< RANK > tridiagPlusHC(const Tridiagonal< RANK > &tridiag)
Returns the Hermitian operator .
const dcomp average(const quantumdata::LazyDensityOperator< RANK > &, const typename quantumdata::LazyDensityOperator< RANK >::Idx &, IntRANK=_1_)
Calculates the quantum average of a Tridiagonal in a quantum state described by a (unary) quantumdata...
const Tridiagonal dagger() const
Same as hermitianConjugate.
Tridiagonal & furnishWithFreqs(const Diagonal &mainDiagonal, IntRANK=_1_)
Furnishes a unary tridiagonal with frequencies calculated from mainDiagonal.
Defines class of the same name.
Common interface for calculating quantum averages.
Tridiagonal & operator-=(const Tridiagonal &tridiag)
Implemented in terms of operator+=.
Diagonals::T_numtype Diagonal
A unary complex blitz array.
static const int LENGTH
The number of Diagonals the class has to store.
Base::Dimensions Dimensions
Inherited from DimensionsBookkeeper.
Tridiagonal & operator/=(double d)
”
Comprises modules representing operators of special structure (tridiagonal, sparse) over Hilbert spac...
CVector & apply(const CVector &a, CVector &b, const CMatrix &m)
Applies matrix m on a and adds the result to b
std::complex< double > dcomp
Double-precision complex number.
Tridiagonal(const Tridiagonal &tridiag)
Copy constructor with deep-copy semantics.
ExtTiny< RANK > Dimensions
The dimensions as a static vector of size N_RANK.
Operator aggregate for a complex vector space built on top of Boost.Operator.
Comprises our own extensions to Blitz++.
Defines tentative base classes for the exception classes of the framework.
Class representing a (unary) tridiagonal matrix or direct product of such matrices.
const Tridiagonal hermitianConjugate() const
Returns a newly constructed object, which is the Hermitian conjugate of this.
Extensions built on top of Boost.Operator.