1 | #ifndef ALM_SEEN
|
---|
2 | #define ALM_SEEN
|
---|
3 |
|
---|
4 | #include "nbrandom.h"
|
---|
5 | #include "nbmath.h"
|
---|
6 | #include "triangmtx.h"
|
---|
7 | #include "tvector.h"
|
---|
8 |
|
---|
9 |
|
---|
10 | /*! class for the coefficients \f$a_{lm}\f$ of the development of a function defined on a sphere, in spherical harmonics */
|
---|
11 | template <class T>
|
---|
12 | class Alm : public TriangularMatrix<complex<T> >
|
---|
13 | {
|
---|
14 | public :
|
---|
15 |
|
---|
16 | Alm() : TriangularMatrix<complex<T> >() {};
|
---|
17 | /* instanciate the class from the maximum value of the index \f$l\f$ in the sequence of the \f$a_{lm}\f$'s */
|
---|
18 | Alm(int nlmax) : TriangularMatrix<complex<T> >(nlmax+1) {;}
|
---|
19 | Alm(const Alm<T>& a, bool share=false) : TriangularMatrix<complex<T> >(a, share) {;}
|
---|
20 |
|
---|
21 | Alm(const TVector<T>& clin, const r_8 fwhm) ;
|
---|
22 | /*! resize with a new lmax */
|
---|
23 | inline void ReSizeToLmax(int_4 nlmax) {ReSizeRow(nlmax+1);}
|
---|
24 | inline int_4 Lmax() const {return rowNumber()-1;}
|
---|
25 | TVector<T> powerSpectrum() const;
|
---|
26 |
|
---|
27 |
|
---|
28 | };
|
---|
29 | /*! class for a vector with an index running from \f$-m_{max}\f$ to \f$+m_{max}\f$ (then the size of the vector will be actually \f$2m_{max}+1)\f$ */
|
---|
30 | template <class T>
|
---|
31 | class Bm
|
---|
32 | {
|
---|
33 | public :
|
---|
34 | Bm(): nmmax_(0) {;};
|
---|
35 | /* instanciate from the maximum absolute value of the index */
|
---|
36 | Bm(int mmax) : nmmax_((uint_4)mmax) { bm_.ReSize( (uint_4)(2*mmax+1) );}
|
---|
37 | Bm(const Bm<T>& b, bool share=false) : nmmax_(b.nmmax_), bm_(b.bm_, share) {;}
|
---|
38 | /*! resize with a new value of mmax */
|
---|
39 | inline void ReSizeToMmax(int_4 mmax)
|
---|
40 | {
|
---|
41 | nmmax_=(uint_4)l;
|
---|
42 | bm_.ReSize(2* nmmax_+1);
|
---|
43 | }
|
---|
44 | //inline int_4 Size() const {return 2*nmmax_+1;};
|
---|
45 | inline T& operator()(int m) {return bm_( adr_i(m));};
|
---|
46 | inline T const& operator()(int m) const {return *(bm_.Begin()+ adr_i(m));};
|
---|
47 | /*! return the current value of the maximum absolute value of the index */
|
---|
48 | inline int_4 Mmax() const
|
---|
49 | {
|
---|
50 | return (int_4)nmmax_;
|
---|
51 | }
|
---|
52 | inline Bm<T>& operator = (const Bm<T>& b)
|
---|
53 | {
|
---|
54 | if (this != &b)
|
---|
55 | {
|
---|
56 | nmmax_= b.nmmax_;
|
---|
57 | bm_= b.bm_;
|
---|
58 | }
|
---|
59 | return *this;
|
---|
60 | }
|
---|
61 |
|
---|
62 | private:
|
---|
63 | /*! return the address in the array representing the vector */
|
---|
64 | inline uint_4 adr_i(int i) const
|
---|
65 | {
|
---|
66 | return(uint_4)(i+nmmax_);
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|
71 | uint_4 nmmax_;
|
---|
72 | NDataBlock<T> bm_;
|
---|
73 |
|
---|
74 | };
|
---|
75 |
|
---|
76 |
|
---|
77 | #endif
|
---|