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

Contains functions to do pointwise operations. More...

#include "libftsh.h"

Defines

#define ENTEREXIT   0

Functions

void pointwise_multiply (REAL *out, REAL *in_1, REAL *in_2, int numpts)
void reflect_evenodd (REAL *even, REAL *odd, REAL *whole, int numpts, int dir)
void remove_rootsin (REAL *out, REAL *in, REAL *node, int numpts)

Detailed Description

Contains functions to do pointwise operations.

Summary:


Function Documentation

void pointwise_multiply ( REAL out,
REAL in_1,
REAL in_2,
int  numpts 
)

Pointwise multiply two vectors to form the third.

INPUTS:

  • out -- a vector of length numpts in which to put the output. May be the same as in_1 or in_2
  • in_1 -- the first input vector, of length numpts
  • in_2 -- the second input vector, of length numpts
  • numpts -- the length of the vectors

OUTPUTS: out -- is written onto; out[i]=in_1[i]*in_2[i];

Here is the caller graph for this function:

void reflect_evenodd ( REAL even,
REAL odd,
REAL whole,
int  numpts,
int  dir 
)

Form the even and odd parts of the input vector.

It can also reverse the process.

INPUTS:

  • even -- In forward mode, the even portion will be put here. In reverse mode, the even portion is read from here. Of length (numpts+1)/2.
  • odd -- In forward mode, the odd portion will be put here. In reverse mode, the odd portion is read from here. Of length numpts/2.
  • whole -- in forward mode, the fcn to read from. In reverse mode, where to put the function. Of length numpts.
  • numpts -- the length of whole and twice the length of even and odd. If numpts is odd, the extra point goes to even.
  • dir -- the direction to go in
    • dir==1 fold whole into even/odd
    • dir==-1 unfold even/odd into whole
    • else error

OUTPUTS:

  • In forward mode even and out are written onto, with the even/odd reflections of whole:

    • even[i]=whole[i]+whole[numpts-1-i]
    • odd[i]=whole[i]-whole[numpts-1-i]

    If the number of points is odd, the center point is copied into even, and omitted from odd.

  • in reverse mode undoes this process

NOTES:

  • the exception handling for odd numpts might slow this down

Here is the caller graph for this function:

void remove_rootsin ( REAL out,
REAL in,
REAL node,
int  numpts 
)

Divide the vector in by sqrt(sin( node values)).

INPUTS:

  • out -- a pointer to where to put the outputs. May be the same as in.
  • in -- the input zector, of length numpts
  • node -- and array holding the sampling nodes, corresponding to numpts physical points. Should be in (0,PI)
  • numpts -- the number of sample points. (plus 1 if odd)

OUTPUTS : out -- is written onto out[i]=in[i]/sqrt(sin(node[i]))

NOTES:

  • For safety we do sqrt(fabs(sin(node[i]))) This is so if the node value is out of range the routine doesn't crash
  • We could still crash by dividing be zero

Here is the caller graph for this function: