Defines | Functions

src/coramf/MapDepthMatrix.c File Reference

Defines

#define fftwf_malloc   fftw_malloc
#define fftwf_free   fftw_free

Functions

MAP_DEPTH_MATRIX newMapDepthMatrix (int x, int y, int z, int t, bool shift)
MAP_DEPTH_MATRIX newMapDepthMatrixV (int x, int y, int z, int t, int v, bool shift)
void destroyMapDepthMatrix (MAP_DEPTH_MATRIX td)
bool isEmptyMapDepthMatrix (const MAP_DEPTH_MATRIX *td)
MATRIX extractMapDepth (int kx, int ky, MAP_DEPTH_MATRIX td)
void insertMapDepth (int kx, int ky, MATRIX m, MAP_DEPTH_MATRIX *tdptr)
MATRIX extractXYPlaneFromMapDepthMatrix (int map, int depth, MAP_DEPTH_MATRIX td)
MATRIX extractXYPlaneFromMapDepthMatrixV (int map, int depth, int v, MAP_DEPTH_MATRIX td)
MATRIX extractXYPlaneFromDoubleArray (int map, int depth, int v, int nX, int nY, int nZ, int nT, int nV, Float *td)
void insertXYPlaneIntoMapDepthMatrix (MATRIX xyPlane, int map, int depth, MAP_DEPTH_MATRIX *tdptr)
void insertXYPlaneIntoMapDepthMatrixV (MATRIX xyPlane, int map, int depth, int v, MAP_DEPTH_MATRIX *tdptr)
void insertXYPlaneIntoDoubleArray (MATRIX xyPlane, int map, int depth, int v, int nX, int nY, int nZ, int nT, int nV, Float *tdptr)
MATRIX extractXYPlaneColMajorMapDepthMatrix (int map, int depth, const MAP_DEPTH_MATRIX *td)
MATRIX extractXYPlaneColMajorMapDepthMatrixV (int map, int depth, int v, const MAP_DEPTH_MATRIX *tdptr)
void insertXYPlaneColMajorMapDepthMatrix (MATRIX xyPlane, int map, int depth, MAP_DEPTH_MATRIX *tdptr)
void insertXYPlaneColMajorMapDepthMatrixV (MATRIX xyPlane, int map, int depth, int v, MAP_DEPTH_MATRIX *tdptr)
MAP_DEPTH_MATRIX readMapDepthMatrixKernel (char *basedir, char *filenames[], int nFiles, bool useFT)
MAP_DEPTH_MATRIX readMapDepthMatrix (char *basedir, char *filenames[], int nFiles, bool useFT)
MAP_DEPTH_MATRIX readMapDepthMatrixV (char *basedir, char *filenames[], int nFiles, int vdim, bool useFT)
void writeMapDepthMatrix (char *filenames[], int nFiles, MAP_DEPTH_MATRIX tdm, bool useFT, FITSParameters headerParameters)
void writeDepthMapMatrix (char *filenames[], int nFiles, MAP_DEPTH_MATRIX tdm, bool useFT, FITSParameters headerParameters)
void writeMapDepthMatrixToOneFile (char *filename, MAP_DEPTH_MATRIX tdm, bool useFT, FITSParameters headerParameters)
MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFileS (char *filename, bool useFT, bool shiftOnInput, bool shiftOnOutput)
MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFile (char *filename, bool useFT)
MAP_DEPTH_MATRIX readMapDepthMatrixForTarget (char *filename, bool useFT)
MAP_DEPTH_MATRIX inverseMapDepth (MAP_DEPTH_MATRIX tdm)
MAP_DEPTH_MATRIX convertMapDepth (const MAP_DEPTH_MATRIX *tdm, MatrixOrder order)
MAP_DEPTH_MATRIX convertMapDepthSpace (const MAP_DEPTH_MATRIX *tdm, enum DataSpace toSpace)
void TdmMultiplyScalarTakeConjugate (MAP_DEPTH_MATRIX *tdmPtr, Float scalar)
void TdmMultiplyScalar (MAP_DEPTH_MATRIX *tdmPtr, Float scalar)
void MdmMultiplyMatrix (MAP_DEPTH_MATRIX *tdmPtr, MATRIX theta)
void ZeroK0 (MAP_DEPTH_MATRIX *tdmPtr)
MAP_DEPTH_MATRIX TdmCopy (MAP_DEPTH_MATRIX tdm)
void unpack (MATRIX *x, const MASK *mask, MAP_DEPTH_MATRIX *w)
void pack (const MAP_DEPTH_MATRIX *w_n, MATRIX *x, const MASK *mask)
MATRIX TdmFlatten (MAP_DEPTH_MATRIX tdm)
void TdmRebuild (MATRIX m, MAP_DEPTH_MATRIX *tdmPtr)
MAP_DEPTH_MATRIX XYTransposeMapDepthMatrix (const MAP_DEPTH_MATRIX *K)

Define Documentation

#define fftwf_free   fftw_free
#define fftwf_malloc   fftw_malloc

Function Documentation

MAP_DEPTH_MATRIX convertMapDepth ( const MAP_DEPTH_MATRIX tdm,
MatrixOrder  order 
)

Convert the ordering of data in mdm(kx,ky,:,:) and store it in a new matrix.

Parameters:
[in] tdm Map-depth matrix
[in] order Enumeration: either ROW_MAJOR or COL_MAJOR
Returns:
MAP_DEPTH_MATRIX containing the new ordering of each map-depth submatrix.
MAP_DEPTH_MATRIX convertMapDepthSpace ( const MAP_DEPTH_MATRIX tdm,
enum DataSpace  toSpace 
)

Convert between real space and wave space and store result in a new matrix.

Parameters:
[in] tdm Map-depth matrix
[in] toSpace Enumeration: either REAL_SPACE or WAVE_SPACE
Returns:
MAP_DEPTH_MATRIX containing the new ordering of each map-depth submatrix.
MAP_DEPTH_MATRIX inverseMapDepth ( MAP_DEPTH_MATRIX  tdm  ) 

Calculate the inverse of each tdm(kx,ky,:,:) and store it in a new matrix.

Parameters:
[in] tdm Map-depth matrix
Returns:
MAP_DEPTH_MATRIX containing the invervse of each map-depth submatrix. If an error occurs during inversion, the returned matrix has data = NULL.
void MdmMultiplyMatrix ( MAP_DEPTH_MATRIX tdmPtr,
MATRIX  theta 
)

Multiply a 4D matrix by a 2D matrix .

Parameters:
[in,out] tdmPtr Pointer to a MAP_DEPTH_MATRIX. The original matrix is changed.
[in] theta Matrix to multiply.
void pack ( const MAP_DEPTH_MATRIX w_n,
MATRIX x,
const MASK mask 
)

condense weight vector, w, by removing zero values specified in mask. send already allocated dvec, x matrix w_n, is inserted into dvec *x.

Parameters:
[in] w_n weights only depend on r_i = (x,y) and M = # of maps
[in,out] x weights packed into a column vector with this ordering: w_a(r_1), w_a(r_2) ... w_b(r_1), w_b(r_2) where r_1=(x,y)=(0,0) and r_2=(0,1), i.e. row-major order
[in] mask 
MAP_DEPTH_MATRIX readMapDepthMatrixForTarget ( char *  filename,
bool  useFT 
)

Opens and reads 4D FITS file, then stores the data in a new MAP_DEPTH_MATRIX. Note: the data are not shifted on input (when read) and not shifted when written to a file (on output).

Parameters:
[in] filename of FITS file to read; must be complete file path.
[in] useFT Boolean; whether to Fourier transform the data before inserting into MAP_DEPTH_MATRIX.
Returns:
new map depth matrix containing data from files.
MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFile ( char *  filename,
bool  useFT 
)

Opens and reads 4D FITS file, then stores the data in a new MAP_DEPTH_MATRIX. Note: the data are shifted on input (when read) and NOT shifted when written to a file (on output).

Parameters:
[in] filename of FITS file to read; must be complete file path.
[in] useFT Boolean; whether to Fourier transform the data before inserting into MAP_DEPTH_MATRIX.
Returns:
new map depth matrix containing data from files.
MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFileS ( char *  filename,
bool  useFT,
bool  shiftOnInput,
bool  shiftOnOutput 
)

Opens and reads 4D FITS file, then stores the data in a new MAP_DEPTH_MATRIX.

Parameters:
[in] filename of FITS file to read; must be complete file path.
[in] useFT Boolean; whether to Fourier transform the data before inserting into MAP_DEPTH_MATRIX.
[in] shiftOnInput True mean shift the data before fft transform.
[in] shiftOnOutput True means shift the data after inverse fft transform.
Returns:
new map depth matrix containing data from files.
MAP_DEPTH_MATRIX TdmCopy ( MAP_DEPTH_MATRIX  tdm  ) 

Make a copy of a map-depth matrix. WARNING: only use when memory is guaranteed to be contiguous for the data.

Parameters:
[in] tdm matrix to copy.
Returns:
copy of matrix
MATRIX TdmFlatten ( MAP_DEPTH_MATRIX  tdm  ) 

Flatten a map-depth matrix. | xy_0,0 xy_0,1 ... xy_0,mi | | xy_1,0 xy_1,1 ... xy_1,mi | | ... | | xy_mj,0 xy_mj,1 ... xy_mj,mi |

Used to flatten lambda, e.g. | L_aa L_ab | | L_ba L_bb |

Parameters:
[in] tdm matrix to flatten.
Returns:
2D matrix
void TdmMultiplyScalar ( MAP_DEPTH_MATRIX tdmPtr,
Float  scalar 
)

Multiply a 4d matrix by a scalar .

Parameters:
[in,out] tdmPtr Pointer to a MAP_DEPTH_MATRIX. The original matrix is changed.
[in] scalar value to multiply.
void TdmMultiplyScalarTakeConjugate ( MAP_DEPTH_MATRIX tdmPtr,
Float  scalar 
)

Multiply a 4d matrix by a scalar and take the complex conjugate of each element. I combined the scalar multiplication and conjugate together in one operation because it is faster to go through the 4d matrix once, rather than twice.

Parameters:
[in,out] tdmPtr Pointer to a MAP_DEPTH_MATRIX. The original matrix is changed.
[in] scalar value to multiply.
void TdmRebuild ( MATRIX  m,
MAP_DEPTH_MATRIX tdmPtr 
)
void unpack ( MATRIX x,
const MASK mask,
MAP_DEPTH_MATRIX w 
)

reconstitute weight vector, w, by adding zeros at locations specified in mask. w must be in real space, NOT wave space. Mask is always in real space.

Parameters:
[in] x Packed MATRIX containing weights.
[in] mask MASK matrix containing masks for all maps.
[in,out] w Weights fully expanded with zeros inserted for undefined map points which are indicated by false in the corresponding mask.
void writeDepthMapMatrix ( char *  filenames[],
int  nFiles,
MAP_DEPTH_MATRIX  tdm,
bool  useFT,
FITSParameters  headerParameters 
)
void writeMapDepthMatrixToOneFile ( char *  filename,
MAP_DEPTH_MATRIX  tdm,
bool  useFT,
FITSParameters  headerParameters 
)

Opens and writes MAP_DEPTH_MATRIX to a single FITS file.

Parameters:
[in] filename name of FITS file to write; NOTE: filename must already have directory path, i.e. the filename is a complete path.
[in] tdm map depth matrix containing data for output.
[in] useFT Boolean; whether to Fourier transform the data before inserting into MAP_DEPTH_MATRIX.
[in] headerParameters Names, values and comments of the lambda parameters for FITS header.
MAP_DEPTH_MATRIX XYTransposeMapDepthMatrix ( const MAP_DEPTH_MATRIX K  ) 
void ZeroK0 ( MAP_DEPTH_MATRIX tdmPtr  ) 

zero inversion weights, w, for wave number, kx=0, ky=0.

Parameters:
[in,out] tdmPtr Pointer to a MAP_DEPTH_MATRIX containing inversion weights.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines