Skip to content

Commit 21a54a6

Browse files
committed
Changed interface to R and tau
1 parent 123c863 commit 21a54a6

File tree

8 files changed

+142
-137
lines changed

8 files changed

+142
-137
lines changed

include/flag_core.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// FLAG package
2-
// Copyright (C) 2012
2+
// Copyright (C) 2012
33
// Boris Leistedt & Jason McEwen
44

55
#ifndef FLAG_CORE
66
#define FLAG_CORE
77

8-
#include <complex.h>
8+
#include <complex.h>
99

1010

1111
/*!
@@ -41,7 +41,7 @@ void flag_core_allocate_f(complex double **f, int L, int N);
4141
/*!
4242
* Get size of the full FLAG decomposition.
4343
*
44-
* \param[in] L Angular harmonic band-limit.
44+
* \param[in] L Angular harmonic band-limit.
4545
* \param[in] N Radial harmonic band-limit.
4646
* \retval N*L^2
4747
*/
@@ -50,7 +50,7 @@ int flag_core_flmn_size(int L, int N);
5050
/*!
5151
* Get size of the full dataset for MW sampling.
5252
*
53-
* \param[in] L Angular harmonic band-limit.
53+
* \param[in] L Angular harmonic band-limit.
5454
* \param[in] N Radial harmonic band-limit.
5555
* \retval N*L*(2*L-1)
5656
*/
@@ -61,48 +61,48 @@ int flag_core_f_size_mw(int L, int N);
6161
*
6262
* \param[out] flmn Fourier-Laguerre coefficients.
6363
* \param[in] f Input dataset (MW sampling, complex signal)
64-
* \param[in] L Angular harmonic band-limit.
64+
* \param[in] L Angular harmonic band-limit.
6565
* \param[in] N Radial harmonic band-limit.
6666
* \retval none
6767
*/
68-
void flag_core_analysis(complex double *flmn, const complex double *f, double R, int L, int N);
68+
void flag_core_analysis(complex double *flmn, const complex double *f, int L, double tau, int N, int spin);
6969

7070
/*!
7171
* Perform Fourier-Laguerre synthesis (MW sampling, complex signal).
7272
*
7373
* \param[out] f Input dataset (MW sampling, complex signal)
7474
* \param[in] flmn Fourier-Laguerre coefficients.
75-
* \param[in] L Angular harmonic band-limit.
75+
* \param[in] L Angular harmonic band-limit.
7676
* \param[in] N Radial harmonic band-limit.
7777
* \retval none
7878
*/
79-
void flag_core_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, int N);
79+
void flag_core_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N, int spin);
8080

81-
void flag_core_fourierbessel_analysis(complex double *flmn, const complex double *f, double R, int L, int N);
82-
void flag_core_fourierbessel_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, int N);
81+
void flag_core_fourierbessel_analysis(complex double *flmn, const complex double *f, int L, double tau, int N);
82+
void flag_core_fourierbessel_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N);
8383

8484

8585
/*!
8686
* Perform Fourier-Laguerre analysis (MW sampling, real signal).
8787
*
8888
* \param[out] flmn Fourier-Laguerre coefficients.
8989
* \param[in] f Input dataset (MW sampling, real signal)
90-
* \param[in] L Angular harmonic band-limit.
90+
* \param[in] L Angular harmonic band-limit.
9191
* \param[in] N Radial harmonic band-limit.
9292
* \retval none
9393
*/
94-
void flag_core_analysis_real(complex double *flmn, const double *f, double R, int L, int N);
94+
void flag_core_analysis_real(complex double *flmn, const double *f, int L, double tau, int N);
9595

9696
/*!
9797
* Perform Fourier-Laguerre synthesis (MW sampling, real signal).
9898
*
9999
* \param[out] f Input dataset (MW sampling, real signal)
100100
* \param[in] flmn Fourier-Laguerre coefficients.
101-
* \param[in] L Angular harmonic band-limit.
101+
* \param[in] L Angular harmonic band-limit.
102102
* \param[in] N Radial harmonic band-limit.
103103
* \retval none
104104
*/
105-
void flag_core_synthesis_real(double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, int N);
105+
void flag_core_synthesis_real(double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N);
106106

107107

108108
/*!

include/flag_sampling.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// FLAG package
2-
// Copyright (C) 2012
2+
// Copyright (C) 2012
33
// Boris Leistedt & Jason McEwen
44

55
#ifndef FLAG_SAMPLING
66
#define FLAG_SAMPLING
77

88
/* FOR FUTURE IMPROVEMENTS // multi-scheme support
9-
enum ssht_methods {
10-
MW,
11-
MWSS,
12-
GL,
13-
DH
9+
enum ssht_methods {
10+
MW,
11+
MWSS,
12+
GL,
13+
DH
1414
};
1515
*/
1616

@@ -26,7 +26,7 @@ enum ssht_methods {
2626
* \param[in] N Radial harmonic band-limit.
2727
* \retval none
2828
*/
29-
void flag_sampling_allocate(double **rs, double **thetas, double **phis, double **laguweights, double R, int L, int N);
29+
void flag_sampling_allocate(double **rs, double **thetas, double **phis, double **laguweights, int L, int N);
3030

3131
/*!
3232
* Compute FLAG sampling.
@@ -40,6 +40,6 @@ void flag_sampling_allocate(double **rs, double **thetas, double **phis, double
4040
* \param[in] N Radial harmonic band-limit.
4141
* \retval none
4242
*/
43-
void flag_sampling(double *rs, double *thetas, double *phis, double *laguweights, double R, int L, int N);
43+
void flag_sampling(double *rs, double *thetas, double *phis, double *laguweights, double tau, int L, int N);
4444

4545
#endif

include/flag_spherlaguerre.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ void flag_spherlaguerre_quadrature(double *roots, double *weights, int N, int al
2323
*/
2424
double flag_spherlaguerre_tau(double R, int N);
2525

26+
/*!
27+
* Compute spherical Laguerre maximum R.
28+
*
29+
* \param[in] N Harmonic band-limit.
30+
* \retval R Radial limit / boundary.
31+
*/
32+
double flag_spherlaguerre_Rmax(int N);
33+
2634
/*!
2735
* Compute spherical Laguerre sampling scheme.
2836
*
@@ -32,7 +40,7 @@ double flag_spherlaguerre_tau(double R, int N);
3240
* \param[in] N Harmonic band-limit.
3341
* \retval none
3442
*/
35-
void flag_spherlaguerre_sampling(double *nodes, double *weights, double R, int N);
43+
void flag_spherlaguerre_sampling(double *nodes, double *weights, double tau, int N);
3644

3745
void flag_spherbessel_sampling(double *nodes, double *weights, double R, int N);
3846

@@ -46,7 +54,7 @@ void flag_spherbessel_sampling(double *nodes, double *weights, double R, int N);
4654
* \param[in] N Harmonic band-limit.
4755
* \retval none
4856
*/
49-
void flag_spherlaguerre_analysis(double *fn, const double *f, const double *nodes, const double *weights, int N);
57+
void flag_spherlaguerre_analysis(double *fn, const double *f, const double *nodes, const double *weights, double tau, int N);
5058

5159
/*!
5260
* Perform spherical Laguerre synthesis.
@@ -57,9 +65,9 @@ void flag_spherlaguerre_analysis(double *fn, const double *f, const double *node
5765
* \param[in] N Harmonic band-limit.
5866
* \retval none
5967
*/
60-
void flag_spherlaguerre_synthesis(double *f, const double *fn, const double *nodes, int Nnodes, int N);
68+
void flag_spherlaguerre_synthesis(double *f, const double *fn, const double *nodes, int Nnodes, double tau, int N);
6169

62-
void flag_spherlaguerre_synthesis_gen(double *f, const double *fn, const double *nodes, int Nnodes, int N, int alpha);
70+
void flag_spherlaguerre_synthesis_gen(double *f, const double *fn, const double *nodes, int Nnodes, double tau, int N, int alpha);
6371

6472

6573
/*!
@@ -84,7 +92,7 @@ void flag_spherlaguerre_allocate_sampling(double **nodes, double **weights, int
8492
* \param[in] N Harmonic band-limit.
8593
* \retval none
8694
*/
87-
void flag_spherlaguerre_mapped_analysis(complex double *fn, const complex double *f, const double *weights, const double *nodes, int N, int mapsize);
95+
void flag_spherlaguerre_mapped_analysis(complex double *fn, const complex double *f, const double *weights, const double *nodes, double tau, int N, int mapsize);
8896

8997
/*!
9098
* Perform spherical Laguerre synthesis.
@@ -97,7 +105,7 @@ void flag_spherlaguerre_mapped_analysis(complex double *fn, const complex double
97105
* \param[in] N Harmonic band-limit.
98106
* \retval none
99107
*/
100-
void flag_spherlaguerre_mapped_synthesis(complex double *f, const complex double *fn, const double *nodes, int Nnodes, int N, int mapsize);
108+
void flag_spherlaguerre_mapped_synthesis(complex double *f, const complex double *fn, const double *nodes, int Nnodes, double tau, int N, int mapsize);
101109

102110

103111
/*!

makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ FFTWDIR = ${FFTW}
77
# Directory for GSL
88
GSLDIR = ${GSL}
99
# Directory for MATLAB
10-
MLAB = /Applications/MATLAB_R2011b.app
10+
MLAB = /Applications/MATLAB_R2013a.app
1111
# Directory for DOXYGEN
1212
DOXYGEN_PATH=doxygen
1313

1414
# Compiler and options
1515
CC = gcc
16-
OPT = -Wall -O3 -g -DFLAG_VERSION=\"1.0b1\" -DFLAG_BUILD=\"`svnversion -n .`\"
16+
OPT = -Wall -O3 -g
17+
# OPT = -Wall -O3 -g -DFLAG_VERSION=\"1.0b1\" -DFLAG_BUILD=\"`svnversion -n .`\"
1718
UNAME := $(shell uname)
1819

1920
# ======================================== #
@@ -35,8 +36,8 @@ ifeq ($(UNAME), Darwin)
3536
endif
3637

3738
# === GSL ===
38-
GSLLIB = $(GSLDIR)/lib
39-
GSLINC = $(GSLDIR)/include
39+
GSLLIB = $(GSLDIR)/include
40+
GSLINC = $(GSLDIR)/lib
4041
GSLLIBN= gsl
4142

4243
# === FLAG ===
@@ -119,15 +120,15 @@ $(FLAGTESTOBJ)/%.o: %.c
119120
$(CC) $(OPT) $(FFLAGS) -c $< -o $@
120121

121122
$(FLAGOBJMAT)/%_mex.o: %_mex.c $(FLAGLIB)/lib$(FLAGLIBN).a
122-
$(CC) $(OPT) $(FFLAGS) -c $< -o $@ -I${MLABINC}
123+
$(CC) $(OPT) $(FFLAGS) -c $< -o $@ -I${MLABINC}
123124

124125
$(FLAGOBJMEX)/%_mex.$(MEXEXT): $(FLAGOBJMAT)/%_mex.o $(FLAGLIB)/lib$(FLAGLIBN).a
125126
$(MEX) $< -o $@ $(LDFLAGSMEX) $(MEXFLAGS) -L$(MLABLIB)
126127

127128
# ======================================== #
128129

129130
.PHONY: default
130-
default: lib test about tidy
131+
default: lib test tidy
131132

132133
.PHONY: matlab
133134
matlab: lib $(FLAGOBJSMEX) about
@@ -152,7 +153,7 @@ $(FLAGBIN)/flag_fbtest: $(FLAGTESTOBJ)/flag_fbtest.o $(FLAGLIB)/lib$(FLAGLIBN).a
152153

153154
.PHONY: about
154155
about: $(FLAGBIN)/flag_about
155-
$(FLAGBIN)/flag_about: $(FLAGOBJ)/flag_about.o
156+
$(FLAGBIN)/flag_about: $(FLAGOBJ)/flag_about.o
156157
$(CC) $(OPT) $< -o $(FLAGBIN)/flag_about
157158
$(FLAGBIN)/flag_about
158159

@@ -176,6 +177,6 @@ tidy:
176177
rm -f $(FLAGOBJ)/*.o
177178
rm -f $(FLAGTESTOBJ)/*.o
178179
rm -f $(FLAGOBJMEX)/*.o
179-
rm -f *~
180+
rm -f *~
180181

181-
# ======================================== #
182+
# ======================================== #

src/main/c/flag_core.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ void flag_core_allocate_f_real(double **f, int L, int N)
7070

7171
void flag_core_analysis(complex double *flmn,
7272
const complex double *f,
73-
double R, int L, int N)
73+
int L, double tau, int N, int spin)
7474
{
7575
assert(L > 0);
7676
assert(N > 1);
7777
//const int alpha = ALPHA;
78-
int spin = 0;
7978
int verbosity = 0;
8079
int n;
8180
int flmsize = ssht_flm_size(L);
@@ -97,10 +96,10 @@ void flag_core_analysis(complex double *flmn,
9796
double *weights = (double*)calloc(N, sizeof(double));
9897
assert(nodes != NULL);
9998
assert(weights != NULL);
100-
flag_spherlaguerre_sampling(nodes, weights, R, N);
99+
flag_spherlaguerre_sampling(nodes, weights, tau, N);
101100
//printf("> Mapped spherical Laguerre transform...");
102101
fflush(NULL);
103-
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, N, flmsize);
102+
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, tau, N, flmsize);
104103
//printf("done\n");
105104
free(nodes);
106105
free(weights);
@@ -111,13 +110,12 @@ void flag_core_analysis(complex double *flmn,
111110
void flag_core_synthesis(complex double *f,
112111
const complex double *flmn,
113112
const double *nodes, int Nnodes,
114-
int L, int N)
113+
int L, double tau, int N, int spin)
115114
{
116115
assert(L > 0);
117116
assert(N > 1);
118117
assert(nodes != NULL);
119118
//const int alpha = ALPHA;
120-
int spin = 0;
121119
int verbosity = 0;
122120
int n, offset_lm, offset_r;
123121
int flmsize = ssht_flm_size(L);
@@ -127,7 +125,7 @@ void flag_core_synthesis(complex double *f,
127125
complex double *flmr;
128126
flag_core_allocate_flmn(&flmr, L, Nnodes);
129127
//printf("> Mapped spherical Laguerre transform...");fflush(NULL);
130-
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, N, flmsize);
128+
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, tau, N, flmsize);
131129
//printf("done\n");
132130

133131
for (n = 0; n < Nnodes; n++){
@@ -141,7 +139,7 @@ void flag_core_synthesis(complex double *f,
141139
}
142140

143141
void flag_core_analysis_real(complex double *flmn,
144-
const double *f, double R, int L, int N)
142+
const double *f, int L, double tau, int N)
145143
{
146144
assert(L > 0);
147145
assert(N > 1);
@@ -165,10 +163,10 @@ void flag_core_analysis_real(complex double *flmn,
165163
double *weights = (double*)calloc(N, sizeof(double));
166164
assert(nodes != NULL);
167165
assert(weights != NULL);
168-
flag_spherlaguerre_sampling(nodes, weights, R, N);
166+
flag_spherlaguerre_sampling(nodes, weights, tau, N);
169167
//printf("> Mapped spherical Laguerre transform...");
170168
fflush(NULL);
171-
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, N, flmsize);
169+
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, tau, N, flmsize);
172170
//printf("done\n");
173171
free(nodes);
174172
free(weights);
@@ -178,7 +176,7 @@ void flag_core_analysis_real(complex double *flmn,
178176
void flag_core_synthesis_real(double *f,
179177
const complex double *flmn,
180178
const double *nodes, int Nnodes,
181-
int L, int N)
179+
int L, double tau, int N)
182180
{
183181
assert(L > 0);
184182
assert(N > 1);
@@ -191,7 +189,7 @@ void flag_core_synthesis_real(double *f,
191189
complex double *flmr;
192190
//printf("> Mapped spherical Laguerre transform...");fflush(NULL);
193191
flag_core_allocate_flmn(&flmr, L, Nnodes);
194-
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, N, flmsize);
192+
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, tau, N, flmsize);
195193
//printf("done\n");
196194

197195
for (n = 0; n < Nnodes; n++){
@@ -355,7 +353,7 @@ void flag_spherbessel_basis(double *jell, const int ell, const double *nodes, in
355353

356354
void flag_core_fourierbessel_analysis(complex double *flmn,
357355
const complex double *f,
358-
double R, int L, int N)
356+
int L, double tau, int N)
359357
{
360358
assert(L > 0);
361359
assert(N > 1);
@@ -382,10 +380,10 @@ void flag_core_fourierbessel_analysis(complex double *flmn,
382380
double *weights = (double*)calloc(N, sizeof(double));
383381
assert(nodes != NULL);
384382
assert(weights != NULL);
385-
flag_spherlaguerre_sampling(nodes, weights, R, N);
383+
flag_spherlaguerre_sampling(nodes, weights, tau, N);
386384
//printf("> Mapped spherical Laguerre transform...");
387385
fflush(NULL);
388-
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, N, flmsize);
386+
flag_spherlaguerre_mapped_analysis(flmn, flmr, nodes, weights, tau, N, flmsize);
389387
//printf("done\n");
390388
free(nodes);
391389
free(weights);
@@ -396,7 +394,7 @@ void flag_core_fourierbessel_analysis(complex double *flmn,
396394
void flag_core_fourierbessel_synthesis(complex double *f,
397395
const complex double *flmn,
398396
const double *nodes, int Nnodes,
399-
int L, int N)
397+
int L, double tau, int N)
400398
{
401399
assert(L > 0);
402400
assert(N > 1);
@@ -412,7 +410,7 @@ void flag_core_fourierbessel_synthesis(complex double *f,
412410
complex double *flmr;
413411
flag_core_allocate_flmn(&flmr, L, Nnodes);
414412
//printf("> Mapped spherical Laguerre transform...");fflush(NULL);
415-
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, N, flmsize);
413+
flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, Nnodes, tau, N, flmsize);
416414
//printf("done\n");
417415

418416
for (n = 0; n < Nnodes; n++){

0 commit comments

Comments
 (0)