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

Bell handling utilities for local trigonomatric transforms. More...

#include "libftsh.h"

Defines

#define ENTEREXIT   0

Functions

REAL dualabell (REAL(*origbell)(int, int), int laplength, int t)
void bell_1size_init (REAL *bellout, REAL(*whichbell)(int, int), int lapleft, int center, int lapright, int dual_flag)
void fold_e_e_1s (REAL *coef, REAL *fcn, int numpts, REAL *left, int n_left, REAL *right, int n_right, REAL *bell, int dir)
void fold_e_o_1s (REAL *coef, REAL *fcn, int numpts, REAL *left, int n_left, REAL *right, int n_right, REAL *bell, int dir)

Detailed Description

Bell handling utilities for local trigonomatric transforms.

Summary:


Function Documentation

void bell_1size_init ( REAL bellout,
REAL(*)(int, int)  whichbell,
int  lapleft,
int  center,
int  lapright,
int  dual_flag 
)

Computes bell values for a given size and overlap configuration.

INPUTS:

  • whichbell -- a pointer to a bell function. The bells have the form bell(laplength,t) with
    • laplength -- the number of POINTS the bell spills out of the interval. It also spills in an equal number of points. Thus the bell takes 2*laplength points to rise from 0 to 1.
    • t -- Which point you want to evaluate the bell at. This should range from 0 to 2*laplength-1. bell(laplength,0)=~0 then it rises until bell(laplength,2*laplength-1)=~1 The edge of the interval is between points, at t=(laplength-1) +0.5 The bell function returns a REAL which is the bell's value at that point.
  • lapleft -- the laplength to use at the left edge
  • center -- the main interval length. must be at least lapleft+lapright. If it is longer than this, the bell is given value 1 on the extra portion
  • lapright-- the laplength to use at the right edge
  • dual_flag -- a flag for if we should make the dual of the input bell. Use for inverting bi-orthogonal bells
    • 0 (or !=1) -- normal, don't dual
    • 1 -- make the dual

OUTPUT: bellout --is written onto. The first lapleft+center+lapright entries are used.

Generally, the bell will look like

                               ---------------------\               
                         _____/                      -\______       
           _________/----                                    - ___  
    ___/---                                                        \-
/--                                                                 \
|---------------|--------------|--------------------|--------|--------|
   lapleft      | lapleft                            lapright|lapright
                |- - - - - - - - - center - - - - - - - - - -|      

NOTES:

  • It is legal to have lapleft and or lapright equal to zero
  • We could call memory internally, but we allow the user to try to localize memory.

Here is the call graph for this function:

Here is the caller graph for this function:

REAL dualabell ( REAL(*)(int, int)  origbell,
int  laplength,
int  t 
)

Return the value of the dual to the given bell.

INPUTS:

  • origbell - pointer to the original bell, e.g. bellmat5.
  • laplength-- the number of POINTS the bell spills out of the interval. It also spills in an equal number of points. Thus the bell takes 2*laplength points to rise from 0 to 1.
  • t -- Which point you want to evaluate the bell at. This should range from 0 to 2*laplength-1. bell(laplength,0)=~0 then it rises until bell(laplength,2*laplength-1)=~1. The edge of the interval is between points, at t=(laplength-1) +0.5

OUTPUT: return the REAL value at that point.

Here is the caller graph for this function:

void fold_e_e_1s ( REAL coef,
REAL fcn,
int  numpts,
REAL left,
int  n_left,
REAL right,
int  n_right,
REAL bell,
int  dir 
)

Computes the folded version of a function, which is then usually DCTed also can unfold

INPUTS:

  • coef -- a pointer to the left edge of the array for the folded function "coefficients"
  • fcn -- a pointer to the left end of the main interval
  • numpts -- the length of the main interval
  • left -- a pointer to the right edge of the interval that sits to the left of the main interval left will be called with negative indices
  • n_left-- the length of left to use. The bell spills this much into left, and the same amount into fcn.
  • right -- a pointer to the left edge of the interval that sits to the right of the main interval
  • n_right-- the length of right to use. The bell spills this much into right, and the same amount into fcn.
  • bell --- an array containing the bell values
  • dir -- which operation to do:
    • 1 : fold
    • -1 : unfold

OUTPUT:

  • if dir==1: coef -- the folded version of the function. length numpts is written on
  • if dir==-1: fcn,left,right -- the unfolded version of the function is ADDED to these arrays
  • else : no action

NOTES:

  • If all the data is contiguous, we will have right=fcn+numpts and left=fcn-1;
  • We could incorporate a skip if the data is transposed.

Here is the caller graph for this function:

void fold_e_o_1s ( REAL coef,
REAL fcn,
int  numpts,
REAL left,
int  n_left,
REAL right,
int  n_right,
REAL bell,
int  dir 
)

Computes the folded version of a function, which is then usually LCTed also can unfold.

INPUTS:

  • coef -- a pointer to the left edge of the array for the folded function "coefficients"
  • fcn -- a pointer to the left end of the main interval
  • numpts -- the length of the main interval
  • left -- a pointer to the right edge of the interval that sits to the left of the main interval. left will be called with negative indices.
  • n_left-- the length of left to use. The bell spills this much into left, and the same amount into fcn.
  • right -- a pointer to the left edge of the interval that sits to the right of the main interval
  • n_right-- the length of right to use. The bell spills this much into right, and the same amount into fcn.
  • bell --- an array containing the bell values
  • dir -- which operation to do:
    • 1 : fold
    • -1 : unfold

OUTPUT:

  • if dir==1: coef -- the folded version of the function. length numpts is written on
  • if dir==-1: fcn,left,right -- the unfolded version of the function is ADDED to these arrays
  • else : no action

NOTES:

  • If all the data is contiguous, we will have right=fcn+numpts and left=fcn-1;
  • We could incorporate a skip if the data is transposed

Here is the caller graph for this function: