42 rho[i][j]=density.rho[i][j];
53 rho[i][j]=density.rho[i][j];
64 for(i=0;i<dim;i++)
delete [] rho[i];
79 for(i=0;i<dim;i++)
delete [] rho[i];
100 assert(i<dim&&j<dim);
105 assert(i<dim&&j<dim);
128 report(
ERROR,
"EvtGen")<<
"Not matching dimensions in NormalizedProb"<<endl;
133 norm+=
real(rho[i][i]);
135 prob+=rho[i][j]*d.rho[i][j];
139 if (
imag(prob)>0.00000001*
real(prob)) {
140 report(
ERROR,
"EvtGen")<<
"Imaginary probability:"<<prob<<
" "<<norm<<endl;
142 if (
real(prob)<0.0) {
143 report(
ERROR,
"EvtGen")<<
"Negative probability:"<<prob<<
" "<<norm<<endl;
146 return real(prob)/norm;
153 report(
ERROR,
"EvtGen")<<
"dim="<<dim<<
"in SpinDensity::Check"<<endl;
160 if (
real(rho[i][i])<0.0)
return 0;
161 if (
imag(rho[i][i])*1000000.0>
abs(rho[i][i])) {
168 for(j=i+1;j<dim;j++){
169 if (fabs(
real(rho[i][j]-rho[j][i]))>
170 0.00000001*(
abs(rho[i][i])+
abs(rho[j][j]))) {
174 if (fabs(
imag(rho[i][j]+rho[j][i]))>
175 0.00000001*(
abs(rho[i][i])+
abs(rho[j][j]))) {
190 s <<
"Dimension:"<<d.dim<<endl;
192 for (i=0;i<d.dim;i++){
193 for (j=0;j<d.dim;j++){
194 s << d.rho[i][j]<<
" ";
double imag(const EvtComplex &c)
ostream & report(Severity severity, const char *facility)
ostream & operator<<(ostream &s, const EvtSpinDensity &d)
double NormalizedProb(const EvtSpinDensity &d)
const EvtComplex & Get(int i, int j) const
void Set(int i, int j, const EvtComplex &rhoij)
EvtSpinDensity & operator=(const EvtSpinDensity &density)
virtual ~EvtSpinDensity()