本文整理汇总了C++中tmv::MatrixView::canLinearize方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixView::canLinearize方法的具体用法?C++ MatrixView::canLinearize怎么用?C++ MatrixView::canLinearize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmv::MatrixView
的用法示例。
在下文中一共展示了MatrixView::canLinearize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void SBKolmogorov::SBKolmogorovImpl::fillKValue(tmv::MatrixView<std::complex<double> > val,
double kx0, double dkx, double dkxy,
double ky0, double dky, double dkyx) const
{
dbg<<"SBKolmogorov fillKValue\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<" + j * "<<dkxy<<std::endl;
dbg<<"ky = "<<ky0<<" + i * "<<dkyx<<" + j * "<<dky<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
typedef tmv::VIt<std::complex<double>,1,tmv::NonConj> It;
kx0 *= _inv_k0;
dkx *= _inv_k0;
dkxy *= _inv_k0;
ky0 *= _inv_k0;
dky *= _inv_k0;
dkyx *= _inv_k0;
It valit = val.linearView().begin();
for (int j=0;j<n;++j,kx0+=dkxy,ky0+=dky) {
double kx = kx0;
double ky = ky0;
for (int i=0;i<m;++i,kx+=dkx,ky+=dkyx) *valit++ = _flux * _info->kValue(kx*kx+ky*ky);
}
}
示例2: assert
void SBGaussian::SBGaussianImpl::fillXValue(tmv::MatrixView<double> val,
double x0, double dx, double dxy,
double y0, double dy, double dyx) const
{
dbg<<"SBGaussian fillXValue\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<" + j * "<<dxy<<std::endl;
dbg<<"y = "<<y0<<" + i * "<<dyx<<" + j * "<<dy<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
typedef tmv::VIt<double,1,tmv::NonConj> It;
x0 *= _inv_sigma;
dx *= _inv_sigma;
dxy *= _inv_sigma;
y0 *= _inv_sigma;
dy *= _inv_sigma;
dyx *= _inv_sigma;
It valit = val.linearView().begin();
for (int j=0;j<n;++j,x0+=dxy,y0+=dy) {
double x = x0;
double y = y0;
for (int i=0;i<m;++i,x+=dx,y+=dyx)
*valit++ = _norm * std::exp( -0.5 * (x*x + y*y) );
}
}
示例3: assert
void SBTopHat::SBTopHatImpl::fillXValue(tmv::MatrixView<double> val,
double x0, double dx, double dxy,
double y0, double dy, double dyx) const
{
dbg<<"SBTopHat fillXValue\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<" + j * "<<dxy<<std::endl;
dbg<<"y = "<<y0<<" + i * "<<dyx<<" + j * "<<dy<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
typedef tmv::VIt<double,1,tmv::NonConj> It;
val.setZero();
It valit = val.linearView().begin();
for (int j=0;j<n;++j,x0+=dxy,y0+=dy) {
double x = x0;
double y = y0;
int i=0;
// Use the fact that any slice through the circle has only one segment that is non-zero.
// So start with zeroes until in the circle, then _norm, then more zeroes.
// Note: this could be sped up somewhat using the same kind of calculation we did
// for the non-sheared fillXValue (the one with izero, jzero), but I didn't
// bother. This is probably plenty fast enough for as often as the function is
// called (i.e. almost never!)
for (;i<m && (x*x+y*y > _r0sq); ++i,x+=dx,y+=dyx) ++valit;
for (;i<m && (x*x+y*y < _r0sq); ++i,x+=dx,y+=dyx) *valit++ = _norm;
for (;i<m; ++i,x+=dx,y+=dyx) ++valit;
}
}
示例4: assert
void SBMoffat::SBMoffatImpl::fillKValue(tmv::MatrixView<std::complex<double> > val,
double kx0, double dkx, double dkxy,
double ky0, double dky, double dkyx) const
{
dbg<<"SBMoffat fillKValue\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<" + j * "<<dkxy<<std::endl;
dbg<<"ky = "<<ky0<<" + i * "<<dkyx<<" + j * "<<dky<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
typedef tmv::VIt<std::complex<double>,1,tmv::NonConj> It;
kx0 *= _rD;
dkx *= _rD;
dkxy *= _rD;
ky0 *= _rD;
dky *= _rD;
dkyx *= _rD;
It valit = val.linearView().begin();
for (int j=0;j<n;++j,kx0+=dkxy,ky0+=dky) {
double kx = kx0;
double ky = ky0;
for (int i=0;i<m;++i,kx+=dkx,ky+=dkyx) {
double ksq = kx*kx + ky*ky;
*valit++ = _knorm * (this->*_kV)(ksq);
}
}
}
示例5: assert
void SBShapelet::SBShapeletImpl::fillXValue(
tmv::MatrixView<double> val,
const tmv::Matrix<double>& x, const tmv::Matrix<double>& y) const
{
dbg<<"order = "<<_bvec.getOrder()<<", sigma = "<<_sigma<<std::endl;
xdbg<<"fillXValue with bvec = "<<_bvec<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
tmv::Matrix<double> psi(m*n,_bvec.size());
LVector::basis(x.constLinearView(),y.constLinearView(),psi.view(),
_bvec.getOrder(),_sigma);
val.linearView() = psi * _bvec.rVector();
}
示例6: assert
void SBExponential::SBExponentialImpl::fillKValue(tmv::MatrixView<std::complex<double> > val,
double kx0, double dkx, double dkxy,
double ky0, double dky, double dkyx) const
{
dbg<<"SBExponential fillKValue\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<" + j * "<<dkxy<<std::endl;
dbg<<"ky = "<<ky0<<" + i * "<<dkyx<<" + j * "<<dky<<std::endl;
assert(val.stepi() == 1);
assert(val.canLinearize());
const int m = val.colsize();
const int n = val.rowsize();
typedef tmv::VIt<std::complex<double>,1,tmv::NonConj> It;
kx0 *= _r0;
dkx *= _r0;
dkxy *= _r0;
ky0 *= _r0;
dky *= _r0;
dkyx *= _r0;
It valit = val.linearView().begin();
for (int j=0;j<n;++j,kx0+=dkxy,ky0+=dky) {
double kx = kx0;
double ky = ky0;
for (int i=0;i<m;++i,kx+=dkx,ky+=dkyx) {
double ksq = kx*kx + ky*ky;
if (ksq > _ksq_max) {
*valit++ = 0.;
} else if (ksq < _ksq_min) {
*valit++ = _flux * (1. - 1.5*ksq*(1. - 1.25*ksq));
} else {
double temp = 1. + ksq;
*valit++ = _flux/(temp*sqrt(temp));
}
}
}
}