S2kit  1.1
Toolkit for working with functions defined on the sphere
naive.c File Reference

Source code for naive discrete Legendre transform. More...

#include "s2kit/naive.h"
#include <math.h>
#include <string.h>

Go to the source code of this file.

Functions

void DLTNaive (double *data, const int bw, const int m, double *weights, double *result, double *pml_table, double *workspace)
 The naive forward discrete Legendre transform. More...
 
void InvDLTNaive (double *coeffs, const int bw, const int m, double *result, double *pml_table)
 The inverse discrete Legendre transform. More...
 

Detailed Description

Source code for naive discrete Legendre transform.

Source code to synthesize functions using a naive DLT based on recurrence. This algorithm is stable and does not require any precomputed functions, but the slowest one.

Definition in file naive.c.

Function Documentation

◆ DLTNaive()

void DLTNaive ( double *  data,
const int  bw,
const int  m,
double *  weights,
double *  result,
double *  pml_table,
double *  workspace 
)

The naive forward discrete Legendre transform.

Computes the discrete Legendre transform of a function via summing naively. I.e. this is the forward discrete Legendre transform.

Note
See an example of use in test_DLT_naive.c
Parameters
dataarray of size 2*bw containing the sample points
bwbandwidth
morder
weightsweights for Legendre transform
resultarray of size bw-m which will contain the coefficients
pml_tablearray of size 2*bw*(bw-m) which contains the precomputed Pmls
workspacespace for computations of size 2*bw
Note
weights should be generated by GenerateWeightsForDLT().
pml_table should be generated by GeneratePmlTable() and contains Legendres with norm equal to 1.

Definition at line 34 of file naive.c.

◆ InvDLTNaive()

void InvDLTNaive ( double *  coeffs,
const int  bw,
const int  m,
double *  result,
double *  pml_table 
)

The inverse discrete Legendre transform.

Synthesizes a function from a list of coefficients of a Legendre series. I.e. this is the inverse discrete Legendre transform.

Note
See an example of use in test_DLT_naive.c
Parameters
coeffsarray of size bw-m. The first coefficient is for Pmm
bwbandwidth
morder
resultarray of size 2*bw which will contain the synthesized function
pml_tablearray of size 2*bw*(bw-m) which contains the precomputed Pmls
Note
pml_table should be generated by GeneratePmlTable() and contains Legendres with norm equal to 1.

Definition at line 78 of file naive.c.