#include "matrixArrayCalcs.h"Functions | |
| int | minVal (const int *values, const int numValues) |
| int | maxVal (const int *values, const int numValues) |
| Matrix | conv2 (const Matrix &A, const Matrix &H) |
| void | interp2 (double *xpts, double *ypts, const Matrix Z, double *xi, double *yi, double *zi, int numPts) |
| void | interp2mat (double *xpts, double *ypts, const Matrix Z, double *xi, double *yi, Matrix &zi) |
| void | nearestInterp (double *xpts, double *ypts, const Matrix &zvals, double xi, double yi, double &zi, int *xIndices, int *yIndices, ColumnVector &Weights) |
| bool | findNearestValid (const Matrix &zvals, int &xIndex, int &yIndex) |
| void | bilinearInterp (double *xpts, double *ypts, const Matrix &zvals, double xi, double yi, double &zi, int *xIndices, int *yIndices, ColumnVector &Weights) |
| void | bicubicInterp (double *xpts, double *ypts, const Matrix &zvals, double xi, double yi, double &zi, int *xIndices, int *yIndices, ColumnVector &Weights) |
| void | splineInterp (double *xpts, double *ypts, const Matrix &zvals, double xi, double yi, double &zi, int *xIndices, int *yIndices, ColumnVector &Weights) |
| void | nearestInterp_mat (double *xpts, double *ypts, const Matrix &zvals, double *xi, double *yi, Matrix &zi, Matrix &var) |
| void | bilinearInterp_mat (double *xpts, double *ypts, const Matrix &zvals, double *xi, double *yi, Matrix &zi, Matrix &var) |
| void | bicubicInterp_mat (double *xpts, double *ypts, const Matrix &zvals, double *xi, double *yi, Matrix &zi, Matrix &var) |
| void | splineInterp_mat (double *xpts, double *ypts, const Matrix &zvals, double *xi, double *yi, Matrix &zi, Matrix &var) |
| int | closestPt (double key, const double *base, size_t nmemb) |
| int | lowerBound (double val, const double *vec, int numVals) |
| double | randn (double mean, double stddev) |
| char * | charCat (char *dest, const char *front, const char *back) |
| double | computeKLdiv_gaussian_mat (double *xpts, double *ypts, const Matrix &refPDF, double *mu, const Matrix &Cov) |
| SymmetricMatrix | computeMatrixSqrt (const SymmetricMatrix &A) |
| void bicubicInterp | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double | xi, | ||
| double | yi, | ||
| double & | zi, | ||
| int * | xIndices, | ||
| int * | yIndices, | ||
| ColumnVector & | Weights | ||
| ) |
Uses bicubic interpolation to determine zi at the point (xi,yi) from the set of data xpts, ypts, and zvals. If zvals is size m x n, xpts is size m x 1 and ypts is size n x 1. The function modifies the the entries in xIndices, yIndices and W. xIndices and yIndices are px1 arrays containing the indices of xpts and ypts used to generate zi. The method used for bicubic interpolation is very similar to that described in Numerical Recipes in C++. If a 4x4 bounding box does not exist for the current (xi,yi) data point, OR the interpolated point is NaN, bilinearInterp() is used.
| void bicubicInterp_mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double * | xi, | ||
| double * | yi, | ||
| Matrix & | zi, | ||
| Matrix & | var | ||
| ) |
Interpolates all points in the vectors xi, yi to fill the matrix zi using the data in xpts, ypts and Z. Calls bicubicInterp() for each point in the xi and yi arrays to perform this interpolation.
| void bilinearInterp | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double | xi, | ||
| double | yi, | ||
| double & | zi, | ||
| int * | xIndices, | ||
| int * | yIndices, | ||
| ColumnVector & | Weights | ||
| ) |
Uses bilinear interpolation to determine zi at the point (xi,yi) from the set of data xpts, ypts, and zvals. If zvals is size m x n, xpts is size m x 1 and ypts is size n x 1. The function modifies the the entries in xIndices, yIndices and W. xIndices and yIndices are 4x1 arrays containing the indices of xpts and ypts used to generate zi. W is a 4x1 column vector of corresponding weights where: zi = sum_i W(i,1)*zvals(xIndices[i]+1,yIndices[i]+1). If a 2x2 bounding box does not exist for the current (xi,yi) data point (i.e., it is out of the bounds of Z), OR the interpolated point is NaN, nearestInterp() is used.
| void bilinearInterp_mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double * | xi, | ||
| double * | yi, | ||
| Matrix & | zi, | ||
| Matrix & | var | ||
| ) |
Interpolates all points in the vectors xi, yi to fill the matrix zi using the data in xpts, ypts and Z. Calls bilinearInterp() for each point in the xi and yi arrays to perform this interpolation.
| char* charCat | ( | char * | dest, |
| const char * | front, | ||
| const char * | back | ||
| ) |
This function is used to concatenate two character arrays (front and back) into a new character array, dest. This differs from the C standard function strcat() in that the returned character array is an entirely new location in memory, separate from the front and back arrays. The length of the dest char array must be greater than or equal to the sum of the lengths of the front and back arrays.
| int closestPt | ( | double | key, |
| const double * | base, | ||
| size_t | nmemb | ||
| ) |
| double computeKLdiv_gaussian_mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | refPDF, | ||
| double * | mu, | ||
| const Matrix & | Cov | ||
| ) |
This function computes the KL divergence between a proposal distribution and a Gaussian distribution with mean vector mu and covariance C. The proposal distribution is described by the matrix P, with corresponding (x,y) values given in the vectors xpts and ypts.
| SymmetricMatrix computeMatrixSqrt | ( | const SymmetricMatrix & | A | ) |
This function computes the matrix square root of the given matrix, A. The given matrix and the returned matrix are both symmetric matrices. The sqrt is computed by first performing the eigenvalue decomposition of the matrix A, square rooting the resulting eigenvalues, and reconstructing the matrix to get Asqrt.
| Matrix conv2 | ( | const Matrix & | A, |
| const Matrix & | H | ||
| ) |
Computes the 2D convolution of A with filter matrix H. The returned matrix B is the same size as A. H is assumed to be smaller than A.
| bool findNearestValid | ( | const Matrix & | zvals, |
| int & | xIndex, | ||
| int & | yIndex | ||
| ) |
Finds the nearest valid (non-NaN) point in the grid zvals to the point (xIndex, yIndex). Replaces xIndex and yIndex with the indices corresponding to this found location. Returns a boolean indicating if a non-NaN point was successfully found.
| void interp2 | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix | Z, | ||
| double * | xi, | ||
| double * | yi, | ||
| double * | zi, | ||
| int | numPts | ||
| ) |
Interpolates the matrix Z to the (x,y) point pairs in arrays xi and yi. N indicates the number of point pairs to be interpolated. The arrays xpts and ypts contain the (x,y) values corresponding to entries in matrix Z. If Z is size m x n, xpts is size m x 1 and ypts is size n x 1. Bilinear interpolation is used for this function.
| void interp2mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix | Z, | ||
| double * | xi, | ||
| double * | yi, | ||
| Matrix & | zi | ||
| ) |
Interpolates the matrix Z to a new matrix zi over the (x,y) points in the arrays xi and yi. Nx and Ny indicates the length of these arrays. The arrays xpts and ypts contain the (x,y) values corresponding to entries in matrix Z. If Z is size m x n, xpts is size m x 1 and ypts is size n x 1. This function calls interp2() for performing interpolations.
| int lowerBound | ( | double | val, |
| const double * | vec, | ||
| int | numVals | ||
| ) |
Finds the lowest index into the array "vec" which bounds the value "val". This function does NOT check that the returned index is a valid index into the array.
| int maxVal | ( | const int * | values, |
| const int | numValues | ||
| ) |
Finds and returns the maximum number in the integer array values.
| int minVal | ( | const int * | values, |
| const int | numValues | ||
| ) |
Rounds the number given to the nearest integer and returns the integer.
Finds and returns the minimum number in the integer array values.
| void nearestInterp | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double | xi, | ||
| double | yi, | ||
| double & | zi, | ||
| int * | xIndices, | ||
| int * | yIndices, | ||
| ColumnVector & | Weights | ||
| ) |
Uses nearest-neighbor interpolation to determine zi at the point (xi,yi) from the set of data xpts, ypts, and zvals. If zvals is size m x n, xpts is size m x 1 and ypts is size n x 1. The function modifies the the entries in xIndices, yIndices and W. xIndices and yIndices are px1 arrays containing the indices of xpts and ypts used to generate zi. W is a px1 matrix of corresponding weights where: zi = sum_i W(i,1)*zvals(xIndices[i]+1,yIndices[i]+1). If the nearest point is NaN, the closest non-NaN point is found.
| void nearestInterp_mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double * | xi, | ||
| double * | yi, | ||
| Matrix & | zi, | ||
| Matrix & | var | ||
| ) |
Interpolates all points in the vectors xi, yi to fill the matrix zi using the data in xpts, ypts and Z. Calls nearestInterp() for each point in the xi and yi arrays to perform this interpolation.
| double randn | ( | double | mean, |
| double | stddev | ||
| ) |
Uses a polar form Box-Muller Transform to generate a pseudorandom number from a gaussian distribution with specificied mean and standard deviation. Generates two random numbers for each call and stores the unused number for the next call to this function.
| void splineInterp | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double | xi, | ||
| double | yi, | ||
| double & | zi, | ||
| int * | xIndices, | ||
| int * | yIndices, | ||
| ColumnVector & | Weights | ||
| ) |
Uses spline interpolation to determine zi at the point (xi,yi) from the set of data xpts, ypts, and zvals. If zvals is size m x n, xvals is size m x 1 and ypts is size n x 1. The function modifies the the entries in xIndices, yIndices and W. xIndices and yIndices are px1 arrays containing the indices of xpts and ypts used to generate zi. Currently, this function is only implemented if a Matlab engine is running. Otherwise, this function calls nearestInterp().
| void splineInterp_mat | ( | double * | xpts, |
| double * | ypts, | ||
| const Matrix & | zvals, | ||
| double * | xi, | ||
| double * | yi, | ||
| Matrix & | zi, | ||
| Matrix & | var | ||
| ) |
Interpolates all points in the vectors xi, yi to fill the matrix zi using the data in xpts, ypts and Z. Currently, this function is only implemented if a Matlab engine is running. Otherwise, this function calls nearestInterp_mat().
1.8.6