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

Local trig version (wrapper) for dyadic_gsearch.c. More...

#include "libftsh.h"

Defines

#define ENTEREXIT   0

Functions

void dyadic_g_ilist_init (Local_Trig_Interval *ilist[2], int *ints_used, int *coefs_used, REAL **bell_handle, int *bell_length, int **bell_offsets, int halfpts, int num_levels, REAL(*bell_choice)(int, int), int flags)
void ltrigint_init (Local_Trig_Interval *out, int numpts, int left_extra, int right_extra, int fcn_offset, int coef_offset, REAL(*bell_choice)(int, int), int which_transform, int fftw_flags)
void gsearch_to_ilist (Local_Trig_Interval *ilist_out, int *intervals_kept, int max_intervals, Local_Trig_Interval *ilist_in, Dyadic_Gsearch_Save *dy_gs_save, int halfpts)

Detailed Description

Local trig version (wrapper) for dyadic_gsearch.c.

Summary:


Function Documentation

void dyadic_g_ilist_init ( Local_Trig_Interval ilist[2],
int *  ints_used,
int *  coefs_used,
REAL **  bell_handle,
int *  bell_length,
int **  bell_offsets,
int  halfpts,
int  num_levels,
REAL(*)(int, int)  bell_choice,
int  flags 
)

This routine constructs the interval list for a dyadic partition suitable for the growing interval size search (gsearch).

INPUTS:

  • ilist -- an array of 2 pointers to Local_Trig_Interval, to be filled in.
  • halfpts -- the number of points on which to construct these intervals. For the growing search, this usually represents half of the number of points in the full interval.
  • num_levels -- the number of dyadic levels to use. We need halfpts >= (1<<num_levels) and halfpts % (1<<num_levels) == 0
  • bell_choice-- the bell function to use
  • flags -- integer flags passed to the fftw initializer

OUTPUTs:

  • ilist[0/1] -- has memory allocated and is filled in
    • ilist[0] -- gets intervals with trig functions for even parity at the right edge
    • ilist[1] -- gets intervals with trig functions for odd parity at the right edge
  • ints_used -- is filled in with the length of the ilist's
  • coefs_used -- is filled in with the total number of possible coefficients this ilist can produced. This is used to allocate memory and set offsets within whatever array will eventually hold these coefficients
  • bell_handle -- is pointed to an array which contains all the bell values. This is used when we want to save the bells to disc efficiently.
  • bell_length -- is set to the length of bell_handle.
  • bell_offsets -- is pointed to an array containing integer offsets withing bell_handle, indicating the location of particular bells.

NOTES:

  • coefs_used includes offsets for the left edge asymmetric bells, which are not used.
  • We now use the bell memory efficiently, with no repeated computations. For the trig transforms, we do not repeat the trig value or fftw computations. There is an inefficiency in that we have multiple versions of the workspace. This adds trivial memory, but may have cache implications
  • There was a mysterious segmentation fault possibly related to free(plan_holder) so that is now disabled. This may cause a memory leak.

set which_transform

Here is the call graph for this function:

Here is the caller graph for this function:

void gsearch_to_ilist ( Local_Trig_Interval ilist_out,
int *  intervals_kept,
int  max_intervals,
Local_Trig_Interval ilist_in,
Dyadic_Gsearch_Save dy_gs_save,
int  halfpts 
)

This function converts the choices made by the dyadic_gsearch to a list of intervals.

INPUTS:

  • max_intervals -- the largest number of interval ilist_out can hold
  • ilist_in -- all possible intervals, in Local_Trig_Interval format
  • dy_gs_save -- a pointer to gsearch structure From its best_level and branching fields we extract the partition.
  • halfpts -- the numpts of data points this search covered In the usual case where the grow search is for half the true function interval, this is half the number of points.

OUTPUT:

  • ilist_out -- written onto with the list of interval. Note that we copy the structure Local_Trig_Interval, which includes pointers to other things. We do not copy the arrays they point to
  • intervals_kept -- the number of intervals kept is written here

NOTES:

  • It is possible to run over ilist_in
  • In 2007 fixed bug i=i++ --> i++

Here is the caller graph for this function:

void ltrigint_init ( Local_Trig_Interval out,
int  numpts,
int  left_extra,
int  right_extra,
int  fcn_offset,
int  coef_offset,
REAL(*)(int, int)  bell_choice,
int  which_transform,
int  fftw_flags 
)

This routine initializes a Local_Trig_Interval.

INPUTS:

  • numpts
  • left_extra
  • right_extra
  • fcn_offset
  • coef_offset
  • which_transform -- are copied into the structure
  • bell_choice -- a pointer to the bell function to use
  • fftw_flags -- flags passed to the fftw initializer

OUTPUTS: out -- is written onto with the above info.

  • Memory is obtained for .bell and .dualbell and they are initialized.
  • .transform_plan is initialized for the transform indicated by which_transform.

NOTES:

  • document better

Here is the call graph for this function:

Here is the caller graph for this function: