33 #include "lsconstants.h" 37 void PowSpec::dealloc()
47 PowSpec::PowSpec(
int nspec,
int lmax)
55 planck_assert((num_specs==1) || (num_specs==4) || (num_specs==6),
56 "incorrect number of spectral components");
58 planck_assert(multiequal(tsize(0),gg_.size(),cc_.size(),tg_.size(),
59 tc_.size(),gc_.size()),
"incorrect array sizes");
62 planck_assert(multiequal(tt_.size(),gg_.size(),cc_.size(),tg_.size()),
63 "incorrect array sizes");
64 planck_assert(multiequal(tsize(0),tc_.size(),gc_.size()),
65 "incorrect array sizes");
68 planck_assert(multiequal(tt_.size(),gg_.size(),cc_.size(),tg_.size(),
69 tc_.size(),gc_.size()),
"incorrect array sizes");
74 for (tsize l=0; l<tt_.size(); ++l)
75 if (tt_[l]<0)
return false;
77 for (tsize l=0; l<tt_.size(); ++l)
79 if (gg_[l]<0)
return false;
80 if (cc_[l]<0)
return false;
81 if (abs(tg_[l])>sqrt(tt_[l]*gg_[l]))
return false;
84 for (tsize l=0; l<tt_.size(); ++l)
86 if (abs(tc_[l])>sqrt(tt_[l]*cc_[l]))
return false;
87 if (abs(gc_[l])>sqrt(gg_[l]*cc_[l]))
return false;
95 planck_assert ((num_specs==1) || (num_specs==4) || (num_specs==6),
96 "wrong number of spectrums");
115 tt_.transfer(tt_new);
117 if (!consistentAutoPowspec())
118 cerr <<
"Warning: negative values in TT spectrum" << endl;
122 arr<double> &cc_new, arr<double> &tg_new)
126 tt_.transfer(tt_new); gg_.transfer(gg_new);
127 cc_.transfer(cc_new); tg_.transfer(tg_new);
131 void PowSpec::Set(arr<double> &tt_new, arr<double> &gg_new, arr<double> &cc_new,
132 arr<double> &tg_new, arr<double> &tc_new, arr<double> &gc_new)
134 Set (tt_new, gg_new, cc_new, tg_new);
136 tc_.transfer(tc_new); gc_.transfer(gc_new);
142 double sigma = fwhm*fwhm2sigma;
143 double fact_pol = exp(2*sigma*sigma);
144 for (tsize l=0; l<tt_.size(); ++l)
146 double f1 = exp(-.5*l*(l+1)*sigma*sigma);
147 double f2 = f1*fact_pol;
void Set(int nspec, int lmax)
void smoothWithGauss(double fwhm)
void assertArraySizes() const
bool consistentAutoPowspec() const