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

The name of the namespace stands for VectorFromMatrixSliceIterator. More...

Classes

struct  Left
 Indicates composition from left. More...
 
struct  LeftRight
 Metafunction returning the appropriate set of retained index positions. More...
 
struct  Right
 Indicates composition from right. More...
 

Typedefs

template<int RANK, typename S , bool IS_CONST>
using Iterator = basi::Iterator< RANK, LeftRight< RANK/2, S >, IS_CONST >
 Template alias. More...
 

Detailed Description

The name of the namespace stands for VectorFromMatrixSliceIterator.

It comprises tools for adapting basi::Iterators to iteration over rows or columns of (multi)matrices

Semantics
Consider the following piece of code:
// Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
#include <boost/range/algorithm/for_each.hpp>
using boost::for_each; using tmptools::Vector;
template <int RANK> using StateVector =CArray< RANK>;
template <int RANK> using DensityOperator=CArray<2*RANK>;
void actWithA(StateVector<5>&);
Assume that actWithA is defined in such a way that if psi is of type StateVector<5>, then actWithA(psi) results in $A\ket\Psi$.
void composeWithA(DensityOperator<5>& rho)
{
using namespace blitzplusplus::vfmsi;
for_each(fullRange<Left>(rho),actWithA);
}
Then, if rho is of type DensityOperator<5>, then composeWithA(rho) results in $A\rho$.

Typedef Documentation

template<int RANK, typename S , bool IS_CONST>
using blitzplusplus::vfmsi::Iterator = typedef basi::Iterator<RANK,LeftRight<RANK/2,S>,IS_CONST>

Template alias.

Template Parameters
RANKthe arity of the multivectors resulting from the slicing (the rows/colunms of the multimatrix of total arity 2*RANK)
Sshould be either Left or Right
IS_CONSTgoverns constness

Definition at line 62 of file VectorFromMatrixSliceIterator.h.