| |
Overview
The matrix libraries
are the product of years worth of weekend work and the loss of many
sunny weekends. The matrix library as it currently stands has hundreds
of individual function types. Most functions are overloaded to work
with all basic data types: decimal, double, float, long, ulong,
int, uint, short, ushort, byte, sbyte, and bool (and sometimes object).
Most functions are overloaded for multiple dimensionalities as well
(when applicable).
Typically 1D, 2D, and
3D arrays are handled except when arrays of a certain dimensonality
are required (i.e. Mult requires 2D arrays). And some of
the mathematic methods are only implemented for floating point types
because they don't make sense for integer types (i.e. the Sqrt
function).
The method names are
typically chosen to coincide with those used in Matlab, C, C++,
or C#. The functionality may or may not be the same for each function
as its Matlab or C cousin. This largely depends on the immediate
need that I had when I wrote it.
Mathematic
Methods
 |
Add |
Adds
2 equally sized arrays together element by element or a scalar
to every element of an array. |
| |
Array
+ Array |
| |
Array
+ Scalar |
| |
Subtract |
Subtracts
2 equally sized arrays element by element. Also subtracts a
scalar from every element of an array or every element of the
array from the scalar. |
| |
Array
- Array |
| |
Array
- Scalar |
| |
Scalar
- Array |
| |
Mult |
Matrix
Multiplies two arrays in LxM * MxN format. Also can multiply
a scalar to every element of an array |
| |
Array
* Array |
| |
Array
* Scalar |
| |
MultByElem |
Multiplies
two equally sized arrays together element by element |
| |
Div |
Divides
an scalar by every element in an array or every element in an
array by a scalar. |
| |
Scalar
/ Array |
| |
Array
/ Scalar |
| |
DivByElem |
Takes
the quotient of two equally sized arrays element by element |
| |
Sum |
Takes
the sum of all elements in an array |
| |
Sqrt |
Takes
the square root of every element in an array |
| |
Avg |
Returns
the average of the values in an array |
| |
Var |
Returns
the variance of the values in an array |
| |
StdDev |
Returns
the standard deviation of the values in an array |
| |
Inv |
Takes
the inverse of an array |
| |
Abs |
Takes
the absolute value of every element in an array |
| |
Det |
Takes
the determinant of an array |
| |
Floor |
Rounds
each element of an array towards zero |
| |
Ceil |
Rounds
each element of an array away from zero |
| |
LimitPrecision |
Limits
the precision of every element of a floating point array to
the specified precision |
| |
Norm |
Takes
the norm of an array |
| |
Convolve |
Convolves
an array of data with a specified kernel. |
| |
Cond |
Returns
the condition of the array |
| |
Corr |
Takes
the normalized cross correlation of two arrays element by element |
| |
Hist |
Returns
the histogram of an array of data |
| |
Pow |
Matrix
multiplies an array with itself n times |
| |
PowByElem |
Raises
every element in an array to the nth power |
| |
Log |
Takes
the logarithm of every element in an array |
| |
HorzDiff |
Takes
the horizontal difference between adjacent data points in an
array. Data returned has a width of n-1 |
| |
VertDiff |
Takes
the vertical difference between adjacent data points in an array.
Data returned has a height of n-1 |
| |
HorzDer |
Takes
the horizontal derivative of a 2D array of data by fitting a
quadradic to each series of three horizontal data points and
takes the mathematical derivative at the center point. |
| |
VertDer |
Takes
the vertical derivative of a 2D array of data by fitting a quadradic
to each series of three vertical data points and takes the mathematical
derivative at the center point. |
| |
FindAndReplace |
Finds
the set values in an array and replaces them. |
Solver
Methods
 |
RRef |
Takes
an array of data and reduces it to Reduced Row Echelon Form |
| |
Simult |
Solves
a set of simultaneous equations either in coefficient matrix
and solution matrix form or in augmented matrix form. Note:
the augmented matrix must be in (n x n+1) form. |
| |
Coef.
& Soln. Matrix |
| |
Augmented
Matrix |
| |
Regress2 |
Performs
n-th order polynomial regression on a set of x-y data
points |
| |
Regress3 |
Performs
multilinear regression on a set of x-y-z data points. Note:
I'm trying to crete a standardized version of (m-th x
n-th) multipolynomial regression, but have not yet completed
it. |
| |
Interp2 |
Performs
interpolation on a 2D set of data. Interpolation types include:
Nearest Neighbor, Bilinear, Bicubic. |
| |
PolyFit |
Fits
a n-th order polynomial through n+1 data points. |
| |
PolyFit3 |
Fits
a (m-th x n-th) order surface through (m+1)*(n+1)
points. |
| |
BinarySearch2D_EqualSpaced |
Performs
a 2D binary search on evenly spaced gridded data. |
| |
BinarySearch2D_Monotonic |
Performs
a 2D binary search on non-evenly spaced, but still monotonic
(always increasing or not changing in a given direction or always
decreasing or not changing in a given direction) |
| |
BinarySearch2D_Irregular |
Performs
a 2D binary search on completely irregular (scattered) data.
Uses a triangular interpolation and prediction algorithm that
works well as long as data is not too badly scattered. |
Matrix
Manipulation Methods
 |
Col |
|
| |
Copy |
Copies
a column of data from an array to a buffer |
| |
Cut |
Copies
a column of data from an array to a buffer and removes it from
the input array |
| |
Ins |
Inserts
a column of data into an array |
| |
Del |
Removes
a column of data from an array |
| |
Move |
Shifts
the position of a column of data in an array |
| |
Swap |
Interchanges
the position of two columns in an array without disturbing remainder
of array |
| |
ToVec |
Converts
a column of data to a vector |
| |
FromVec |
Converts
a vector to a column of data |
| |
Row |
|
| |
Copy |
Copies
a rowof data from an array to a buffer |
| |
Cut |
Copies
a row of data from an array to a buffer and removes it from
the input array |
| |
Ins |
Inserts
a row of data into an array |
| |
Del |
Removes
a row of data from an array |
| |
Move |
Shifts
the position of a row of data in an array |
| |
Swap |
Interchanges
the position of two rows in an array without disturbing remainder
of array |
| |
ToVec |
Converts
a row of data to a vector |
| |
FromVec |
Converts
a vector to a row of data |
| |
Serial |
Serializes
a multidimensional array of data to a 1D array of values |
| |
SubMat |
Copies
a piece of an input array to a new array |
| |
SubVec |
Copies
a piece of an input vector to a new vector |
| |
RepMat |
Tile
the input array n x m times to create a new array |
| |
Diag |
Extract
a diagonal of an array into a vector |
| |
Overwrite |
Overwrite
a section of an array with the contents of another array |
| |
Sort |
Sort
the elements of an array by value |
| |
PadArray |
Pad
the edges input array with user set value |
| |
VecCat |
Concatenate
two vectors |
| |
HorzCat |
Concatenate
two equal height arrays horizontally |
| |
VertCat |
Concatenate
two equal width arrays vertically |
| |
PlaneCat |
Concatenate
a 2D array onto the surface of a 3D |
| |
FlipLR |
Flip
the elements of an array from left-to-right to right-to-left |
| |
FlipUD |
Flip
the elements of an array from up-to-down to down-to-up |
| |
FlipFB |
Flip
the elements of a 3D array from front-to-back to back-to-front |
| |
Trans |
Take
the transpose of an array |
| |
Rot90CW |
Rotate
an array about the depth axis by 90 degrees clockwise |
| |
Rot90CCW |
Rotate
an array about the depth axis by 90 degrees counter-clockwise |
| |
Rot180 |
Rotate
an array about the depth axis by 180 degrees |
Data
Type Conversion Methods
 |
ToString |
Convert
a numeric array to a string representataion. The output string
is in a format that can be directly dropped into Matlab. |
| |
ToObject |
Convert
numeric array into an object array |
| |
ToDecimal |
Convert
numeric array into a decimal array |
| |
ToDouble |
Convert
numeric array into a double array |
| |
ToFloat |
Convert
numeric array into a float array |
| |
ToLong |
Convert
numeric array into a long array |
| |
ToULong |
Convert
numeric array into an unsigned long array |
| |
ToInt |
Convert
numeric array into an int array |
| |
ToUInt |
Convert
numeric array into an unsigned int array |
| |
ToShort |
Convert
numeric array into a short array |
| |
ToUShort |
Convert
numeric array into an unsigned short array |
| |
ToByte |
Convert
numeric array into a byte array |
| |
ToBool |
Convert
numeric array into a boolean array |
| |
RectToJagged |
Convert
a n-D array to a jagged array type (i.e. double[,] to double[][] |
| |
JaggedToRect |
Convert
a jagged array to a n-D array type (i.e double[][] to double[,]) |
File
Type Conversion Methods
 |
ToCSVFile |
Create
a CSV (Comma Sepearated Values) file from an array |
| |
ToBitmap |
Create
a bitmap from an array of data |
| |
ToByte2File |
Create
a binary file storing the information from a 2D byte array |
| |
ToUShort2File |
Create
a binary file storing the information from a 2D ushort array |
| |
ToDouble2File |
Create
a binary file storing the information from a 2D double array |
| |
ToDouble3File |
Create
a binary file storing the information from a 3D double array |
| |
FromCSVFile |
Reads
a CSV file and stores data in an array |
| |
FromBitmap |
Reads
a bitmap file and stores data in an array |
| |
FromByte2File |
Reads
a binary file containing a 2D byte array and stores in buffer |
| |
FromUShort2File |
Reads
a binary file containing a 2D ushort array and stores in buffer |
| |
FromDouble2File |
Reads
a binary file containing a 2D double array and stores in buffer |
| |
FromDouble3File |
Reads
a binary file containing a 3D double array and stores in buffer |
Boolean
Methods
 |
LessThan |
Checks
if data in array1 < array2 element by element. Boolean array
of results is returned. |
| |
LessThanEq |
Checks
if data in array1 <= array2 element by element. Boolean array
of results is returned. |
| |
GreaterThan |
Checks
if data in array1 > array2 element by element. Boolean array
of results is returned. |
| |
GreaterThanEq |
Checks
if data in array1 >= array2 element by element. Boolean array
of results is returned. |
| |
Equal |
Checks
if data in array1 == array2 element by element. Boolean array
of results is returned. |
| |
IsEmpty |
Check
the input array for a size 0 array. Note: this is different
than a null array. |
| |
IsBlank |
Checks
to see if the input array is different than initialized state |
| |
IsNaN |
Checks
data in array element by element for NaNs, boolean array of
results is returned |
| |
NumNaN |
Returns
the number of NaNs in the array |
| |
AnyNaN |
Returns
a boolean value indicating if the array contains any NaNs |
| |
IsInf |
Checks
data in array element by element for positive or negative infinity,
boolean array of results is returned |
| |
NumInf |
Returns
the number of times positive or negative infinity occurs in
the array |
| |
AnyInf |
Returns
a boolean value indicating if the array contains any positive
or negative infinities |
| |
IsPosInf |
Checks
data in array element by element for positive infinity, boolean
array of results is returned |
| |
NumPosInf |
Returns
the number of times positive infinity occurs in the array |
| |
AnyPosInf |
Returns
a boolean value indicating if the array contains any positive
infinities |
| |
IsNegInf |
Checks
data in array element by element for negative infinity, boolean
array of results is returned |
| |
NumNegInf |
Returns
the number of times negative infinity occurs in the array |
| |
AnyNegInf |
Returns
a boolean value indicating if the array contains any negative
infinities |
Data
Creation Methods
 |
Rand |
Creates
an array filled with random numbers in a user specified range |
| |
RandN |
Creates
an array of random numbers with Gaussian characteristics |
| |
Eye |
Creates
an identity matrix |
| |
NumSeq |
Creates
a vector of numbers with a start, step, and end point |
| |
NumFill |
Creates
an array filled with a specified value |
| |
MeshGrid |
Creates
two 2D arrays of data from two sets of 1D inputs. Typically
used to create x-y indicies for an array of data |
| |
Initialize |
Allows
user to explicitly set all values of an array |
| |
NewJagged |
Creates
a new jagged array |
Information
Extraction Methods
 |
Min |
Returns
the minimum value of the array (Note: -Infinity or NaN superscede
real numbers in the min function and will always be returned
if present) |
| |
Max |
Returns
the maximum value of the array (Note: +Infinity or NaN superscede
real numbers in the max function and will always be returned
if present) |
| |
MaxAndMin |
Works
the same was as min and max, but determines both values simultaneously.
(Runs faster for large data sets, than running min and max separately) |
| |
MinReal |
Returns
the minimum value of the array (excluding -Infinity and NaN) |
| |
MaxReal |
Returns
the maximum value of the array (excluding +Infinity and NaN) |
| |
Colormap |
Returns
a bitmap of the data in a 2D array based on a user defined color
scheme. |
|