CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
ConvolveWithConst.h
Go to the documentation of this file.
1#ifndef CONVOLVEWITHCONST_H_
2#define CONVOLVEWITHCONST_H_
3
4#include <complex>
5#include <vector>
6#include "TVirtualFFT.h"
7#include <string>
8#include <map>// we have no unordered_map.
9/**
10 * @brief basically, convolve with fft.
11 * convolves 1-d.
12 * if size of 2 inputs are fixed, it may yield optimal speed.
13 * currently not thread safe.
14 *
15 */
16//struct convParams;
17//struct fft2;
19public:
22 typedef std::complex<double> Complex;
23private:
24
25 struct convParams;
26 struct fft2;
27 TVirtualFFT * m_fft, * m_ifft;
28 int m_length;
29 int m_BLength;
30 bool m_initialized;
31 //int m_outLength;
32 mutable std::vector<double> A_fft, B_fft, AB_fft,B_tmp;// *out;
33 std::vector<double> zeros;
34 TransformOptimOpt m_optOptim;
35 TransformLengthOpt m_optLength;
36 //static const char options1[4][10];
37 //static const char options2[4][10];
38
39
40
41 static std::map<convParams,fft2> m_map;
42 std::map<convParams,fft2>::iterator m_ref;
43
44public:
45 ConvolveWithConst();// default constructor, uninitialized
46 void init(const double* ConstArray,const int ConstArrayLength, const int Blength, TransformOptimOpt opt=opt_EX,TransformLengthOpt optL=opt_AsShortAsPsb);
47
48 ConvolveWithConst(const double* ConstArray,const int ConstArrayLength, const int Blength, TransformOptimOpt opt=opt_EX,TransformLengthOpt optL=opt_AsShortAsPsb);
49 //ConvolveWithConst(const int convolveLength ,TransformOptimOpt opt=opt_EX,TransformLengthOpt optL=opt_AsShortAsPsb);
50 //ConvolveWithConst():m_fft(nullptr),m_ifft(nullptr){};
52 void convolve(double * output , const double * B,const int leftIndex,const int sizeofOut,double factor=1) const;
53 //static void destoryAll();// clear all ffts. after this all ConvolveWithConst instances become unusable...not sure where i should place this. global var is evil)
54 // so we did a ref count, removing the need of destoryAll.
55 int getLength() const{return m_length;};
56 //TVirtualFFT * getFFT(){return m_fft;}
57 //TVirtualFFT * getIFFT(){return m_ifft;}
58 //void MultiplyAndAdd(Complex* outHalfPlus1, const Complex* inHalfPlus1, double factor) const;
59 void MultiplyAndAdd(Complex* outHalfPlus1, const Complex* inHalfPlus1, double factor=1) const;
60 void FFT(Complex* outHalfPlus1, const double * inNormalLength, int LengthOutAsDouble, int LengthIn) const;
61 void IFFT(double* outNormalLength, const Complex * inHalfPlus1, int lengthOut, int lengthInAsDouble) const;
62
63};
64
65
66
67#endif
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in output
Definition FoamA.h:89
basically, convolve with fft. convolves 1-d. if size of 2 inputs are fixed, it may yield optimal spee...
void MultiplyAndAdd(Complex *outHalfPlus1, const Complex *inHalfPlus1, double factor=1) const
multiply with ffted saved results and add them to output with factor; out += in* SavedConst*factor/L
void FFT(Complex *outHalfPlus1, const double *inNormalLength, int LengthOutAsDouble, int LengthIn) const
Do fft with respect of getLength();.
void init(const double *ConstArray, const int ConstArrayLength, const int Blength, TransformOptimOpt opt=opt_EX, TransformLengthOpt optL=opt_AsShortAsPsb)
void convolve(double *output, const double *B, const int leftIndex, const int sizeofOut, double factor=1) const
do a convolve of stored const A and B, and put results to output.
void IFFT(double *outNormalLength, const Complex *inHalfPlus1, int lengthOut, int lengthInAsDouble) const
Do ifft with respect of getLength();.
std::complex< double > Complex