4 #ifndef CPPQEDCORE_QUANTUMDATA_DISTRIBUTIONFUNCTIONS_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMDATA_DISTRIBUTIONFUNCTIONS_H_INCLUDED
13 #include <boost/math/special_functions/factorials.hpp>
23 &fLimitXUL, &fLimitYUL, &fLimitXL, &fLimitXU, &fLimitYL, &fLimitYU, &fStep;
34 double w(
size_t n,
double r,
size_t k);
58 template<
typename DensityOperatorFunctor>
59 double wignerFunction(
const DensityOperatorFunctor& rho,
double x,
double y,
size_t truncatedDimension=0)
61 using namespace mathutils;
using boost::math::factorial;
65 static dcomp _(
const DensityOperatorFunctor& rho,
size_t dim,
double r,
size_t k)
68 for (
size_t n=0; n<dim-k; ++n) res+=details::w(n,r,k)*rho(n+k)(n);
73 const double r=sqrt(sqr(x)+sqr(y)), phi=(x || y) ? atan2(y,x) : 0.;
75 const size_t dim=truncatedDimension && truncatedDimension<rho.getDimension(0) ? truncatedDimension : rho.getDimension(0);
77 double res=real(Helper::_(rho,dim,r,0));
79 for (
size_t k=1; k<dim; ++k) res+=2*real(Helper::_(rho,dim,r,k)*exp(-
DCOMP_I*(k*phi)));
84 template<
typename DensityOperator>
85 double qFunction(
const DensityOperator& rho,
double x,
double y,
size_t)
89 const dcomp alpha(x,y);
93 for (
size_t m=0; m<rho.getDimension(); ++m)
for (
size_t n=0; n<rho.getDimension(); ++n)
96 return exp(-sqrAbs(alpha))*real(qComplex);
107 dcomp operator()(
size_t m,
size_t n)
const;
110 const Hermites hermite_m2x_, hermite_2y_;
116 template<
typename DensityOperatorFunctor>
117 double wignerFunctionOld(
const DensityOperatorFunctor& rho,
double x,
double y,
size_t truncatedDimension=0)
120 using namespace mathutils;
using boost::math::factorial;
122 const size_t dim=truncatedDimension ? truncatedDimension : rho.getDimension(0);
128 for (
size_t m=0; m<dim; ++m) {
129 res+=real(minusOneToThePowerOf(m)/factorial<double>(m)*rho(m,m)*pow(2.*
DCOMP_I,-2*m)*wignerFunctionKernel(m,m));
131 for (
size_t n=m+1; n<dim; ++n)
132 res+=2.*real(minusOneToThePowerOf(m)/sqrt(factorial<double>(n)*factorial<double>(m))*rho(n,m)*pow(2.*
DCOMP_I,-m-n)*wignerFunctionKernel(n,m));
136 return 2./PI*exp(-2*(sqr(x)+sqr(y)))*res;
142 template<
typename DistributionFunctor,
typename DensityOperator>
145 if (pfs.fLimitXUL) pfs.fLimitXL=-(pfs.fLimitXU=pfs.fLimitXUL);
146 if (pfs.fLimitYUL) pfs.fLimitYL=-(pfs.fLimitYU=pfs.fLimitYUL);
147 for (
double x=pfs.fLimitXL; x<pfs.fLimitXU; x+=pfs.fStep) {
148 for (
double y=pfs.fLimitYL; y<pfs.fLimitYU; y+=pfs.fStep) os<<x<<
"\t"<<y<<
"\t"<<distributionFunctor(rho,x,y,pfs.fCutoff)<<std::endl;
158 #endif // CPPQEDCORE_QUANTUMDATA_DISTRIBUTIONFUNCTIONS_H_INCLUDED
Comprises classes representing the state of composite quantum systems and providing various interface...
Density operator of arbitrary arity.
const dcomp DCOMP_I(0, 1)
Imaginary unit.
Defines wrapper functions for mathematical functions taken from libraries, and several other mathemat...
blitz::Array< double, RANK > DArray
An array of doubles of arbitrary arity.
dcomp coherentElement(unsigned long n, const dcomp &alpha)
Calculates relying on the Stirling formula if is too large for explicit calculation of factorial...
The parameter table according to which the command line will be parsed by update() ...
std::ostream & scanFunction(DistributionFunctor distributionFunctor, const DensityOperator &rho, std::ostream &os, const ParsFunctionScan &pfs)
Creates a map of the Wigner function over the region specified by pfs and streams it in a format suit...
double wignerFunction(const DensityOperatorFunctor &rho, double x, double y, size_t truncatedDimension=0)
Calculates the Wigner function corresponding to a harmonic-oscillator mode density matrix expressed i...
Additional helpers for dcomp.
Comprises wrapper functions for mathematical functions taken from libraries (Boost.Math, GSL), and several other mathematical functions.
quantumdata::DensityOperator< 1 > DensityOperator
unary DensityOperator
Parameter set for scanFunction.
std::complex< double > dcomp
Double-precision complex number.
Defines template aliases for real and complex arrays.