source: Sophya/trunk/SophyaLib/Samba/alm.h@ 758

Last change on this file since 758 was 758, checked in by ansari, 26 years ago

Restructuration de Sophya en petits modules (creation de SkyMap en particulier)

Reza 2/3/2000

File size: 2.1 KB
Line 
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 */
11template <class T>
12class Alm : public TriangularMatrix<complex<T> >
13 {
14 public :
15
16Alm() : 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 */
18Alm(int nlmax) : TriangularMatrix<complex<T> >(nlmax+1) {;}
19Alm(const Alm<T>& a, bool share=false) : TriangularMatrix<complex<T> >(a, share) {;}
20
21Alm(const TVector<T>& clin, const r_8 fwhm) ;
22/*! resize with a new lmax */
23inline void ReSizeToLmax(int_4 nlmax) {ReSizeRow(nlmax+1);}
24inline int_4 Lmax() const {return rowNumber()-1;}
25TVector<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$ */
30template <class T>
31class Bm
32 {
33 public :
34Bm(): nmmax_(0) {;};
35 /* instanciate from the maximum absolute value of the index */
36Bm(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 */
39inline 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;};
45inline T& operator()(int m) {return bm_( adr_i(m));};
46inline 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 */
48inline int_4 Mmax() const
49 {
50 return (int_4)nmmax_;
51 }
52inline 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 */
64inline 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
Note: See TracBrowser for help on using the repository browser.