-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alm.h
83 lines (65 loc) · 2.04 KB
/
Alm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef ALM_H_
#define ALM_H_
#include <iostream>
#include <fstream>
#include <complex>
#define dcomp std::complex <double>
#include <string>
#define MAXL 10
/* Class containing the alm values for a certain l
* can be accesed with negative values for m.
* Example:
* Al al;
* al.setl(1);
* al[-1] = dcomp( 0.1, 0.2);
* al[ 0] = dcomp( 0.3, 0.0);
* al[ 1] = dcomp(-0.1, 0.2);
* */
class Al
{
public:
Al(); // constructor, not usefull before calling function below
Al(int pMaxl);
virtual ~Al();
void setl(int l); // setting l, initializing aal array
void init();
dcomp &operator[](int m); // [] overloaders, so negative numbers are allowed;
dcomp operator[](int m) const;
int getl(); // returns the value of l
void printall(); // prints all l,m,a
private:
int l; // l>=0
dcomp *aal; // size 2*l+1: -l, -l+1, .., -1, 0, 1, .., l
int status; // 0:uninitialized, 1:initialised, >1:error
};
/* Class containing alm values
* can be accesed with negative values for m.
* Example:
* Alm alm(5);
* // m l a
* al[1][-1] = dcomp( 0.1, 0.2);
* al[1][ 0] = dcomp( 0.3, 0.0);
* al[1][ 1] = dcomp(-0.1, 0.2);
* */
class Alm
{
public:
Alm();
Alm(int pMaxl);
virtual ~Alm();
int getl();
void setl(int pMaxl);// sets pmaxl as mMaxl
void init(); // initializes and clears the alm array aalm
void clear(); // clears the alm
Al& operator[](int l); // should only be used with the [] operator..
Al& operator[](int l) const; // ..from Al
double getPower(int l);
void printPowers();
double realcheck(); // returns the deviation from a real (as in noncomplex) cmb, should be near system precission for doubles or lower.
void printalm(); // prints all the coefficients
private:
int mMaxl; // highest l
Al *aalm; // array of objects containing the alm values for each l
int status; // 0:uninitialized, 1:initialised, >1:error
};
#endif /*ALM_H_*/