diff --git a/Grid/algorithms/iterative/PowerSpectrum.h b/Grid/algorithms/iterative/PowerSpectrum.h new file mode 100644 index 00000000..353a5770 --- /dev/null +++ b/Grid/algorithms/iterative/PowerSpectrum.h @@ -0,0 +1,76 @@ +#pragma once +namespace Grid { + +class Band +{ + RealD lo, hi; +public: + Band(RealD _lo,RealD _hi) + { + lo=_lo; + hi=_hi; + } + RealD operator() (RealD x){ + if ( x>lo && x static RealD normalise(T& v) + { + RealD nn = norm2(v); + nn = sqrt(nn); + v = v * (1.0/nn); + return nn; + } + + std::vector ranges; + std::vector order; + + PowerSpectrum( std::vector &bins, std::vector &_order ) : ranges(bins), order(_order) { }; + + template + RealD operator()(LinearOperatorBase &HermOp, const Field &src) + { + GridBase *grid = src.Grid(); + int N=ranges.size(); + RealD hi = ranges[N-1]; + + RealD lo_band = 0.0; + RealD hi_band; + RealD nn=norm2(src); + RealD ss=0.0; + + Field tmp = src; + + for(int b=0;b polynomial; + polynomial.Init(0.0,hi,order[b],Notch); + polynomial.JacksonSmooth(); + + polynomial(HermOp,src,tmp) ; + + RealD p=norm2(tmp); + ss=ss+p; + std::cout << GridLogMessage << " PowerSpectrum Band["<