libftsh
A Fast Transform for Spherical Harmonics
 All Data Structures Files Functions Variables Defines
Defines | Functions
Pmn_construct.c File Reference

Compute point values of P^m_n Associated Legendre Functions. More...

#include "libftsh.h"

Defines

#define ENTEREXIT   0
#define LNOF2   0.693147180559945309417232121458

Functions

REAL Pmncos (int order, int index, REAL phi)
void Pmncos_resave_init (Pmncos_Recurrence_Save *pmn_save, REAL *node, int numpts)
void Pmncos_resave_destroy (Pmncos_Recurrence_Save *pmn_save)
void next_rtsinPmncos (REAL *out, Pmncos_Recurrence_Save *pmn_save, int halfpts, int order, int index)

Detailed Description

Compute point values of P^m_n Associated Legendre Functions.

Summary:


Function Documentation

void next_rtsinPmncos ( REAL out,
Pmncos_Recurrence_Save pmn_save,
int  halfpts,
int  order,
int  index 
)

Do one step in the recurrence process then output the results.

This saves on memory if we are trying to compress all associated Legendre fcns of some order. This version is super stabilized for all conditions.

INPUTS:

  • out-- the results will be put in this array of length halfpts, in format out[i]=C^m_n P^m_n(pmn_save->ex[i])*sqrt(pmn_save->why[i]). Generally pmn_save->ex[i] is cos(quadrature_point[i]) pmn_save->ex[i] is sin(quadrature_point[i])
  • pmn_save -- a structure that holds some precomputed trig values and the results of previous recurrences. Must be initialized with Pmncos_resave_init.
  • halfpts-- the number of points to use. Generally this is the number of points in [0,PI/2] and we use parity for [PI/2,PI]. This routine does not care, however, because the location of the points is encoded in pmn_save.
  • order -- the order of the associated legendre function desired. In P^m_n notation this is m
  • index--- the index desired minus m. In P^m_{m+k} notation this is k.

OUTPUTS : results are output in outfcn, above

USAGE: You must call this function for successive values of index, starting at 0. Order must remain fixed.

NOTES:

  • We pass type REAL to several functions which expect double. This should not cause trouble but still might.
  • Is this the correct norm fix ??

Here is the caller graph for this function:

REAL Pmncos ( int  order,
int  index,
REAL  phi 
)

Evaluate an associated Legendre function P^m_n at any point.

This routine is super stabilized for all conditions.

INPUTS:

  • order -- the order of the associated legendre function you want. In P^m_n notation this is m. order>=0
  • index -- Which frequency to use, starting from the lowest legal. In P^m_n notation, n is m+index. index >=0
  • phi -- The point at which to evaluate. 0< phi < PI

OUTPUTS: returns \(cP^m_n(\cos(\phi))\) with c to make L^2 normalized.

                                m
                               P (cos(phi)) * const
                                n

The constant is set so we are L^2 normalized. Since the number of points to be used is not known, we cannot adjust for the discretization.

NOTES:

  • We pass type REAL to several functions which expect double. This should not cause trouble but still might.
  • Just like dbrtsinPmncos except for sqrt(sin) factor.

destroy (free) a structure Pmncos_Recurrence_Save

INPUTS: pmn_save -- the structure to free

OUTPUTS : The memory held by pmn_save is freed

Here is the caller graph for this function:

void Pmncos_resave_init ( Pmncos_Recurrence_Save pmn_save,
REAL node,
int  numpts 
)

Converts a set of nodes (often gaussian) to the initialization needed for the associated legendre function recurrence.

INPUTS:

  • pmn_save -- a structure to hold the outputs
  • node -- and array holding the sampling nodes. The array is of length (numpts+1)/2 and the values should be in [0,PI/2]. We assume the sampling on (PI/2,PI] is symmetric
  • numpts -- the number of sample points. We use half of these (plus 1 if odd)

OUTPUTS : This function creates memory for the arrays in pmn_save and initializes some values.

Here is the caller graph for this function: