コード例 #1
0
ファイル: SBKolmogorov.cpp プロジェクト: mjuric/GalSim
    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
0
ファイル: SBGaussian.cpp プロジェクト: AriannaLanz/GalSim
    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
0
ファイル: SBKolmogorov.cpp プロジェクト: mjuric/GalSim
    void SBKolmogorov::SBKolmogorovImpl::fillXValue(tmv::MatrixView<double> val,
                                                    double x0, double dx, double dxy,
                                                    double y0, double dy, double dyx) const
    {
        dbg<<"SBKolmogorov 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 *= _k0;
        dx *= _k0;
        dxy *= _k0;
        y0 *= _k0;
        dy *= _k0;
        dyx *= _k0;

        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) {
                double r = sqrt(x*x + y*y);
                *valit++ = _xnorm * _info->xValue(r);
            }
        }
    }
コード例 #4
0
ファイル: SBBox.cpp プロジェクト: mjuric/GalSim
    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;
        }
    }
コード例 #5
0
ファイル: SBBox.cpp プロジェクト: mjuric/GalSim
    void SBBox::SBBoxImpl::fillXValue(tmv::MatrixView<double> val,
                                      double x0, double dx, double dxy,
                                      double y0, double dy, double dyx) const
    {
        dbg<<"SBBox 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;

        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 box has only one segment that is non-zero.
            // So start with zeroes until in the box, then _norm, then more zeroes.
            for (;i<m && (std::abs(x)>_wo2 || std::abs(y)>_ho2); ++i,x+=dx,y+=dyx) *valit++ = 0.;
            for (;i<m && std::abs(x)<_wo2 && std::abs(y)<_ho2; ++i,x+=dx,y+=dyx) *valit++ = _norm;
            for (;i<m; ++i,x+=dx,y+=dyx) *valit++ = 0.;
        }
    }
コード例 #6
0
ファイル: SBMoffat.cpp プロジェクト: AriannaLanz/GalSim
    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);
            }
        }
    }
コード例 #7
0
ファイル: SBMoffat.cpp プロジェクト: AriannaLanz/GalSim
    void SBMoffat::SBMoffatImpl::fillXValue(tmv::MatrixView<double> val,
                                            double x0, double dx, double dxy,
                                            double y0, double dy, double dyx) const
    {
        dbg<<"SBMoffat 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_rD;
        dx *= _inv_rD;
        dxy *= _inv_rD;
        y0 *= _inv_rD;
        dy *= _inv_rD;
        dyx *= _inv_rD;

        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) {
                double rsq = x*x + y*y;
                if (rsq > _maxRrD_sq) *valit++ = 0.;
                else *valit++ = _norm / _pow_beta(1.+rsq, _beta);
            }
        }
    }
コード例 #8
0
ファイル: SBShapelet.cpp プロジェクト: esheldon/GalSim
 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();
 }
コード例 #9
0
ファイル: SBShapelet.cpp プロジェクト: esheldon/GalSim
 void SBShapelet::SBShapeletImpl::fillKValue(
     tmv::MatrixView<std::complex<double> > val,
     const tmv::Matrix<double>& kx, const tmv::Matrix<double>& ky) const
 {
     dbg<<"order = "<<_bvec.getOrder()<<", sigma = "<<_sigma<<std::endl;
     xdbg<<"fillKValue with bvec = "<<_bvec<<std::endl;
     assert(val.stepi() == 1);
     assert(val.canLinearize());
     const int m = val.colsize();
     const int n = val.rowsize();
     tmv::Matrix<std::complex<double> > psi_k(m*n,_bvec.size());
     LVector::kBasis(kx.constLinearView(),ky.constLinearView(),psi_k.view(),
                     _bvec.getOrder(),_sigma);
     // Note: the explicit cast to Vector<complex<double> > shouldn't be necessary.
     // But not doing so fails for Apple's default BLAS library.  It should be a pretty
     // minimal efficiency difference, so we always do the explicit cast to be safe.
     val.linearView() = psi_k * tmv::Vector<std::complex<double> >(_bvec.rVector());
 }
コード例 #10
0
ファイル: SBExponential.cpp プロジェクト: plazas/GalSim
    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));
                }
            }
        }
    }