|
static void | add (double *pDest, const double *pSource, size_t nDims) |
| Adds pSource to pDest. More...
|
|
static void | addInterpolatedFunction (double *pOut, size_t nOutVals, double *pIn, size_t nInVals) |
| Adds the function pIn to pOut after interpolating pIn to be the same size as pOut. More...
|
|
static void | addLog (double *pDest, const double *pSource, size_t nDims) |
| Adds the log of each element in pSource to pDest. More...
|
|
static void | addScaled (double *pDest, double dMag, const double *pSource, size_t nDims) |
| Adds dMag * pSource to pDest. More...
|
|
static void | capValues (double *pVec, double cap, size_t dims) |
| Sets each value, v, to MIN(cap, v) More...
|
|
static void | copy (double *pDest, const double *pSource, size_t nDims) |
| This just wraps memcpy. More...
|
|
static double | correlation (const double *pA, const double *pB, size_t nDims) |
| Computes the cosine of the angle between two vectors (the origin is the vertex) More...
|
|
static double | correlation (const double *pOriginA, const double *pTargetA, const double *pB, size_t nDims) |
| Computes the cosine of the angle between two vectors (the origin is the vertex) More...
|
|
static double | correlation (const double *pOriginA, const double *pTargetA, const double *pOriginB, const double *pTargetB, size_t nDims) |
| Computes the cosine of the angle between two vectors (the origin is the vertex) More...
|
|
static void | deserialize (double *pVec, GDomListIterator &it) |
| Load the vector from a text format. pVec must be large enough to contain all of the elements that remain in "it". More...
|
|
static bool | doesContainUnknowns (const double *pVector, size_t nSize) |
| This returns true if the vector contains any unknown values. Most of the methods in this class will give bad results if a vector contains unknown values, but for efficiency reasons, they don't check. So it's your job to check your vectors first. More...
|
|
static double | dotProduct (const double *pA, const double *pB, size_t nSize) |
| Computes the dot product of two vectors. Results are undefined if pA or pB contain unknown values. More...
|
|
static double | dotProduct (const double *pOrigin, const double *pTarget, const double *pVector, size_t nSize) |
| Computes the dot product of (pTarget - pOrigin) with pVector. More...
|
|
static double | dotProduct (const double *pOriginA, const double *pTargetA, const double *pOriginB, const double *pTargetB, size_t nSize) |
| Computes the dot product of (pTargetA - pOriginA) with (pTargetB - pOriginB). More...
|
|
static double | dotProductIgnoringUnknowns (const double *pA, const double *pB, size_t nSize) |
| Computes the dot product of two vectors, ignoring any unknown values. More...
|
|
static double | dotProductIgnoringUnknowns (const double *pOrigin, const double *pTarget, const double *pVector, size_t nSize) |
| Computes the dot product of (pTarget - pOrigin) with pVector. Unknown values in pTarget will simply be ignored. (pOrigin and pVector must not contain any unknown values.) More...
|
|
static double | estimateSquaredDistanceWithUnknowns (const double *pA, const double *pB, size_t nDims) |
| Estimates the squared distance between two points that may have some missing values. It assumes the distance in missing dimensions is approximately the same as the average distance in other dimensions. If there are no known dimensions that overlap between the two points, it returns 1e50. More...
|
|
static void | floorValues (double *pVec, double floor, size_t dims) |
| Sets each value, v, to MAX(floor, v) More...
|
|
static void | fromImage (GImage *pImage, double *pVec, int width, int height, int channels, double range) |
| Converts an image to a vector of rasterized pixel values. channels must be 1 or 3 (for grayscale or rgb) range specifies the range of channel values. Typical values are 1.0 or 255.0. Pixels are visited in reading order (left-to-right, top-to-bottom). pVec must be big enough to hold width * height * channels values. More...
|
|
static size_t | indexOfMax (const double *pVector, size_t dims, GRand *pRand=NULL) |
| Returns the index of the max value in pVector. If multiple elements have have an equivalent max value, then behavior depends on the value of pRand. If pRand is NULL, it will pick the first one. If pRand is non-NULL, it will uniformly pick from all the ties. More...
|
|
static size_t | indexOfMaxMagnitude (const double *pVector, size_t dims, GRand *pRand) |
| Returns the index of the value with the largest magnitude in pVector. If multiple elements have have an equivalent magnitude, it randomly (uniformly) picks from all the ties. More...
|
|
static size_t | indexOfMin (const double *pVector, size_t dims, GRand *pRand=NULL) |
| Returns the index of the min value in pVector. If multiple elements have have an equivalent max value, then behavior depends on the value of pRand. If pRand is NULL, it will pick the first one. If pRand is non-NULL, it will uniformly pick from all the ties. More...
|
|
static void | interpolateIndexes (size_t nIndexes, double *pInIndexes, double *pOutIndexes, float fRatio, size_t nCorrIndexes, double *pCorrIndexes1, double *pCorrIndexes2) |
| Interpolates (morphs) a set of indexes from one function to another. pInIndexes, pCorrIndexes1, and pCorrIndexes2 are all expected to be in sorted order. All indexes should be >= 0 and < nDims. fRatio is the interpolation ratio such that if fRatio is zero, all indexes left unchanged, and as fRatio approaches one, the indexes are interpolated linearly such that each index in pCorrIndexes1 is interpolated linearly to the corresponding index in pCorrIndexes2. If the two extremes are not in the list of corresponding indexes, the ends may drift. More...
|
|
static double | lNormDistance (double norm, const double *pA, const double *pB, size_t dims) |
| Computes L-Norm distance (norm=1 is manhattan distance, norm=2 is Euclidean distance, norm=infinity is Chebychev, etc.) More...
|
|
static double | lNormMagnitude (double norm, const double *pVector, size_t nSize) |
| Computes the magnitude in L-Norm distance (norm=1 is manhattan distance, norm=2 is Euclidean distance, norm=infinity is Chebychev, etc.) More...
|
|
static void | lNormNormalize (double norm, double *pVector, size_t nSize) |
| Normalizes with L-Norm distance (norm=1 is manhattan distance, norm=2 is Euclidean distance, norm=infinity is Chebychev, etc.) More...
|
|
static void | multiply (double *pVector, double dScalar, size_t nDims) |
| Multiplies pVector by dScalar. More...
|
|
static void | normalize (double *pVector, size_t nSize) |
| Normalizes this vector to a magnitude of 1. Throws an exception if the magnitude is zero. More...
|
|
static void | pairwiseDivide (double *pDest, double *pOther, size_t dims) |
| Divides each element in pDest by the corresponding element in pOther. More...
|
|
static void | pairwiseMultiply (double *pDest, double *pOther, size_t dims) |
| Multiplies each element in pDest by the corresponding element in pOther. More...
|
|
static void | perturb (double *pDest, double deviation, size_t dims, GRand &rand) |
| Adds Gaussian noise with the specified deviation to each element in the matrix. More...
|
|
static void | pow (double *pVector, double dScalar, size_t nDims) |
| Raises each element of pVector to the exponent dScalar. More...
|
|
static void | print (std::ostream &stream, int precision, const double *pVec, size_t dims) |
| Prints the values in the vector separated by ", ". precision specifies the number of digits to print. More...
|
|
static void | project (double *pDest, const double *pPoint, const double *pOrigin, const double *pBasis, size_t basisCount, size_t dims) |
| Projects pPoint onto the hyperplane defined by pOrigin onto the basisCount basis vectors specified by pBasis. (The basis vectors are assumed to be chained end-to-end in a big vector.) More...
|
|
static double | refinePoint (double *pPoint, double *pNeighbor, size_t dims, double distance, double learningRate, GRand *pRand) |
| Moves "pPoint" so that it is closer to a distance of "distance" from "pNeighbor". "learningRate" specifies how much to move it (0=not at all, 1=all the way). Returns the squared distance between pPoint and pNeighbor. More...
|
|
static void | regularize_1 (double *pVector, double amount, size_t nDims) |
| Adjusts each element in the direction toward 0 by the specified amount. More...
|
|
static void | regularize_1_5 (double *pVector, double amount, size_t nDims) |
| Apply L^(1.5) regularization to the specified vector. More...
|
|
static void | rotate (double *pVector, size_t nDims, double dAngle, const double *pA, const double *pB) |
| Rotates pVector by dAngle radians in the plane defined by the orthogonal axes pA and pB. More...
|
|
static void | safeNormalize (double *pVector, size_t nSize, GRand *pRand) |
| Normalizes this vector to a magnitude of 1. If the magnitude is zero, it returns a random vector. More...
|
|
static GDomNode * | serialize (GDom *pDoc, const double *pVec, size_t dims) |
| Write the vector to a text format. More...
|
|
static void | setAll (double *pVector, double value, size_t dims) |
| Sets all the elements to the specified value. More...
|
|
static void | smallestToFront (double *pVec, size_t k, size_t size, double *pParallel1=NULL, size_t *pParallel2=NULL, double *pParallel3=NULL) |
| Moves the smallest k values to the front of the vector, and the biggest (size - k) values to the end of the vector. (For efficiency, no other guarantees about ordering are made.) This has an average-case runtime that is linear with respect to size. pParallel1 and pParallel2 are optional arrays that should be arranged to keep their indices in sync with pVec. More...
|
|
static double | squaredDistance (const double *pA, const double *pB, size_t nDims) |
| Computes the squared distance between two vectors. More...
|
|
static double | squaredMagnitude (const double *pVector, size_t nSize) |
| Computes the squared magnitude of the vector. More...
|
|
static void | subtract (double *pDest, const double *pSource, size_t nDims) |
| Subtracts pSource from pDest. More...
|
|
static void | subtractComponent (double *pInOut, const double *pBasis, size_t dims) |
| Subtracts the component of pInOut that projects onto pBasis. (Assumes that pBasis is normalized.) This might be used, for example, to implement the modified Gram-Schmidt process. More...
|
|
static void | subtractComponent (double *pInOut, const double *pOrigin, const double *pTarget, size_t dims) |
| Subtracts the component of pInOut that projects onto (pTarget - pOrigin). This might be used, for example, to implement the modified Gram-Schmidt process. More...
|
|
static double | sumAbsoluteValues (const double *pVec, size_t dims) |
| Returns the sum of the absolute values of all the elements. More...
|
|
static double | sumElements (const double *pVec, size_t dims) |
| Returns the sum of all the elements. More...
|
|
static void | sumToOne (double *pVector, size_t size) |
| Scale the vector so that the elements sum to 1. More...
|
|
static void | test () |
| Performs unit tests for this class. Throws an exception if there is a failure. More...
|
|
static void | toImage (const double *pVec, GImage *pImage, int width, int height, int channels, double range) |
| Converts a vector of rasterized pixel values to an image. channels must be 1 or 3 (for grayscale or rgb) range specifies the range of channel values. Typical values are 1.0 or 255.0. Pixels are visited in reading order (left-to-right, top-to-bottom). More...
|
|