/
s2let_mw.c
94 lines (86 loc) · 2.56 KB
/
s2let_mw.c
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
84
85
86
87
88
89
90
91
92
93
94
// S2LET package
// Copyright (C) 2012
// Boris Leistedt & Jason McEwen
#include <complex.h>
#include <math.h>
#include <ssht/ssht.h>
#include <stdlib.h>
#include "s2let/s2let.h"
/*!
* Interface to SSHT (required by the Java interface to S2LET)
* Output : MW complex signal
*
* \param[out] f Output MW map.
* \param[in] flm Spherical harmonic coefficients.
* \param[in] L Angular harmonic band-limit.
* \retval none
*/
void s2let_mw_alm2map(complex double *f, const complex double *flm, int L, int spin) {
int verbosity = 0;
ssht_dl_method_t dl_method = SSHT_DL_RISBO;
ssht_core_mw_inverse_sov_sym(f, flm, L, spin, dl_method, verbosity);
}
/*!
* Interface to SSHT (required by the Java interface to S2LET)
* Output : spherical harmonics
*
* \param[out] flm Spherical harmonic coefficients.
* \param[in] f Output MW map.
* \param[in] L Angular harmonic band-limit.
* \retval none
*/
void s2let_mw_map2alm(complex double *flm, const complex double *f, int L, int spin) {
int verbosity = 0;
ssht_dl_method_t dl_method = SSHT_DL_RISBO;
ssht_core_mw_forward_sov_conv_sym(flm, f, L, spin, dl_method, verbosity);
}
/*!
* Interface to SSHT (required by the Java interface to S2LET)
* Output : MW real signal
*
* \param[out] f Output MW map.
* \param[in] flm Spherical harmonic coefficients.
* \param[in] L Angular harmonic band-limit.
* \retval none
*/
void s2let_mw_alm2map_real(double *f, const complex double *flm, int L) {
int verbosity = 0;
ssht_dl_method_t dl_method = SSHT_DL_RISBO;
ssht_core_mw_inverse_sov_sym_real(f, flm, L, dl_method, verbosity);
}
/*!
* Interface to SSHT (required by the Java interface to S2LET)
* Output : spherical harmonics (corresponding to real signal)
*
* \param[out] flm Spherical harmonic coefficients.
* \param[in] f Output MW map.
* \param[in] L Angular harmonic band-limit.
* \retval none
*/
void s2let_mw_map2alm_real(complex double *flm, const double *f, int L) {
int verbosity = 0;
ssht_dl_method_t dl_method = SSHT_DL_RISBO;
ssht_core_mw_forward_sov_conv_sym_real(flm, f, L, dl_method, verbosity);
}
/*!
* Computes power of a complex MW signal
*/
double s2let_mw_power(complex double *f, int L) {
complex double *flm;
s2let_allocate_lm(&flm, L);
s2let_mw_map2alm(flm, f, L, 0);
double res = s2let_lm_power(flm, L);
free(flm);
return res;
}
/*!
* Computes power of a real MW signal
*/
double s2let_mw_power_real(double *f, int L) {
complex double *flm;
s2let_allocate_lm(&flm, L);
s2let_mw_map2alm_real(flm, f, L);
double res = s2let_lm_power(flm, L);
free(flm);
return res;
}