#include <Matrix.h>
The matrix class supports advanced real and complex functionality. It is optimized for columnwise operations. Refer to example_main.cpp for a complete example program using the Matrix.
Definition at line 133 of file Matrix.h.
Public Member Functions | |
Matrix () | |
The default constructor (no data allocated yet). | |
Matrix (const unsigned nrows) | |
A vector style constructor. | |
Matrix (const unsigned nrows, const unsigned ncols, const bool isReal=true) | |
A matrix style constructor. | |
Matrix (const Matrix &mat) | |
The copy constructor. | |
Matrix (const char *path, bool &itWorked) | |
A constructor reading data from a file. | |
Matrix (const char *strMatrix) | |
A constructor initialized the matrix from a string. | |
Matrix (const double mat[], const unsigned nrows, const unsigned ncols=1) | |
The constructor as a copy from a static matrix. | |
virtual | ~Matrix () |
The destructor. | |
Matrix & | operator= (const Matrix &mat) |
The assignment operator from another matrix. | |
Matrix & | operator= (const double value) |
The assignment operator from a scalar double value. | |
Matrix & | operator= (const std::complex< double > value) |
The assignment operator from a std::complex<double> value. | |
Matrix & | operator= (const char *strMatrix) |
The assignement operator from a string matrix. | |
bool | Clear () |
Clear the matrix memory. Set the matrix to size 0x0. | |
bool | isEmpty () const |
Is this matrix empty? | |
bool | isConformal (const Matrix &mat) const |
Is the matrix mat conformal for multiplication (*this * mat)? | |
bool | isSameSize (const Matrix &mat) const |
Is this matrix the same size as mat? | |
bool | isSquare () const |
Is this a square matrix? | |
bool | isStoredAsComplex () |
Check if this matrix is stored as a complex matrix. | |
bool | isReal () |
Check if this a real matrix. | |
bool | isComplex () |
Check if this a complex matrix. | |
bool | isVector () |
Check if this is a vector. Is the matrix either nx1 or 1xn. | |
unsigned | GetNrCols () const |
return no. of cols | |
unsigned | ncols () const |
return no. of cols | |
unsigned | GetNrElems () const |
return total no. of elements | |
unsigned | nelems () const |
return total no. of elements | |
unsigned | GetNrRows () const |
return no. of rows | |
unsigned | nrows () const |
return no. of rows | |
unsigned | GetLength () const |
return the maximum dimension either nrows or ncols whichever is greater. | |
double | real (const unsigned row, const unsigned col) |
Return the real part of the matrix at this row and column. | |
double | real (const unsigned index) |
Return the real part of the matrix at this vector index. | |
double | imag (const unsigned row, const unsigned col) |
Return the imaginary part of the matrix at this row and column. | |
double | imag (const unsigned index) |
Return the imaginary part of the matrix at this vector index. | |
bool | ReadFromFile (const char *path) |
Read the matrix from an ASCII file with the path given by the 'c' style string (with automatric support for many delimiters, whitespace, or ',', or ';', or many others) or a compressed BINARY matrix file used in the Save function. Complex and real data input are supported. A non-numeric header line can be present which will be skipped. | |
bool | ReadFromFile (std::string path) |
Read the matrix from a file given the file path as a standard string. | |
bool | Copy (Matrix &src) |
A safe function for performing a copy of another matrix. | |
bool | Copy (const double &value) |
A safe function for setting the matrix from a double. | |
bool | Copy (const std::complex< double > &cplx) |
A safe function for setting the matrix from a std::complex<double>. | |
bool | Save (const char *path) |
Saves a matrix to the specified file path (a 'c' style string) using a proprietary compressed format. | |
bool | Save (std::string path) |
Saves a matrix to the specified file path (a std::string) using a proprietary compressed format. | |
bool | Print (const char *path, const unsigned precision=9, bool append=false) |
Print the matrix to a file with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'", to the 'c' style path string provided. | |
bool | Print (std::string path, const unsigned precision, bool append=false) |
Print the matrix to a file with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'", to the std:string path provided. | |
bool | PrintStdout (const unsigned precision=6) |
Print the matrix to the standard output (stdout) with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'". | |
bool | PrintToBuffer (char *buffer, const unsigned maxlength, const unsigned precision) |
Print the matrix to a buffer of maxlength with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'". | |
bool | PrintFixedWidth (const char *path, const unsigned width, const unsigned precision, bool append=false) |
Print the matrix to a file with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'" to file specified with the 'c' style path string provided. | |
bool | PrintFixedWidth (std::string path, const unsigned width, const unsigned precision, bool append=false) |
Print the matrix to a file with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'" to file specified with the std::string path string provided. | |
bool | PrintFixedWidthToBuffer (char *buffer, const unsigned maxlength, const unsigned width, const unsigned precision) |
Print the matrix to a buffer of maxlength with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'". | |
bool | PrintDelimited (const char *path, const unsigned precision, const char delimiter, bool append=false) |
Print the matrix to a file path specified by the 'c' style string with specifed precision and delimiter. | |
bool | PrintDelimited (std::string path, const unsigned precision, const char delimiter, bool append=false) |
Print the matrix to a file path specified by the std::string with specifed precision and delimiter. | |
bool | PrintDelimitedToBuffer (char *buffer, const unsigned maxlength, const unsigned precision, const char delimiter) |
Print the matrix to a 'c' style string buffer of maxlength with specifed precision and delimiter. | |
bool | PrintRowToString (const unsigned row, char *buffer, const unsigned maxlength, const int width, const int precision) |
Print a row to a 'c' style string buffer. | |
bool | RemoveColumn (const unsigned col) |
Remove a single column from the matrix. | |
bool | RemoveColumnsAfterIndex (const unsigned col) |
Remove all the columns 'after' the column index given. | |
bool | RemoveRowsAndColumns (const unsigned nrows, const unsigned rows[], const unsigned ncols, const unsigned cols[]) |
Remove the rows and columns specified by the indices in the rows[] and cols[] arrays. | |
bool | InsertColumn (const Matrix &src, const unsigned dst_col, const unsigned src_col) |
Insert a column matrix into the matrix. | |
bool | AddColumn (const Matrix &src, const unsigned src_col) |
Add a column to the end of the matrix. | |
bool | Concatonate (const Matrix &src) |
Combine two matrices with the same nrows, A becomes A|B. | |
bool | Redim (const unsigned nrows, const unsigned ncols=1) |
Redimension the matrix, original data is saved in place, new data is set to zero. The default value for ncols allows redimensioning as a vector. | |
bool | Resize (const unsigned nrows, const unsigned ncols=1) |
Resize the matrix, original data is lost, new data is set to zero. The default value for ncols allows resizing as a vector. | |
bool | SetFromStaticMatrix (const double mat[], const unsigned nrows, const unsigned ncols) |
Set the matrix from the static 'c' style matrix indexed by mat[i*ncols + j]. | |
bool | SetFromMatrixString (const char *strMatrix) |
Setting the matrix values from a string matrix. | |
bool | CopyColumn (const unsigned src_col, Matrix &dst) |
Copy the src data in column col to dst matrix, resize dst if possible and necessary. | |
bool | InsertSubMatrix (const Matrix &src, const unsigned dst_row, const unsigned dst_col) |
Insert a submatrix (src) into dst, starting at indices dst(row,col). | |
bool | ExtractSubMatrix (Matrix &dst, const unsigned from_row, const unsigned from_col, const unsigned to_row, const unsigned to_col) |
Extract a submatrix (dst) from this matrix from (inclusive) the rows and columns specified. | |
bool | Zero () |
Zero the entire matrix. | |
bool | ZeroColumn (const unsigned col) |
Zero all elements in a specified column. | |
bool | ZeroRow (const unsigned row) |
Zero all elements in a specified row. | |
bool | Swap (Matrix &M) |
Efficiently swaps the contents of this matrix with matrix M. The contents are exhanged without the need to copy matrix data. | |
bool | Fill (const double value) |
Fill the matrix with the given value. | |
bool | FillColumn (const unsigned col, const double value) |
Fill the matrix column with the given value. | |
bool | FillRow (const unsigned row, const double value) |
Fills the matrix row with the given value. | |
bool | FlipColumn (const unsigned col) |
Reverse the order of elements of a column. | |
bool | FlipRow (const unsigned row) |
Reverse the order of elements of a row. | |
bool | Identity () |
Set the matrix to identity using the current dimensions. | |
bool | Identity (const unsigned dimension) |
Set the matrix to identity using the specified dimension (nxn). | |
bool | Inplace_Transpose () |
Transpose the matrix as an inplace operation. | |
bool | Inplace_Round (const unsigned precision=0) |
Round the matrix elements to the specified presision. e.g. precision = 0 1.8 -> 2 (default) e.g. precision = 1, 1.45 -> 1.5 e.g. precision = 2 1.456 -> 1.46 e.g. precision = 3, 1.4566 -> 1.457 . | |
bool | Inplace_Floor () |
Round the matrix elements to the nearest integers towards minus infinity. | |
bool | Inplace_Ceil () |
Round the matrix elements to the nearest integers towards infinity. | |
bool | Inplace_erf () |
Compute the error function (erf) for all values in the matrix inplace. erf(x) = 2/sqrt(pi) * [integral from 0 to x of]( e^(-t^2) )dt. | |
bool | Inplace_erfinv () |
Compute the inverse error function (erfinv) for all values in the matrix inplace. y = erf(x) = 2/sqrt(pi) * [integral from 0 to x of]( e^(-t^2) )dt. x = erfinv(y);. | |
bool | Inplace_erfc () |
Compute the complementary error function (erfc) for all values in the matrix inplace. erfc(x) = 1 - erf(x) = 2/sqrt(pi) * [integral from x to inf of]( e^(-t^2) )dt. | |
bool | Inplace_erfcinv () |
Compute the complementary error function (erfc) for all values in the matrix inplace. erfc(x) = 1 - erf(x) = 2/sqrt(pi) * [integral from x to inf of]( e^(-t^2) )dt. | |
bool | Inplace_Fix () |
Rounds the matrix elements of X to the nearest integers towards zero. | |
bool | Inplace_AddScalar (const double scalar) |
Add a scaler double (ie: M += 5). | |
bool | Inplace_SubtractScalar (const double scalar) |
Subtract a scaler double (ie: M -= 5). | |
bool | Inplace_MultiplyScalar (const double scalar) |
Multiply by scaler double (ie: M *= 5). | |
bool | Inplace_DivideScalar (const double scalar) |
Divide by scaler double (ie: M /= 5). | |
bool | Inplace_PowerScalar (const double scalar) |
Raise the matrix to a power scaler double (ie: M ^= 5). | |
bool | Inplace_AddScalarComplex (const std::complex< double > cplx) |
Add a scaler double (ie: M += (4+2i)). | |
bool | Inplace_SubtractScalarComplex (const std::complex< double > cplx) |
Subtract a scaler double (ie: M -= (5+2i)). | |
bool | Inplace_MultiplyScalarComplex (const std::complex< double > cplx) |
Multiply by scaler double (ie: M *= (5+2i)). | |
bool | Inplace_DivideScalarComplex (const std::complex< double > cplx) |
Divide by scaler double (ie: M /= (5+1i)). | |
bool | Inplace_PowerScalarComplex (const std::complex< double > cplx) |
Raise the matrix to a power scaler double (ie: M ^= (5+2i)). | |
bool | Inplace_Abs () |
Compute the absolute value of each element in the matrix. | |
bool | Inplace_Sqr () |
Compute the value^2 of each element in the matrix. | |
bool | Inplace_Sqrt () |
Computes the sqrt(value) of each element in the matrix. | |
bool | Inplace_Exp () |
Computes the exp(value) of each element in the matrix. | |
bool | Inplace_Ln () |
Computes the natural logarithm, ln(value) of each element in the matrix. | |
bool | Inplace_Increment () |
Add +1.0 to all elements, e.g. M++. | |
bool | Inplace_Decrement () |
Subtract 1.0 from all elements, e.g. M--. | |
bool | Inplace_Add (const Matrix &B) |
Add matrix B to this matrix inplace. A += B, inplace. | |
bool | Inplace_Subtract (const Matrix &B) |
Subtract matrix B from this matrix inplace. A -= B, inplace. | |
bool | Inplace_PreMultiply (const Matrix &B) |
Pre-Multiply this matrix by B. A = B*A, inplace. | |
bool | Inplace_TranposePreMultiply (const Matrix &B) |
Pre-Multiply this matrix by tranpose(B). A = tranpose(B)*A, inplace. No transpose occurs and hence more efficient. | |
bool | Inplace_PostMultiply (const Matrix &B) |
Post-Multiply this matrix by B. A = A*B, inplace. | |
bool | Inplace_PostMultiplyTranspose (const Matrix &B) |
Post-Multiply this matrix by transpose(B). A = A*transpose(B), inplace. | |
bool | Inplace_DotMultiply (const Matrix &B) |
Dot multiply A .*= B, inplace. A and B must have the same dimensions. | |
bool | Inplace_DotDivide (const Matrix &B) |
Dot divide A ./= B, inplace. A and B must have the same dimensions. | |
bool | Inplace_SortAscending () |
Sorts each column of the matrix in ascending order. If complex, sorts based on magnitude. | |
bool | Inplace_SortDescending () |
Sorts each column of M in descending order. If complex, sorts based on magnitude. | |
bool | Inplace_SortColumnAscending (const unsigned col) |
Sorts a specific column in ascending order. If complex, sorts based on magnitude. | |
bool | Inplace_SortColumnDescending (const unsigned col) |
Sorts a specific column in descending order. If complex, sorts based on magnitude. | |
bool | Inplace_SortColumnIndexed (const unsigned col, Matrix &Index) |
Sorts a specific column in ascending order and fills a column vector with the sorted index. The index vector will be resized if needed. If complex, sorts based on magnitude. | |
bool | Inplace_SortByColumn (const unsigned col) |
Sorts the entire matrix by a specific column. If complex, sorts based on magnitude. | |
bool | Inplace_Invert () |
Computes the inplace inverse of the matrix. | |
bool | Inplace_InvertRobust () |
Perfroms an inplace inverse using Gaussian Elimination methods. | |
bool | Inplace_LowerTriangularInverse () |
Compute the inplace inverse of a unit lower triangular matrix. | |
bool | Inplace_FFT () |
Compute the inplace Fourier Transform of each column of the matrix. | |
bool | Inplace_FFT2 () |
Compute the inplace Two-Dimensional Fourier Transform of the matrix. FFT2 is equivalent to transpose( FFT( transpose( FFT(each column) ) ) ). | |
bool | Inplace_IFFT () |
Compute the inplace inverse Fourier Transform of each column of the matrix. | |
bool | Inplace_IFFT2 () |
Compute the inplace inverse Fourier Transform of the matrix. IFFT2 is equivalent to transpose( IFFT( transpose( IFFT(each column) ) ) ). | |
bool | Add (const Matrix &B, const Matrix &C) |
Add A = B+C. The result, A, is stored in this matrix. | |
bool | Subtract (const Matrix &B, const Matrix &C) |
Subtract A = B-C. The result, A, is stored in this matrix. | |
bool | Multiply (const Matrix &B, const Matrix &C) |
Multiply A = B*C. The result, A, is stored in this matrix. | |
bool | TransposeMultiply (const Matrix &B, const Matrix &C) |
Multiply A = transpose(B)*C. The result, A, is stored in this matrix. | |
bool | MultiplyTranspose (const Matrix &B, const Matrix &C) |
Multiply A = B*transpose(C). The result, A, is stored in this matrix. | |
bool | Inplace_abs () |
Compute the absolute value of each element of the matrix inplace. | |
bool | Inplace_acos () |
Compute the arc-cosine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in radians. | |
bool | Inplace_acosd () |
Compute the arc-cosine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in degrees. | |
bool | Inplace_acosh () |
Compute the inverse hyperbolic cosine of each element of the matrix inplace. Results in radians. | |
bool | Inplace_angle () |
Compute the phase angle in radians of the elements of the matrix. | |
bool | Inplace_asin () |
Compute the arc-sine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in radians. | |
bool | Inplace_asind () |
Compute the arc-sine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in degrees. | |
bool | Inplace_asinh () |
Compute the inverse hyperbolic sine of each element of the matrix inplace. Results in radians. | |
bool | Inplace_atan () |
Compute the arc-tangent of each element of the matrix inplace. Results in radians bounded [-pi/2, pi/2]. | |
bool | Inplace_atand () |
Compute the arc-tangent of each element of the matrix inplace. Results in degrees bounded [-90, 90]. | |
bool | Inplace_atanh () |
Compute the inverse hyperbolic tangent of each element of the matrix inplace. | |
bool | Inplace_colon (double start, double increment, double end) |
Create a column vector [start:increment:end) beginning at start with step size of increment until less than or equal to end. Note that arguments must be real scalars. . | |
bool | Inplace_cos () |
Compute the cosine of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_cosh () |
Compute the hyperbolic cosine of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_cot () |
Compute the cotangent of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_coth () |
Compute the hyperbolic cotangent of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_conj () |
Complex conjugate. z = x+yi. conj(z) = x-yi. | |
bool | Inplace_exp () |
Compute the exponential of each element of the matrix inplace. If real, computes the exp(value) of each element in the matrix. If complex, computes exp(M) = exp(real)*(cos(imag)+i*sin(imag)). | |
bool | Inplace_eye (const unsigned nrows, const unsigned ncols) |
Create an indentity matrix with nrows and ncols. | |
bool | Inplace_imag () |
Imaginary part of the complex matrix. z = x+yi. real(z) = y. | |
bool | Inplace_log2 () |
Compute the log base 2 of the elements of the matrix. Complex results if elements are negative. | |
bool | Inplace_log10 () |
Compute the log base 10 of the elements of the matrix. Complex results if elements are negative. | |
bool | Inplace_ones (const unsigned nrows, const unsigned ncols) |
Create a matrix of nrows by ncols filled with 1.0. | |
bool | Inplace_rand (const unsigned nrows, const unsigned ncols, const unsigned seed=rand()) |
Produce a matrix that is composed of pseudo-random numbers. Values are elements are uniform distribution [0,1]. | |
bool | Inplace_randn (const unsigned nrows, const unsigned ncols, const unsigned seed=rand()) |
Produce a matrix that is composed of pseudo-random numbers. Values are elements are standard normal distribution with mean zero, variance of one and standard of deviation one. N(0,1). | |
bool | Inplace_real () |
Real part of the complex matrix. z = x+yi. real(z) = x. | |
bool | Inplace_sin () |
Compute the sine of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_sinc () |
Compute the sinc of each element*pi of the matrix inplace. i.e. y = sin(pi*x)./(pi*x). | |
bool | Inplace_sinh () |
Compute the hyperbolic sine of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_sqrt () |
Compute the sqrt of each element of the matrix inplace. | |
bool | Inplace_tan () |
Compute the tangent of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_tanh () |
Compute the hyperbolic tangent of each element of the matrix inplace. This function assumes radian values in the matrix. | |
bool | Inplace_zeros (const unsigned nrows, const unsigned ncols) |
Create a matrix of nrows by ncols filled with 0.0. | |
bool | GetStats_MaxAbs (unsigned &row, unsigned &col, double &value) |
Computes the value of the largest absolute element and its index. | |
bool | GetStats_Max (unsigned &row, unsigned &col, double &re, double &im) |
Computes the value (re+im*j) of the maximum element and its index. When complex the maximum absolute value is determined. | |
bool | GetStats_MaxVal (double &re, double &im) |
Computes the value (re+im*j) of the maximum element. When complex the maximum absolute value is determined. | |
bool | GetStats_MaxAbsCol (const unsigned col, double &value, unsigned &row) |
Computes the value of the largest absolute column element and its row index. | |
bool | GetStats_MaxCol (const unsigned col, double &re, double &im, unsigned &row) |
Computes the value (re+im*j) of the maximum column element and its row index. | |
bool | GetStats_MaxColVal (const unsigned col, double &re, double &im) |
Computes the value (re+im*j) of the maximum column element. | |
bool | GetStats_MaxAbsRow (const unsigned row, double &value, unsigned &col) |
Computes the value of the largest absolute row element and its column index. | |
bool | GetStats_MaxRow (const unsigned row, double &re, double &im, unsigned &col) |
Computes the value (re+im*j) of the maximum row element and its column index. | |
bool | GetStats_MaxRowVal (const unsigned row, double &re, double &im) |
Computes the value (re+im*j) of the maximum row element. | |
bool | GetStats_MinAbs (unsigned &row, unsigned &col, double &value) |
Computes the value of the smallest absolute element and its index. | |
bool | GetStats_Min (unsigned &row, unsigned &col, double &re, double &im) |
Computes the value (re+im*j) of the minimum element and its index. | |
bool | GetStats_MinVal (double &re, double &im) |
Computes the value (re+im*j) of the minimum element. | |
bool | GetStats_MinAbsCol (const unsigned col, double &value, unsigned &row) |
Computes the value of the smallest absolute column element and its row index. | |
bool | GetStats_MinCol (const unsigned col, double &re, double &im, unsigned &row) |
Computes the value (re+im*j) of the minimum column element and its row index. | |
bool | GetStats_MinColVal (const unsigned col, double &re, double &im) |
Computes the value (re+im*j) of the minimum column element. | |
bool | GetStats_MinAbsRow (const unsigned row, double &value, unsigned &col) |
Computes the value of the smallest absolute row element and its column index. | |
bool | GetStats_MinRow (const unsigned row, double &re, double &im, unsigned &col) |
Computes the value (re+im*j) of the minimum row element and its column index. | |
bool | GetStats_MinRowVal (const unsigned row, double &re, double &im) |
Computes the value (re+im*j) of the minimum row element. | |
bool | GetStats_ColRange (const unsigned col, double &re, double &im) |
Computes the range of the data in the specified column. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_RowRange (const unsigned row, double &re, double &im) |
Computes the range of the data in the specified row. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_Range (double &re, double &im) |
Computes the range of the data in the matrix. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_ColumnSum (const unsigned col, double &re, double &im) |
Computes the sum for the specified column. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_RowSum (const unsigned row, double &re, double &im) |
Computes the sum for the specified row. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_Sum (double &re, double &im) |
Computes the sum for the matrix. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_ColumnMean (const unsigned col, double &re, double &im) |
Computes the sample mean for the specified column. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_RowMean (const unsigned row, double &re, double &im) |
Computes the sample mean for the specified row. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_Mean (double &re, double &im) |
Computes the sample mean for the matrix. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_ColumnStdev (const unsigned col, double &value) |
Computes the sample standard deviation for the specified column. | |
bool | GetStats_RowStdev (const unsigned row, double &value) |
Computes the sample standard deviation for the specified row. | |
bool | GetStats_Stdev (double &value) |
Computes the sample standard deviation for the matrix. | |
bool | GetStats_ColumnVar (const unsigned col, double &value) |
Computes the sample variance for the specified column. | |
bool | GetStats_RowVar (const unsigned row, double &value) |
Computes the sample variance for the specified row. | |
bool | GetStats_Var (double &value) |
Computes the sample variance for the matrix. | |
bool | GetStats_ColumnNorm (const unsigned col, double &value) |
Computes the norm of the specified column. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ). | |
bool | GetStats_RowNorm (const unsigned row, double &value) |
Computes the norm of the specified row. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ). | |
bool | GetStats_Norm (double &value) |
Computes the norm of the matrix. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ). | |
bool | GetStats_ColumnRMS (const unsigned col, double &value) |
Computes the sample RMS value for the specified column. | |
bool | GetStats_RowRMS (const unsigned row, double &value) |
Computes the sample RMS value for the specified row. | |
bool | GetStats_RMS (double &value) |
Computes the sample RMS value for the matrix. | |
bool | GetStats_ColumnSkewness (const unsigned col, double &re, double &im) |
Computes the sample skewness value for the specified column. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_RowSkewness (const unsigned row, double &re, double &im) |
Computes the sample skewness value for the specified row. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_Skewness (double &re, double &im) |
Computes the sample skewness value for the matrix. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. | |
bool | GetStats_ColumnKurtosis (const unsigned col, double &re, double &im) |
Computes the sample kurtosis value for the specified column. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed). | |
bool | GetStats_RowKurtosis (const unsigned row, double &re, double &im) |
Computes the sample kurtosis value for the specified row. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed). | |
bool | GetStats_Kurtosis (double &re, double &im) |
Computes the sample kurtosis value for the matrix. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed). | |
bool | GetTrace (double &re, double &im) |
Computes the trace of M where M is a square matrix. / Trace = Sum of diagonal elements. / If the matrix is real, only the real value, re is set, im = 0. / If the matrix is complex, both re and im are set. /. | |
bool | GetDeterminant (double &re, double &im) |
Computes the determinatnt of the square matrix M. / If the matrix is real, only the real value, re is set, im = 0. / If the matrix is complex, both re and im are set. | |
bool | GetDiagonal (Matrix &DiagonalVector) |
Sets the diagonal elements of the matrix into DiagonalVector as a column vector. /. | |
bool | GetColumnMovAvg (const unsigned col, const unsigned lead, const unsigned lag, Matrix &MovAvg) |
Computes a moving average using N lead samples and M lagging samples / for the specified column and stores it in MovAvg. /. | |
bool | GetMovAvg (const unsigned lead, const unsigned lag, Matrix &MovAvg) |
Computes a moving average using N lead samples and M lagging samples / for the matrix and stores it in MovAvg. /. | |
bool | GetATAInverse (Matrix &InvATA) |
Computes: InvATA = inverse( transpose(A) * A ). Assumes this matrix is A. / e.g. Matrix A; Matrix InvATA; A = ...; bool result = A.GetATAInverse( InvATA ); /. | |
bool | GetLUFactorization (bool &isFullRank, Matrix &P, Matrix &L, Matrix &U) |
LU factorization. / Performs a factorization to produce a unit lower triangular matrix, L, / an upper triangular matrix, U, and permutation matrix P so that / P*X = L*U. / P, L and U are copmuted correctly if IsFullRank is set to true. / e.g. Matrix A; A = ...; bool isFullRank, Matrix L,U,P; bool result = A.GetLUFactorization( isFullRank, P, L, U ); /. | |
bool | GetLDLt (Matrix &L, Matrix &d, bool checkSymmetric=true) |
Lower x Diagonal x transpose(Lower): matrix factorization. This method avoids using square roots and can be used for any square, full rank, symmetrical matrix . | |
bool | GetUDUt (Matrix &U, Matrix &d, bool checkSymmetric=true) |
Upper x Diagonal x transpose(Upper): matrix factorization. This method avoids using square roots and can be used for any square, full rank, symmetrical matrix . | |
bool | GetIndexedValues (Matrix &RowIndex, Matrix &ColIndex, Matrix &Result) |
Retrieve the elements of the matrix specified by the index vectors. / The index vectors must be nx1 and preferably not complex. / /. | |
bool | SetIndexedValues (Matrix &RowIndex, Matrix &ColIndex, Matrix &SourceData) |
Set the elements of the matrix specified by the index vectors. The index vectors must be nx1 and preferably not complex. | |
bool | Find_EqualTo (Matrix &IndexVector, const unsigned col, const double value, const double tolerance=1e-12) |
bool | Find_EqualTo (Matrix &IndexVector, const unsigned col, const double value_re, const double value_im, const double tolerance) |
bool | Find_NotEqualTo (Matrix &IndexVector, const unsigned col, const double value, const double tolerance=1e-12) |
bool | Find_NotEqualTo (Matrix &IndexVector, const unsigned col, const double value_re, const double value_im, const double tolerance) |
bool | Find_LessThan (Matrix &IndexVector, const unsigned col, const double value) |
Set the index vector so that it contains are the indices of values that are less than the value specified from the column specified of this matrix. Complex values are compared in terms of magnitude (i.e. sqrt(re*re + im*im)). | |
bool | Find_MoreThan (Matrix &IndexVector, const unsigned col, const double value) |
Set the index vector so that it contains are the indices of values that are more than the value specified from the column specified of this matrix. Complex values are compared in terms of magnitude (i.e. sqrt(re*re + im*im)). | |
bool | Plot (const unsigned x_col, const unsigned y_col, const std::string bmpfilename="plot.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label="", const std::string units="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot one series, X vs Y. The i'th column (x-axis) vs j'th column (y-axis) of the Matrix directly to a compressed (run-length-encoded) bitamp. | |
bool | Plot (const unsigned x_col, const unsigned y_col_1, const unsigned y_col_2, const std::string bmpfilename="plot2.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label_1="", const std::string units_1="", const std::string series_label_2="", const std::string units_2="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot two series, X vs Y1, Y2 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp. | |
bool | Plot (const unsigned x_col, const unsigned y_col_1, const unsigned y_col_2, const unsigned y_col_3, const std::string bmpfilename="plot3.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label_1="", const std::string units_1="", const std::string series_label_2="", const std::string units_2="", const std::string series_label_3="", const std::string units_3="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot three series, X vs Y1, Y2, Y3 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp. | |
bool | Plot (const unsigned x_col, const unsigned y_col_1, const unsigned y_col_2, const unsigned y_col_3, const unsigned y_col_4, const std::string bmpfilename="plot4.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label_1="", const std::string units_1="", const std::string series_label_2="", const std::string units_2="", const std::string series_label_3="", const std::string units_3="", const std::string series_label_4="", const std::string units_4="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot four series, X vs Y1, Y2, Y3 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp. | |
bool | Plot (const unsigned x_col, const unsigned y_col_1, const unsigned y_col_2, const unsigned y_col_3, const unsigned y_col_4, const unsigned y_col_5, const std::string bmpfilename="plot5.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label_1="", const std::string units_1="", const std::string series_label_2="", const std::string units_2="", const std::string series_label_3="", const std::string units_3="", const std::string series_label_4="", const std::string units_4="", const std::string series_label_5="", const std::string units_5="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot five series, X vs Y1, Y2, Y3, Y4, Y5 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp. | |
bool | Plot (const unsigned x_col, const unsigned y_col_1, const unsigned y_col_2, const unsigned y_col_3, const unsigned y_col_4, const unsigned y_col_5, const unsigned y_col_6, const std::string bmpfilename="plot6.bmp", const std::string title="", const std::string xlabel="", const std::string ylabel="", const std::string series_label_1="", const std::string units_1="", const std::string series_label_2="", const std::string units_2="", const std::string series_label_3="", const std::string units_3="", const std::string series_label_4="", const std::string units_4="", const std::string series_label_5="", const std::string units_5="", const std::string series_label_6="", const std::string units_6="", const bool isXGridOn=true, const bool isYGridOn=true, const bool includeStats=true, const unsigned precisionStats=5, const unsigned plot_height_cm=8, const unsigned plot_width_cm=10) |
Plot six series, X vs Y1, Y2, Y3, Y4, Y5, Y6 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp. | |
std::string | GetMatrixComment () |
Retrieve the matrix comment string. The string will be empty if none is available. The matrix comment string is often the header line read when using ReadFromFile(). e.g. file.txt has: time(s) x(m) y(m) 1.0 20.0 30.0. | |
bool | TimeWindow (const unsigned timeColumn, const double startTime, const double duration, const double rolloverTime) |
Alter the matrix so that its data is within the startTime to the startTime+duration and compensate for any rollovers in the time system (e.g. GPS time in seconds rolls over at 604800.0 s). This function assumes that time is one of the matrix columns and requires this index, the timeColumn. | |
bool | TimeLimit (const unsigned timeColumn, const double startTime, const double endTime) |
Alter the matrix so that its data is within [startTime endTime]. This function assumes that time is one of the matrix columns and requires this index, the timeColumn. | |
Matrix | Column (const unsigned col) |
Return the column matrix specified by the column index. Returns (nrows x 1). | |
Matrix | Row (const unsigned row) |
Return the row matrix specified by the column index. Returns (ncols x 1). | |
Matrix | Transpose () |
Return the tranpose of the matrix. | |
Matrix | T () |
Return the tranpose of the matrix. | |
Matrix | Diagonal () |
Return the diagonal of the matrix as a vector. | |
Matrix | Inverse () |
Return the inverse of the matrix. | |
Matrix | Inv () |
Return the inverse of the matrix. | |
Matrix | FFT () |
Return the Fourier Transform of each column of the matrix. Power of two uses FFT, otherwise fast DFT. | |
Matrix | IFFT () |
Return the inverse Fourier Transform of each column of the matrix. Power of two uses IFFT, otherwise fast IDFT. | |
Matrix | FFT2 () |
Return the Two Dimensional Fourier Transform of the matrix. | |
Matrix | IFFT2 () |
Return the Two Dimensional Inverse Fourier Transform of the matrix. | |
Matrix | Real () |
Return the real part of the matrix. | |
Matrix | Imag () |
Return the imag part of the matrix. | |
Matrix | conj () |
Return the complex conjugate of the matrix. | |
Matrix | AddIdentity () |
Returns the matrix plus Identity. | |
Matrix | MinusIdentity () |
Returns the matrix minus Identity. | |
Matrix | IdentityMinusMe () |
Returns Identity minus the matrix. | |
Matrix | Negate () |
Returns the matrix * -1. This is more efficient than A *= -1. | |
bool | Hilbert (const unsigned N) |
Sets the matrix as the NxN hilbert matrix. H_ij = 1.0 / (i+j-1.0) for i=1:N, j=1:N. | |
Matrix | Sqrt () |
Return the square root of each element in the matrix. | |
Matrix | Exp () |
Return the exponent of each element in the matrix. | |
Matrix | Ln () |
Return the logarithm of each element in the matrix. | |
Matrix | cos () |
Return the cosine of each element in the matrix. | |
Matrix | acos () |
Return the arc-cosine of each element in the matrix. | |
Matrix | sin () |
Return the sine of each element in the matrix. | |
Matrix | asin () |
Return the arc-sine of each element in the matrix. | |
Matrix | tan () |
Return the tangent of each element in the matrix. | |
Matrix | atan () |
Return the arc-tangent of each element in the matrix. | |
Matrix | cosh () |
Return the hyperbolic cosine of each element in the matrix. | |
Matrix | acosh () |
Return the inverse hyperbolic cosine of each element in the matrix. | |
Matrix | sinh () |
Return the hyperbolic sine of each element in the matrix. | |
Matrix | asinh () |
Return the inverse hyperbolic sine of each element in the matrix. | |
Matrix | tanh () |
Return the hyperbolic tangent of each element in the matrix. | |
Matrix | atanh () |
Return the inverse hyperbolic tangent of each element in the matrix. | |
Matrix | cot () |
Return the cotangent of each element in the matrix. | |
Matrix | coth () |
Return the hyperbolic cotangent of each element in the matrix. | |
Matrix | abs () |
Return the absolute value (magnitude if complex) of each element in the matrix. | |
Matrix | angle () |
Return the phase angle in radians of the elements in the matrix. If M is a real matrix, Phase is a zero matrix. If M is a complex matrix, Phase is a real matrix = atan2(im,re). | |
Matrix | pow (const double power_re, const double power_im=0.0) |
Return a matrix with all elements in raised to the power X^(power_re + power_im*i). | |
Matrix | round (const unsigned precision) |
Return a matrix with elements rounded to the specified precision. e.g. precision = 0 1.8 -> 2 e.g. precision = 1, 1.45 -> 1.5 e.g. precision = 2 1.456 -> 1.46 e.g. precision = 3, 1.4566 -> 1.457 precision has a maximum of 32. After which no rounding occurs. | |
Matrix | floor () |
Return a matrix with elements rounded to the nearest integers towards minus infinity. | |
Matrix | ceil () |
Return a matrix with elements rounded to the nearest integers towards infinity. | |
Matrix | fix () |
Return a matrix with elements rounded to the nearest integers towards zero. | |
Matrix | dotInvert () |
Return a matrix with all elements inverted (1/x). | |
Matrix | oneMinusMe () |
Return a matrix with each element subtracted from 1.0. i.e. 1-X. | |
Matrix | DotMultiply (const Matrix &B) |
Return the matrix that has each element multiplied by each element of B. This matrix must be the same dimensions as B unless B is a scalar. | |
Element & | operator() (unsigned row, unsigned col) |
Get a reference to an element in the matrix to set or get its value. | |
Element & | operator() (unsigned index) |
Get a reference to an element in the matrix as a column or row vector to set or get its value. This can be used to access a matrix of (col,row), col = index/nrows, row = index/ncols. Matrix A(10); // The matrix is real with dimensions 10x1 A(0) = 10.0; // The matrix is real. stComplex cplx = {1.0,2.0}; A(1) = cplx; // The matrix is now complex with dimensions 10x1. | |
bool | operator+= (const int scalar) |
add a scaler int (shorthand notation: A += 5). | |
bool | operator+= (const float scalar) |
add a scaler float (shorthand notation: A += 5). | |
bool | operator+= (const double scalar) |
add a scaler double (shorthand notation: A += 5). | |
bool | operator+= (const std::complex< double > cplx) |
add a scaler complex (shorthand notation: A += (5+2i)). | |
bool | operator-= (const int scalar) |
subtract a scaler int (shorthand notation: A -= 5). | |
bool | operator-= (const float scalar) |
subtract a scaler float (shorthand notation: A -= 5). | |
bool | operator-= (const double scalar) |
subtract a scaler double (shorthand notation: A -= 5). | |
bool | operator-= (const std::complex< double > cplx) |
subtract a scaler complex (shorthand notation: A -= (5+2i)). | |
bool | operator *= (const int scalar) |
multiply a scalar int (shorthand notation: A *= 5). | |
bool | operator *= (const float scalar) |
multiply a scalar float (shorthand notation: A *= 5). | |
bool | operator *= (const double scalar) |
multiply a scalar double (shorthand notation: A *= 5). | |
bool | operator *= (const std::complex< double > cplx) |
multiply a scaler complex (shorthand notation: A *= (5+2i)). | |
bool | operator/= (const int scalar) |
divide a scalar int (shorthand notation: A /= 5). | |
bool | operator/= (const float scalar) |
divide a scalar float (shorthand notation: A /= 5). | |
bool | operator/= (const double scalar) |
divide a scalar double (shorthand notation: A /= 5). | |
bool | operator/= (const std::complex< double > cplx) |
divide a scaler complex (shorthand notation: A /= (5+2i)). | |
bool | operator+= (const Matrix &mat) |
add a matrix (shorthand notation: A += B). | |
bool | operator-= (const Matrix &mat) |
subtract a matrix (shorthand notation: A -= B). | |
RealOnlyAccess | operator[] (const unsigned row) |
Retrieve a copy of a RealOnlyAccess object which is then used for the second [] overload. | |
void | MatrixError (const char *error) |
Clear the matrix from memory and handle the error message. | |
void | MatrixError (const char *function, const char *error) |
Clear the matrix from memory and handle the error message. | |
Static Public Member Functions | |
static void | Treat1x1MatricesAsScalar (bool enable=true) |
This function enables or disables a global flag that forces single element matrices to be treated as scalars. This is enabled by default. | |
static bool | TimeMatch (Matrix &A, const unsigned timeColumnA, Matrix &B, const unsigned timeColumnB, const unsigned precision, const double rolloverTime) |
This static function matches matrices in time with specified precision where time is a column of each matrix. This function also allows time to rollover at a specified interval. | |
static bool | Interpolate (Matrix &A, const unsigned timeColumnA, Matrix &B, const unsigned timeColumnB, const double maxInterpolationInterval, const double rolloverTime) |
This static function interpolates Matrix B values by the times defined in the column in Matrix A. Time must be increasing but times can rollover with the specified rolloverTime. | |
static void | StaticMatrixError (const char *error) |
A static function to handle the error message. | |
static void | StaticMatrixError (const char *function, const char *error) |
A static function to handle the error message. | |
Protected Member Functions | |
bool | IndexCheck (const unsigned row, const unsigned col) |
Check the specified indices. Throw an exception if they are invalid. | |
bool | IndexCheck (const unsigned index) |
Check the specified index into the Matrix as a vector. Throw an exception if the index is invalid. | |
Protected Attributes | |
Element | m_MatrixElement |
A single element from the matrix. This is used for write access with operator(). | |
MTX | m_Matrix |
The deep level matrix container. | |
Static Protected Attributes | |
static bool | m_IsMTXInitialized = false |
This indicates if the mtx core engine been initialized. | |
Friends | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X, Matrix &Y, const std::string series_label, const std::string units, const bool isConnected, const MTX_enumColor color, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot a single X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X_1, Matrix &Y_1, const std::string series_label_1, const std::string units_1, Matrix &X_2, Matrix &Y_2, const std::string series_label_2, const std::string units_2, const bool isConnected_1, const MTX_enumColor color_1, const bool isConnected_2, const MTX_enumColor color_2, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot two X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X_1, Matrix &Y_1, const std::string series_label_1, const std::string units_1, Matrix &X_2, Matrix &Y_2, const std::string series_label_2, const std::string units_2, Matrix &X_3, Matrix &Y_3, const std::string series_label_3, const std::string units_3, const bool isConnected_1, const MTX_enumColor color_1, const bool isConnected_2, const MTX_enumColor color_2, const bool isConnected_3, const MTX_enumColor color_3, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot three X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X_1, Matrix &Y_1, const std::string series_label_1, const std::string units_1, Matrix &X_2, Matrix &Y_2, const std::string series_label_2, const std::string units_2, Matrix &X_3, Matrix &Y_3, const std::string series_label_3, const std::string units_3, Matrix &X_4, Matrix &Y_4, const std::string series_label_4, const std::string units_4, const bool isConnected_1, const MTX_enumColor color_1, const bool isConnected_2, const MTX_enumColor color_2, const bool isConnected_3, const MTX_enumColor color_3, const bool isConnected_4, const MTX_enumColor color_4, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot four X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X_1, Matrix &Y_1, const std::string series_label_1, const std::string units_1, Matrix &X_2, Matrix &Y_2, const std::string series_label_2, const std::string units_2, Matrix &X_3, Matrix &Y_3, const std::string series_label_3, const std::string units_3, Matrix &X_4, Matrix &Y_4, const std::string series_label_4, const std::string units_4, Matrix &X_5, Matrix &Y_5, const std::string series_label_5, const std::string units_5, const bool isConnected_1, const MTX_enumColor color_1, const bool isConnected_2, const MTX_enumColor color_2, const bool isConnected_3, const MTX_enumColor color_3, const bool isConnected_4, const MTX_enumColor color_4, const bool isConnected_5, const MTX_enumColor color_5, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot five X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
bool | Plot (const std::string bmpfilename, const std::string title, const std::string xlabel, const std::string ylabel, Matrix &X_1, Matrix &Y_1, const std::string series_label_1, const std::string units_1, Matrix &X_2, Matrix &Y_2, const std::string series_label_2, const std::string units_2, Matrix &X_3, Matrix &Y_3, const std::string series_label_3, const std::string units_3, Matrix &X_4, Matrix &Y_4, const std::string series_label_4, const std::string units_4, Matrix &X_5, Matrix &Y_5, const std::string series_label_5, const std::string units_5, Matrix &X_6, Matrix &Y_6, const std::string series_label_6, const std::string units_6, const bool isConnected_1, const MTX_enumColor color_1, const bool isConnected_2, const MTX_enumColor color_2, const bool isConnected_3, const MTX_enumColor color_3, const bool isConnected_4, const MTX_enumColor color_4, const bool isConnected_5, const MTX_enumColor color_5, const bool isConnected_6, const MTX_enumColor color_6, const bool isXGridOn, const bool isYGridOn, const bool includeStats, const unsigned precisionStats, const unsigned plot_height_cm, const unsigned plot_width_cm) |
Plot six X vs Y series directly to a compressed (run-length-encoded) bitmap file. | |
Matrix | operator++ (Matrix &mat, int) |
The postfix ++ operator overload. Add +1.0 to all elements and returns matrix values after the increment, e.g. Matrix B = A++. Use Inplace_Increment for a boolean return for safer operation. | |
Matrix | operator-- (Matrix &mat, int) |
The postfix -- operator overload. Subtract 1.0 to all elements and returns matrix values after the increment, e.g. Matrix B = A--. Use Inplace_Decrement for a boolean return for safer operation. | |
Matrix | operator * (const Matrix &mat1, const Matrix &mat2) |
Multiply two matrices and copy the result. Result = mat1 * mat2. | |
Matrix | operator * (Matrix &mat1, Matrix &mat2) |
Multiply two matrices and copy the result. Result = mat1 * mat2. | |
Matrix | operator+ (Matrix &mat1, Matrix &mat2) |
Add two matrices and copy the result. Result = mat1 + mat2. | |
Matrix | operator+ (const Matrix &mat1, const Matrix &mat2) |
Add two matrices and copy the result. Result = mat1 + mat2. | |
Matrix | operator- (Matrix &mat1, Matrix &mat2) |
Subtract two matrices and copy the result. Result = mat1 - mat2. | |
Matrix | operator- (const Matrix &mat1, const Matrix &mat2) |
Subtract two matrices and copy the result. Result = mat1 - mat2. | |
Matrix | operator^ (Matrix &mat, const int scalar) |
Raise all matrix elements to the power scalar. | |
Matrix | operator^ (Matrix &mat, const float scalar) |
Raise all matrix elements to the power scalar. | |
Matrix | operator^ (Matrix &mat, const double scalar) |
Raise all matrix elements to the power scalar. | |
Matrix | operator+ (const double scalar, Matrix &mat) |
Add to a matrix by a scalar variable: ie. A = 2.0 + B and B + 2.0 (adds to 2.0 to all elements). | |
Matrix | operator- (Matrix &mat, const double scalar) |
Subtract from a matrix by a scalar variable: ie. A = B - 2.0. | |
Matrix | operator- (const double scalar, Matrix &mat) |
Subtract a matrix from a scalar variable: ie. A = 2.0 - B == -B + 2.0. | |
Matrix | operator * (const double scalar, Matrix &mat) |
Multiply matrix by a scalar variable: A = 2.0 * B and A = B * 2.0. | |
Matrix | operator/ (Matrix &mat, const double scalar) |
Divide matrix by a scalar variable: A = B / 2.0. | |
Matrix | operator/ (const double scalar, Matrix &mat) |
Divide matrix into a scalar variable: A = 2.0 / B. e.g. A = [2.0 2.0; 2.0 2.0] / B, B is 2x2. | |
Data Structures | |
class | Element |
This is a nested class that is an element of the matrix. i.e. Matrix M; M(i,j) is the element. It is used for operator(,) access by the Matrix. More... | |
class | RealOnlyAccess |
A nested class for access only to the real part of the matrix. It is used for operator[] access by the Matrix. More... |
Zenautics::Matrix::Matrix | ( | ) |
Zenautics::Matrix::Matrix | ( | const unsigned | nrows | ) | [explicit] |
A vector style constructor.
Matrix A(nrows); creates an nrowsx1 real 'vector'. A complex vector must be created using Matrix A(nrows,ncols,false);
Definition at line 185 of file Matrix.cpp.
Zenautics::Matrix::Matrix | ( | const unsigned | nrows, | |
const unsigned | ncols, | |||
const bool | isReal = true | |||
) |
A matrix style constructor.
Matrix A(nrows,ncols); creates an nrowsxncols real 'matrix'. A real matrix is assumed. Matrix A(nrows,ncols,false); creates an nrowsxncols complex 'matrix'. A real matrix is assumed.
Definition at line 216 of file Matrix.cpp.
Zenautics::Matrix::Matrix | ( | const Matrix & | mat | ) |
Zenautics::Matrix::Matrix | ( | const char * | path, | |
bool & | itWorked | |||
) |
Zenautics::Matrix::Matrix | ( | const char * | strMatrix | ) |
A constructor initialized the matrix from a string.
There are two general possible interpretations of the string input.
(1) Square bracket delimited matrix. e.g.
In this case '[' donates the start of a matrix and ']' denotes the end.
Row vectors [1 2 3] and [4 5 6] are separated by ';'.
Commas can delimit row vector data but are not needed.
Complex input: e.g.
(2) Free form delimited matrix. e.g.
Matrix A = "1 2 3 \\n 4 5 6 \\n";
In this case, the newline delimits different rows of the matrix. (\r\n also works).
Row vectors can still be delimited by ';' as well.
Matrix B = "1 2 3; 4 5 6; \\n 7 8 9";
will set a 3x3 matrix == [1 2 3; 4 5 6; 7 8 9].
Commas can delimit row vector data but are not needed.
Complex input: e.g.
Matrix A = "[1+1i 2+3j 1-2i\\n 4 5 6]"; // or Matrix A = "1+1i, 2+3j, 1-2i\\n 4, 5, 6"; // or Matrix A = "1+1i 2+3j 1-2i; 4, 5, 6";
All result in A = [1+1i 2+3i 1-2i; 4 5 6];
Definition at line 305 of file Matrix.cpp.
Zenautics::Matrix::Matrix | ( | const double | mat[], | |
const unsigned | nrows, | |||
const unsigned | ncols = 1 | |||
) |
Zenautics::Matrix::~Matrix | ( | ) | [virtual] |
static void Zenautics::Matrix::Treat1x1MatricesAsScalar | ( | bool | enable = true |
) | [static] |
This function enables or disables a global flag that forces single element matrices to be treated as scalars. This is enabled by default.
The assignment operator from another matrix.
e.g. Matrix B; Matrix A; B = "[1 2 3; 4 5 6]"; A = B; // A == [1 2 3; 4 5 6], A is (2x3)
Definition at line 317 of file Matrix.cpp.
Matrix & Zenautics::Matrix::operator= | ( | const double | value | ) |
The assignment operator from a scalar double value.
e.g. Matrix A; A = 2.0; // A is (1x1).
Definition at line 332 of file Matrix.cpp.
Matrix & Zenautics::Matrix::operator= | ( | const std::complex< double > | value | ) |
The assignment operator from a std::complex<double> value.
e.g. Matrix A; A = 2.0; // A is (1x1).
Definition at line 347 of file Matrix.cpp.
Matrix & Zenautics::Matrix::operator= | ( | const char * | strMatrix | ) |
The assignement operator from a string matrix.
There are two general possible interpretations of the string input.
(1) Square bracket delimited matrix. e.g.
Matrix A; A = "[1 2 3; 4 5 6]"; // or A = "[1, 2, 3; 4, 5, 6]";
In this case '[' donates the start of a matrix and ']' denotes the end.
Row vectors [1 2 3] and [4 5 6] are separated by ';'.
Commas can delimit row vector data but are not needed.
Complex input: e.g.
Matrix A; A = "[1+1i 2+3j 1-2i; 4 5 6]"; // or A = "[1+1i, 2+3j, 1-2i; 4, 5, 6]";
(2) Free form delimited matrix. e.g.
Matrix A; A = "1 2 3 \\n 4 5 6 \\n";
In this case, the newline delimits different rows of the matrix. (\r\n also works).
Row vectors can still be delimited by ';' as well.
B = "1 2 3; 4 5 6; \\n 7 8 9";
will set a 3x3 matrix == [1 2 3; 4 5 6; 7 8 9].
Commas can delimit row vector data but are not needed.
Complex input: e.g.
Matrix A; A = "[1+1i 2+3j 1-2i\\n 4 5 6]"; // or A = "1+1i, 2+3j, 1-2i\\n 4, 5, 6"; // or A = "1+1i 2+3j 1-2i; 4, 5, 6";
All result in A = [1+1i 2+3i 1-2i; 4 5 6];
Definition at line 362 of file Matrix.cpp.
bool Zenautics::Matrix::Clear | ( | ) |
Clear the matrix memory. Set the matrix to size 0x0.
Matrix A(10,10); // A 10 x 10 matrix if( !A.Clear() ) return false; // A is now 0x0
Definition at line 371 of file Matrix.cpp.
bool Zenautics::Matrix::isEmpty | ( | ) | const |
bool Zenautics::Matrix::isConformal | ( | const Matrix & | mat | ) | const |
Is the matrix mat conformal for multiplication (*this * mat)?
Definition at line 446 of file Matrix.cpp.
bool Zenautics::Matrix::isSameSize | ( | const Matrix & | mat | ) | const |
bool Zenautics::Matrix::isSquare | ( | ) | const |
bool Zenautics::Matrix::isStoredAsComplex | ( | ) |
bool Zenautics::Matrix::isReal | ( | ) |
Check if this a real matrix.
Is this a real matrix for accessing by (row,col) operator? e.g. double d = A(0,4).
Definition at line 642 of file Matrix.cpp.
bool Zenautics::Matrix::isComplex | ( | ) |
Check if this a complex matrix.
Is this a complex matrix for accessing by [row][col] operators? e.g. stComplex d = A[0][4].
Definition at line 656 of file Matrix.cpp.
bool Zenautics::Matrix::isVector | ( | ) |
Check if this is a vector. Is the matrix either nx1 or 1xn.
Definition at line 661 of file Matrix.cpp.
unsigned Zenautics::Matrix::GetNrCols | ( | ) | const |
unsigned Zenautics::Matrix::ncols | ( | ) | const |
unsigned Zenautics::Matrix::GetNrElems | ( | ) | const |
unsigned Zenautics::Matrix::nelems | ( | ) | const |
unsigned Zenautics::Matrix::GetNrRows | ( | ) | const |
unsigned Zenautics::Matrix::nrows | ( | ) | const |
unsigned Zenautics::Matrix::GetLength | ( | ) | const |
return the maximum dimension either nrows or ncols whichever is greater.
Definition at line 515 of file Matrix.cpp.
double Zenautics::Matrix::real | ( | const unsigned | row, | |
const unsigned | col | |||
) |
Return the real part of the matrix at this row and column.
Matrix A = "2+4i"; double a = A.real(0,0); // a is 2.0
Definition at line 523 of file Matrix.cpp.
double Zenautics::Matrix::real | ( | const unsigned | index | ) |
Return the real part of the matrix at this vector index.
Matrix A = "[2+4i, 10-1i]"; double a = A.real(1); // a is 10.0
Definition at line 542 of file Matrix.cpp.
double Zenautics::Matrix::imag | ( | const unsigned | row, | |
const unsigned | col | |||
) |
Return the imaginary part of the matrix at this row and column.
Matrix B = "2+4i"; double b = B.imag(0); // b is 4.0
Definition at line 578 of file Matrix.cpp.
double Zenautics::Matrix::imag | ( | const unsigned | index | ) |
Return the imaginary part of the matrix at this vector index.
Matrix B = "[2+4i, 1-10i]"; double b = B.imag(1); // b is -10.0
Definition at line 597 of file Matrix.cpp.
bool Zenautics::Matrix::ReadFromFile | ( | const char * | path | ) |
Read the matrix from an ASCII file with the path given by the 'c' style string (with automatric support for many delimiters, whitespace, or ',', or ';', or many others) or a compressed BINARY matrix file used in the Save function. Complex and real data input are supported. A non-numeric header line can be present which will be skipped.
Matrix A; Matrix B; Matrix C; bool result; result = A.ReadFromFile("data.txt"); // Read an ASCII numeric data file. result = B.ReadFromFile("data.csv"); // Read a comma delimited numeric data file. e.g. saved from EXCEL. result = C.ReadFromFile("data.mtx"); // Read a compressed binary matrix (MTX format).
Definition at line 672 of file Matrix.cpp.
bool Zenautics::Matrix::ReadFromFile | ( | std::string | path | ) |
Read the matrix from a file given the file path as a standard string.
Matrix A; std::string str = "data.txt"; if( !A.ReadFromFile(str) ) return false;
Definition at line 686 of file Matrix.cpp.
bool Zenautics::Matrix::Copy | ( | Matrix & | src | ) |
A safe function for performing a copy of another matrix.
Matrix A(2,2); A[0][0] = 1.0; A[0][1] = 2.0; A[1][0] = 3.0; A[1][1] = 4.0; Matrix B; if( !B.Copy(A) ) return false;
Definition at line 692 of file Matrix.cpp.
bool Zenautics::Matrix::Copy | ( | const double & | value | ) |
A safe function for setting the matrix from a double.
double d = 10.0; Matrix A; if( !A.Copy(d) ) return false;
Definition at line 705 of file Matrix.cpp.
bool Zenautics::Matrix::Copy | ( | const std::complex< double > & | cplx | ) |
A safe function for setting the matrix from a std::complex<double>.
std::complex<double> cplx(1.0,2.0); Matrix A; if( !A.Copy(cplx) ) return false;
Definition at line 724 of file Matrix.cpp.
bool Zenautics::Matrix::Save | ( | const char * | path | ) |
Saves a matrix to the specified file path (a 'c' style string) using a proprietary compressed format.
Matrix A; A = "[1,2,3; 4,5,6; 7,8,9]"; if( !A.Save("data.mtx" ) ) return false;
Definition at line 743 of file Matrix.cpp.
bool Zenautics::Matrix::Save | ( | std::string | path | ) |
Saves a matrix to the specified file path (a std::string) using a proprietary compressed format.
Matrix A; std::string str = "data.mtx"; A = "[1,2,3; 4,5,6; 7,8,9]"; if( !A.Save(str) ) return false;
Definition at line 756 of file Matrix.cpp.
bool Zenautics::Matrix::Print | ( | const char * | path, | |
const unsigned | precision = 9 , |
|||
bool | append = false | |||
) |
Print the matrix to a file with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'", to the 'c' style path string provided.
A = "[1,2,3; 4,5,6; 7,8,9]"; if( !A.Print( "data.txt", 14 ) ) // Print the matrix to data.txt return false;
Definition at line 761 of file Matrix.cpp.
bool Zenautics::Matrix::Print | ( | std::string | path, | |
const unsigned | precision, | |||
bool | append = false | |||
) |
Print the matrix to a file with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'", to the std:string path provided.
A = "[1,2,3; 4,5,6; 7,8,9]"; std::string str = "data.txt"; if( !A.Print( str, 14 ) ) // Print the matrix to data.txt return false;
Definition at line 774 of file Matrix.cpp.
bool Zenautics::Matrix::PrintStdout | ( | const unsigned | precision = 6 |
) |
Print the matrix to the standard output (stdout) with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'".
Matrix A; A = "[1.123 0 2.123 -1; 3.123 0 4.123 -1]"; // Set A using string notation. bool result = A.PrintStdout(6); // Print to stdout with automatic width determination. // results in: // 0123456789012345678901234567890 // 1.123 0 2.123 -1 // 3.123 0 4.123 -1
Definition at line 779 of file Matrix.cpp.
bool Zenautics::Matrix::PrintToBuffer | ( | char * | buffer, | |
const unsigned | maxlength, | |||
const unsigned | precision | |||
) |
Print the matrix to a buffer of maxlength with automatically determined column width and the specified precision, uses "%'blank''-'autowidth.precision'g'".
Matrix A; A = "[1.123 0 2.123 -1; 3.123 0 4.123 -1]"; // Set A using string notation. char buffer[256]; bool result = A.PrintToBuffer( buffer, 256, 6); // Print to a buffer with automatic width determination. cout << buffer << endl; // results in: // 0123456789012345678901234567890 // 1.123 0 2.123 -1 // 3.123 0 4.123 -1
Definition at line 797 of file Matrix.cpp.
bool Zenautics::Matrix::PrintFixedWidth | ( | const char * | path, | |
const unsigned | width, | |||
const unsigned | precision, | |||
bool | append = false | |||
) |
Print the matrix to a file with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'" to file specified with the 'c' style path string provided.
Matrix A; A = "[1.123 0 2.123 -1; 3.123 0 4.123 -1]"; // Set A using string notation. if( !A.PrintFixedWidth( "data.txt", 6, 3 ) ) return false; // results in: data.txt with // 0123456789012345678901234567890 // 1.123 0 2.123 -1 // 3.123 0 4.123 -1
Definition at line 810 of file Matrix.cpp.
bool Zenautics::Matrix::PrintFixedWidth | ( | std::string | path, | |
const unsigned | width, | |||
const unsigned | precision, | |||
bool | append = false | |||
) |
Print the matrix to a file with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'" to file specified with the std::string path string provided.
Matrix A; A = "[1.123 0 2.123 -1; 3.123 0 4.123 -1]"; // Set A using string notation. std::string str = "data.txt"; if( !A.PrintFixedWidth( str, 6, 3 ) ) return false; // results in: data.txt with // 0123456789012345678901234567890 // 1.123 0 2.123 -1 // 3.123 0 4.123 -1
Definition at line 823 of file Matrix.cpp.
bool Zenautics::Matrix::PrintFixedWidthToBuffer | ( | char * | buffer, | |
const unsigned | maxlength, | |||
const unsigned | width, | |||
const unsigned | precision | |||
) |
Print the matrix to a buffer of maxlength with specifed width and precision PrintAutoWidth is recommended over this function, "%'blank''-'width.precision'g'".
Matrix A; A = "[1.123 2.123 -1; 3.123 4.123 -1]"; // Set A using string notation. char buffer[256]; bool result = A.PrintFixedWidthToBuffer( buffer, 256, 10, 6 ); // Print to a buffer with fixed width. cout << buffer << endl; // results in: // 0123456789012345678901234567890 // 1.123 2.123 -1 // 3.123 4.123 -1
Definition at line 828 of file Matrix.cpp.
bool Zenautics::Matrix::PrintDelimited | ( | const char * | path, | |
const unsigned | precision, | |||
const char | delimiter, | |||
bool | append = false | |||
) |
Print the matrix to a file path specified by the 'c' style string with specifed precision and delimiter.
Matrix A; A = "[1.123 2.123 -1; 3.123 4.123 -1]"; // Set A using string notation. if( !A.PrintDelimited( "data.csv", 5, ',' ) ) return false; // results in: data.csv with // 0123456789012345678901234567890 // 1.123,2.123,-1 // 3.123,4.123,-1
Definition at line 841 of file Matrix.cpp.
bool Zenautics::Matrix::PrintDelimited | ( | std::string | path, | |
const unsigned | precision, | |||
const char | delimiter, | |||
bool | append = false | |||
) |
Print the matrix to a file path specified by the std::string with specifed precision and delimiter.
Matrix A; A = "[1.123 2.123 -1; 3.123 4.123 -1]"; // Set A using string notation. std::string str = "data.csv"; if( !A.PrintDelimited( str, 5, ',' ) ) return false; // results in: data.csv with // 0123456789012345678901234567890 // 1.123,2.123,-1 // 3.123,4.123,-1
Definition at line 854 of file Matrix.cpp.
bool Zenautics::Matrix::PrintDelimitedToBuffer | ( | char * | buffer, | |
const unsigned | maxlength, | |||
const unsigned | precision, | |||
const char | delimiter | |||
) |
Print the matrix to a 'c' style string buffer of maxlength with specifed precision and delimiter.
Matrix A; A = "[1.123 2.123; 3.123 4.123]"; // Set A using string notation. char buffer[256]; if( !A.PrintDelimitedToBuffer( buffer, 256, 6, ',' ) ) // Print to a buffer using comma delimiters. return false; cout << buffer << endl; // results in: // 1.123,2.123 // 3.123,4.123
Definition at line 860 of file Matrix.cpp.
bool Zenautics::Matrix::PrintRowToString | ( | const unsigned | row, | |
char * | buffer, | |||
const unsigned | maxlength, | |||
const int | width, | |||
const int | precision | |||
) |
Print a row to a 'c' style string buffer.
Matrix A; A = "[1.123 2.123; 3.123 4.123]"; // Set A using string notation. char buffer[256]; if( !A.PrintRowToString( 1, buffer, 256, 4, 6 ) ) // Print the second row to the char buffer. return false; cout << buffer << endl; // results in: // 3.123 4.123
Definition at line 873 of file Matrix.cpp.
bool Zenautics::Matrix::RemoveColumn | ( | const unsigned | col | ) |
Remove a single column from the matrix.
Matrix A; A = "[1.123 0 2.123; 3.123 0 4.123]"; // Set A using string notation. if( !A.RemoveColumn(1) ) // Remove the column with the zeros return false; // results in // A // 1.123 2.123 // 3.123 4.123
Definition at line 887 of file Matrix.cpp.
bool Zenautics::Matrix::RemoveColumnsAfterIndex | ( | const unsigned | col | ) |
Remove all the columns 'after' the column index given.
Matrix A; A = "[1.123 0 2.123; 3.123 0 4.123]"; // Set A using string notation. if( !A.RemoveColumnsAfterIndex(0) ) // Remove the 2nd and 3rd columns, i.e. after the 0th column. return false; // results in // A // 1.123 // 3.123
Definition at line 900 of file Matrix.cpp.
bool Zenautics::Matrix::RemoveRowsAndColumns | ( | const unsigned | nrows, | |
const unsigned | rows[], | |||
const unsigned | ncols, | |||
const unsigned | cols[] | |||
) |
Remove the rows and columns specified by the indices in the rows[] and cols[] arrays.
Matrix A(4,4); unsigned rows[2]; unsigned cols[2]; rows[0] = 0; // remove row 0 rows[1] = 2; // remove row 2 cols[0] = 0; // remove column 0 cols[1] = 2; // romve column 2 A.RemoveRowsAndColumns( 2, (unsigned int *)rows, 2, (unsigned int *)cols ); // A is now a 2x2 matrix
Definition at line 913 of file Matrix.cpp.
bool Zenautics::Matrix::InsertColumn | ( | const Matrix & | src, | |
const unsigned | dst_col, | |||
const unsigned | src_col | |||
) |
Insert a column matrix into the matrix.
Matrix A; Matrix B(2,2); A = "[1.123 2.123; 3.123 4.123]"; // Set A using string notation. if( !A.InsertColumn( B, 1, 1 ) ) // Insert second column of B into the second column a A. return false; // results in: // A (2x3) // 1.123 0 2.123 // 3.123 0 4.123
Definition at line 926 of file Matrix.cpp.
bool Zenautics::Matrix::AddColumn | ( | const Matrix & | src, | |
const unsigned | src_col | |||
) |
Add a column to the end of the matrix.
Matrix A; atrix B(2,2); A = "[1.123 2.123; 3.123 4.123]"; // Set A using string notation. if( !A.AddColumn( B, 1 ) ) // Add second column of B to A. return false; // results in: // A (2x3) // 1.123 2.123 0 // 3.123 4.123 0
Definition at line 939 of file Matrix.cpp.
bool Zenautics::Matrix::Concatonate | ( | const Matrix & | src | ) |
Combine two matrices with the same nrows, A becomes A|B.
Matrix A; atrix B(2,2); A = "[1.123 2.123; 3.123 4.123]"; // Set A using string notation. if( !A.Concatonate( B ) ) // make A = A | B return false; // results in: // A (2x4) // 1.123 2.123 0 0 // 3.123 4.123 0 0
Definition at line 952 of file Matrix.cpp.
bool Zenautics::Matrix::Redim | ( | const unsigned | nrows, | |
const unsigned | ncols = 1 | |||
) |
Redimension the matrix, original data is saved in place, new data is set to zero. The default value for ncols allows redimensioning as a vector.
Matrix A(4,4); // A is 4x4 A[0][0] = 1; A[1][1] = -1; if( !A.Redim(2,2) ) // A is 2x2 but data values are retained. return false; // results in: // A (2x2) // 1 0 // 0 -1 Matrix B(10); // B is a vector with length 10. B[0] = -1; B[1] = 1; if( !B.Redim(2) ) // B is a vector with length 2 but data values are retained return false; // results in: // B // -1 // 1
Definition at line 965 of file Matrix.cpp.
bool Zenautics::Matrix::Resize | ( | const unsigned | nrows, | |
const unsigned | ncols = 1 | |||
) |
Resize the matrix, original data is lost, new data is set to zero. The default value for ncols allows resizing as a vector.
Matrix A(4,4); // A is 4x4 A[0][0] = 1; A[1][1] = -1; if( !A.Resize(2,2) ) // A is 2x2 and zero. return false; // results in: // A (2x2) // 0 0 // 0 0 Matrix B(10); // B is a vector with length 10. B[0] = -1; B[1] = 1; if( !B.Resize(2) ) // B is a vector with length 2 and is zero. return false; // results in: // B // 0 // 0
Definition at line 978 of file Matrix.cpp.
bool Zenautics::Matrix::SetFromStaticMatrix | ( | const double | mat[], | |
const unsigned | nrows, | |||
const unsigned | ncols | |||
) |
Set the matrix from the static 'c' style matrix indexed by mat[i*ncols + j].
Matrix A; double data[4] = {1.0,2.0,3.0,4.0}; if( !A.SetFromStaticMatrix( data, 1, 4 ) ) return false; \\ results in \\ A \\ 1.0 2.0 3.0 4.0 if( !A.SetFromStaticMatrix( data, 2, 2 ) ) return false; \\ results in \\ A \\ 1.0 2.0 \\ 3.0 4.0
Definition at line 992 of file Matrix.cpp.
bool Zenautics::Matrix::SetFromMatrixString | ( | const char * | strMatrix | ) |
Setting the matrix values from a string matrix.
There are two general possible interpretations of the string input.
(1) Square bracket delimited matrix. e.g.
Matrix A; A.SetFromMatrixString( "[1 2 3; 4 5 6]" ); // or A.SetFromMatrixString( "[1, 2, 3; 4, 5, 6]" );
In this case '[' donates the start of a matrix and ']' denotes the end.
Row vectors [1 2 3] and [4 5 6] are separated by ';'.
Commas can delimit row vector data but are not needed.
Complex input: e.g.
Matrix A; A.SetFromMatrixString( "[1+1i 2+3j 1-2i; 4 5 6]" ); // or A.SetFromMatrixString( "[1+1i, 2+3j, 1-2i; 4, 5, 6]" );
(2) Free form delimited matrix. e.g.
Matrix A; A.SetFromMatrixString( "1 2 3 \\n 4 5 6 \\n" );
In this case, the newline delimits different rows of the matrix. (\r\n also works).
Row vectors can still be delimited by ';' as well.
A.SetFromMatrixString( "1 2 3; 4 5 6; \\n 7 8 9" );
will set a 3x3 matrix == [1 2 3; 4 5 6; 7 8 9].
Commas can delimit row vector data but are not needed.
Complex input: e.g.
Matrix A; A.SetFromMatrixString( "[1+1i 2+3j 1-2i\\n 4 5 6]" ); // or A.SetFromMatrixString( "1+1i, 2+3j, 1-2i\\n 4, 5, 6" ); // or A.SetFromMatrixString( "1+1i 2+3j 1-2i; 4, 5, 6" );
All result in A = [1+1i 2+3i 1-2i; 4 5 6];
Definition at line 1005 of file Matrix.cpp.
bool Zenautics::Matrix::CopyColumn | ( | const unsigned | src_col, | |
Matrix & | dst | |||
) |
Copy the src data in column col to dst matrix, resize dst if possible and necessary.
Matrix A; A = "[1 -1; 2 -2; 3 -3]". Matrix B; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.CopyColumn(0,B); // Copy the first column of A into B. result = B.PrintStdout(); // Print Matrix B. B = [1;2;3];
Definition at line 1018 of file Matrix.cpp.
bool Zenautics::Matrix::InsertSubMatrix | ( | const Matrix & | src, | |
const unsigned | dst_row, | |||
const unsigned | dst_col | |||
) |
Insert a submatrix (src) into dst, starting at indices dst(row,col).
Matrix A(4,4); // A 4x4 matrix of zeros. Matrix B(2,2); // A 2x2 matrix that we will fill with sevens. B.Fill(7.0); bool result; result = A.PrintStdout(); // Print Matrix A. result = A.InsertSubMatrix(B,1,1); // Put B in the middle of A. result = A.PrintStdout(); // Print Matrix A. A = [0 0 0 0; 0 7 7 0; 0 7 7 0; 0 0 0 0].
Definition at line 1031 of file Matrix.cpp.
bool Zenautics::Matrix::ExtractSubMatrix | ( | Matrix & | dst, | |
const unsigned | from_row, | |||
const unsigned | from_col, | |||
const unsigned | to_row, | |||
const unsigned | to_col | |||
) |
Extract a submatrix (dst) from this matrix from (inclusive) the rows and columns specified.
Matrix A = "[1 2 3; 4 5 6; 7 8 9]"; Matrix B; bool result = A.ExtractSubMatrix( B, 1, 0, 2, 2 ); // B == [4 5 6; 7 8 9]
dst | The destination matrix to contain the submatrix. |
from_row | The zero-based index for the from row. |
from_col | The zero-based index for the from column. |
to_row | The zero-based index for the to row. |
to_col | The zero-based index for the to column. |
Definition at line 1044 of file Matrix.cpp.
bool Zenautics::Matrix::Zero | ( | ) |
Zero the entire matrix.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Zero(); // Set A back to zeros. result = A.PrintStdout(); // Print Matrix A. A = [0 0 0; 0 0 0; 0 0 0].
Definition at line 1063 of file Matrix.cpp.
bool Zenautics::Matrix::ZeroColumn | ( | const unsigned | col | ) |
Zero all elements in a specified column.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.ZeroColumn(1); // Set the second column of A back to zeros. result = A.PrintStdout(); // Print Matrix A. A = [1 0 3; 4 0 6; 7 0 9].
Definition at line 1076 of file Matrix.cpp.
bool Zenautics::Matrix::ZeroRow | ( | const unsigned | row | ) |
Zero all elements in a specified row.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.ZeroRow(1); // Set the second row of A back to zeros. result = A.PrintStdout(); // Print Matrix A. A = [1 2 3; 0 0 0; 7 8 9].
Definition at line 1089 of file Matrix.cpp.
bool Zenautics::Matrix::Swap | ( | Matrix & | M | ) |
Efficiently swaps the contents of this matrix with matrix M. The contents are exhanged without the need to copy matrix data.
Matrix A = "[1 2 3; 4 5 6; 7 8 9]"; Matrix B = "[1 2; 3 4]"; bool result; result = A.Swap(B); result = A.PrintStdout(); // Print Matrix A. A = [1 2; 3 4] result = B.PrintStdout(); // Print Matrix B. B = [1 2 3; 4 5 6; 7 8 9]
Definition at line 1102 of file Matrix.cpp.
bool Zenautics::Matrix::Fill | ( | const double | value | ) |
Fill the matrix with the given value.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Fill(7); // Fill the matrix with 7.0. result = A.PrintStdout(); // Print Matrix A. A = [7 7 7; 7 7 7; 7 7 7].
Definition at line 1114 of file Matrix.cpp.
bool Zenautics::Matrix::FillColumn | ( | const unsigned | col, | |
const double | value | |||
) |
Fill the matrix column with the given value.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.FillColumn(1,7); // Fill the second column with 7.0. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 7 3; 4 7 6; 7 7 9].
Definition at line 1127 of file Matrix.cpp.
bool Zenautics::Matrix::FillRow | ( | const unsigned | row, | |
const double | value | |||
) |
Fills the matrix row with the given value.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.FillRow(1,7); // Fill the second row with 7.0. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 2 3; 7 7 7; 7 8 9].
Definition at line 1140 of file Matrix.cpp.
bool Zenautics::Matrix::FlipColumn | ( | const unsigned | col | ) |
Reverse the order of elements of a column.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.FlipColumn(1); // Flip the second column. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 8 3; 4 5 6; 7 2 9].
Definition at line 1153 of file Matrix.cpp.
bool Zenautics::Matrix::FlipRow | ( | const unsigned | row | ) |
Reverse the order of elements of a row.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.FlipRow(1); // Flip the second row. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 2 3; 6 5 4; 7 8 9].
Definition at line 1166 of file Matrix.cpp.
bool Zenautics::Matrix::Identity | ( | ) |
Set the matrix to identity using the current dimensions.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Identity(); // Set A to identity. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 0 0; 0 1 0; 0 0 1].
Definition at line 1179 of file Matrix.cpp.
bool Zenautics::Matrix::Identity | ( | const unsigned | dimension | ) |
Set the matrix to identity using the specified dimension (nxn).
Matrix A; bool result; result = A.Identity(3); // Set A to identity, 3x3. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 0 0; 0 1 0; 0 0 1].
Definition at line 1192 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Transpose | ( | ) |
Transpose the matrix as an inplace operation.
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_Transpose(); // Make A = transpose(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = [1 4 7; 2 5 8; 3 6 9].
Definition at line 1213 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Round | ( | const unsigned | precision = 0 |
) |
Round the matrix elements to the specified presision.
e.g. precision = 0 1.8 -> 2 (default)
e.g. precision = 1, 1.45 -> 1.5
e.g. precision = 2 1.456 -> 1.46
e.g. precision = 3, 1.4566 -> 1.457
.
Matrix A; A = "[1.09 2.08 3.07; 4.06 5.05 6.04; 7.03 8.02 9.01]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_Round(1); // Make A = round(A) to the 1st decimal place. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1.1 2.1 3.1; 4.1 5.1 6.0; 7.0 8.0 9.0]";
Definition at line 1226 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Floor | ( | ) |
Round the matrix elements to the nearest integers towards minus infinity.
Matrix A; A = "[1.9 2.8 3.7; -4.6 -5.5 -6.4; 7.3 8.2 9.1]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_Floor(); // Make A = floor(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1 2 3; -5 -6 -7; 7 8 9]";
Definition at line 1239 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Ceil | ( | ) |
Round the matrix elements to the nearest integers towards infinity.
Matrix A; A = "[1.9 2.8 3.7; -4.6 -5.5 -6.4; 7.3 8.2 9.1]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_Ceil(); // Make A = ceil(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[2 3 4; -4 -5 -6; 8 9 10]";
Definition at line 1252 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_erf | ( | ) |
Compute the error function (erf) for all values in the matrix inplace.
erf(x) = 2/sqrt(pi) * [integral from 0 to x of]( e^(-t^2) )dt.
Matrix A; A = "[-1 -0.5 0 0.5 1]"; bool result; result = A.PrintStdout(); // Print Matrix A. A = "[-1 -0.5 0 0.5 1]"; result = A.Inplace_erf(); // Make A = erf(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[-0.842700792949715 -0.520499877813047 0 0.520499877813047 0.842700792949715]";
Definition at line 1265 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_erfinv | ( | ) |
Compute the inverse error function (erfinv) for all values in the matrix inplace.
y = erf(x) = 2/sqrt(pi) * [integral from 0 to x of]( e^(-t^2) )dt. x = erfinv(y);.
Matrix A; A = "[-0.842700792949715 -0.520499877813047 0 0.520499877813047 0.842700792949715]"; bool result; result = A.PrintStdout(); // Print Matrix A. A = "[-0.842700792949715 -0.520499877813047 0 0.520499877813047 0.842700792949715]"; result = A.Inplace_erfinv(); // Make A = erfinv(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[-1 -0.5 0 0.5 1]";
Definition at line 1278 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_erfc | ( | ) |
Compute the complementary error function (erfc) for all values in the matrix inplace.
erfc(x) = 1 - erf(x) = 2/sqrt(pi) * [integral from x to inf of]( e^(-t^2) )dt.
Matrix A; A = "[-1 -0.5 0 0.5 1]"; bool result; result = A.PrintStdout(); // Print Matrix A. A = "[-1 -0.5 0 0.5 1]"; result = A.Inplace_erfc(); // Make A = erfc(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1.84270079294971 1.52049987781305 1 0.479500122186953 0.157299207050285]";
Definition at line 1291 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_erfcinv | ( | ) |
Compute the complementary error function (erfc) for all values in the matrix inplace.
erfc(x) = 1 - erf(x) = 2/sqrt(pi) * [integral from x to inf of]( e^(-t^2) )dt.
Matrix A; A = "[1.84270079294971 1.52049987781305 1 0.479500122186953 0.157299207050285]"; bool result; result = A.PrintStdout(); // Print Matrix A. A = "[1.84270079294971 1.52049987781305 1 0.479500122186953 0.157299207050285]"; result = A.Inplace_erfcinv(); // Make A = erfcinv(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[-1 -0.5 0 0.5 1]";
Definition at line 1304 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Fix | ( | ) |
Rounds the matrix elements of X to the nearest integers towards zero.
Matrix A; A = "[1.9 2.8 3.7; -4.6 -5.5 -6.4; 7.3 8.2 9.1]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_Fix(); // Make A = fix(A). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1 2 3; -4 -5 -6; 7 8 9]";
Definition at line 1317 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_AddScalar | ( | const double | scalar | ) |
Add a scaler double (ie: M += 5).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_AddScalar(1); // A += 1. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[2 3 4; 5 6 7; 8 9 10]";
Definition at line 1330 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SubtractScalar | ( | const double | scalar | ) |
Subtract a scaler double (ie: M -= 5).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_SubtractScalar(1); // A -= 1. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[0 1 2; 3 4 5; 6 7 8]";
Definition at line 1343 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_MultiplyScalar | ( | const double | scalar | ) |
Multiply by scaler double (ie: M *= 5).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_MultiplyScalar(5); // A *= 5. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[5 10 15; 20 25 30; 35 40 45]";
Definition at line 1356 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_DivideScalar | ( | const double | scalar | ) |
Divide by scaler double (ie: M /= 5).
Matrix A; A = "[5 10 15; 20 25 30; 35 40 45]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_DivideScalar(5); // A /= 5. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1 2 3; 4 5 6; 7 8 9]";
Definition at line 1369 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_PowerScalar | ( | const double | scalar | ) |
Raise the matrix to a power scaler double (ie: M ^= 5).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. result = A.Inplace_PowerScalar(2); // A = A.^2. Not A*A! Each element is raised. cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[1 4 9; 16 25 36; 49 64 81]";
Definition at line 1382 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_AddScalarComplex | ( | const std::complex< double > | cplx | ) |
Add a scaler double (ie: M += (4+2i)).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. std::complex<double> cplx(4.0,2.0); result = A.Inplace_AddScalarComplex(cplx); // A += (4+2i). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[5+2i 6+2i 7+2i; 8+2i 9+2i 10+2i; 11+2i 12+2i 13+2i]"; cout << "A(0,0) = " << A(0,0).real() << "+" << A(0,0).imag() << "i " << endl;
Definition at line 1395 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SubtractScalarComplex | ( | const std::complex< double > | cplx | ) |
Subtract a scaler double (ie: M -= (5+2i)).
Matrix A; A = "[1 2 3; 4 5 6; 7 8 9]"; bool result; result = A.PrintStdout(); // Print Matrix A. std::complex<double> cplx(5.0,2.0); result = A.Inplace_SubtractScalarComplex(cplx); // A -= (5+2i). cout << endl; result = A.PrintStdout(); // Print Matrix A. A = "[-4-2i -3-2i -2-2i; -1-2i 0-2i 1-2i; 2-2i 3-2i 4-2i]"; cout << "A(0,0) = " << A(0,0).real() << "+" << A(0,0).imag() << "i " << endl;
Definition at line 1408 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_MultiplyScalarComplex | ( | const std::complex< double > | cplx | ) |
Multiply by scaler double (ie: M *= (5+2i)).
Matrix M; M = "[10 20]"; std::complex<double> cplx(5,2); if( !M.Inplace_MultiplyScalarComplex(cplx) ) return false; // M // 50+20i 100+40i
Definition at line 1421 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_DivideScalarComplex | ( | const std::complex< double > | cplx | ) |
Divide by scaler double (ie: M /= (5+1i)).
Matrix M; M = "[10+2i 20+4i]"; std::complex<double> cplx(5,1); if( !M.Inplace_DivideScalarComplex(cplx) ) return false; // M // 2 4
Definition at line 1434 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_PowerScalarComplex | ( | const std::complex< double > | cplx | ) |
Raise the matrix to a power scaler double (ie: M ^= (5+2i)).
Matrix M; M = "[2 3]"; std::complex<double> cplx(5,2); if( !M.Inplace_PowerScalarComplex(cplx) ) return false; // M // 5.87062319178566+31.4568876931598i -142.459949032798+196.860770397691i
Definition at line 1447 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Abs | ( | ) |
Compute the absolute value of each element in the matrix.
Matrix A; A = "[-1 -2; -3 -4]"; if( !A.Inplace_Abs() ) return false; // A // 1 2 // 3 4
Definition at line 1460 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Sqr | ( | ) |
Compute the value^2 of each element in the matrix.
Matrix A; A = "[1 2; -3 -4]"; if( !A.Inplace_Sqr() ) return false; // A // 1 4 // 9 16
Definition at line 1627 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Sqrt | ( | ) |
Computes the sqrt(value) of each element in the matrix.
Matrix A; A = "[1 4; 9 16]"; if( !A.Inplace_Sqrt() ) return false; // A // 1 2 // 3 4
Definition at line 1640 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Exp | ( | ) |
Computes the exp(value) of each element in the matrix.
Matrix A; A = "[1 2; 3 4]"; if( !A.Inplace_Exp() ) return false; // A ~ // 2.71828 7.38905 // 20.08553 54.59815
Definition at line 1653 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Ln | ( | ) |
Computes the natural logarithm, ln(value) of each element in the matrix.
Matrix A; A = "[2.71828 7.38905; 20.08553 54.59815]"; if( !A.Inplace_Ln() ) return false; // A ~ // 1 2 // 3 4
Definition at line 1666 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Increment | ( | ) |
Add +1.0 to all elements, e.g. M++.
Matrix A; A = "[1 2; 3 4]"; if( !A.Inplace_Increment() ) return false; // A // 2 3 // 4 5
Definition at line 1679 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Decrement | ( | ) |
Subtract 1.0 from all elements, e.g. M--.
Matrix A; A = "[1 2; 3 4]"; if( !A.Inplace_Decrement() ) return false; // A // 0 1 // 2 3
Definition at line 1692 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Add | ( | const Matrix & | B | ) |
Add matrix B to this matrix inplace. A += B, inplace.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 3 4]"; if( !A.Inplace_Add(B) ) return false; // A // 2 4 // 6 8
Definition at line 1705 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Subtract | ( | const Matrix & | B | ) |
Subtract matrix B from this matrix inplace. A -= B, inplace.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 3 4]"; if( !A.Inplace_Subtract(B) ) return false; // A // 0 0 // 0 0
Definition at line 1718 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_PreMultiply | ( | const Matrix & | B | ) |
Pre-Multiply this matrix by B. A = B*A, inplace.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 2 1]"; if( !A.Inplace_PreMultiply(B) ) return false; // A // 7 10 // 5 8
Definition at line 1731 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_TranposePreMultiply | ( | const Matrix & | B | ) |
Pre-Multiply this matrix by tranpose(B). A = tranpose(B)*A, inplace. No transpose occurs and hence more efficient.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[5 6; 7 8]"; if( !A.Inplace_TranposePreMultiply(B) ) return false; // A // 26 38 // 30 44
Definition at line 1744 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_PostMultiply | ( | const Matrix & | B | ) |
Post-Multiply this matrix by B. A = A*B, inplace.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 2 1]"; if( !A.Inplace_PostMultiply(B) ) return false; // A // 5 4 // 11 10
Definition at line 1757 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_PostMultiplyTranspose | ( | const Matrix & | B | ) |
Post-Multiply this matrix by transpose(B). A = A*transpose(B), inplace.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[5 6; 7 8]"; if( !A.Inplace_PostMultiplyTranspose(B) ) return false; // A // 17 23 // 39 53
Definition at line 1770 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_DotMultiply | ( | const Matrix & | B | ) |
Dot multiply A .*= B, inplace. A and B must have the same dimensions.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 2 1]"; if( !A.Inplace_DotMultiply(B) ) return false; // A // 1 4 // 6 4
Definition at line 1783 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_DotDivide | ( | const Matrix & | B | ) |
Dot divide A ./= B, inplace. A and B must have the same dimensions.
Matrix A; Matrix B; A = "[1 2; 3 4]"; B = "[1 2; 2 1]"; if( !A.Inplace_DotDivide(B) ) return false; // A // 1 1 // 1.5 4
Definition at line 1796 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortAscending | ( | ) |
Sorts each column of the matrix in ascending order. If complex, sorts based on magnitude.
Matrix A; A = "[1;3;2;4;6;5;7]"; if( !A.Inplace_SortAscending() ) return false; // A // [1;2;3;4;5;6;7]
Definition at line 1809 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortDescending | ( | ) |
Sorts each column of M in descending order. If complex, sorts based on magnitude.
Matrix A; A = "[1;3;2;4;6;5;7]"; if( !A.Inplace_SortDescending() ) return false; // A // [7;6;5;4;3;2;1]
Definition at line 1822 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortColumnAscending | ( | const unsigned | col | ) |
Sorts a specific column in ascending order. If complex, sorts based on magnitude.
Matrix A; A = "[0 1;0 3;0 2;0 4;0 6;0 5;0 7]"; if( !A.Inplace_SortColumnAscending(1) ) return false; // A // A = "[0 1;0 2;0 3;0 4;0 5;0 6;0 7]";
Definition at line 1835 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortColumnDescending | ( | const unsigned | col | ) |
Sorts a specific column in descending order. If complex, sorts based on magnitude.
Matrix A; A = "[0 1;0 3;0 2;0 4;0 6;0 5;0 7]"; if( !A.Inplace_SortColumnDescending(1) ) return false; // A // A = "[0 7;0 6;0 5;0 4;0 3;0 2;0 1]";
Definition at line 1848 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortColumnIndexed | ( | const unsigned | col, | |
Matrix & | Index | |||
) |
Sorts a specific column in ascending order and fills a column vector with the sorted index. The index vector will be resized if needed. If complex, sorts based on magnitude.
Matrix A; Matrix I; A = "[0 1;0 3;0 2;0 4;0 6;0 5;0 7]"; if( !A.Inplace_SortColumnIndexed(1, I) ) return false; // A = "[0 1;0 2;0 3;0 4;0 5;0 6;0 7]"; // I = "[0;2;1;3;5;4;6]"
Definition at line 1861 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_SortByColumn | ( | const unsigned | col | ) |
Sorts the entire matrix by a specific column. If complex, sorts based on magnitude.
Matrix A; Matrix I; A = "[0 1;2 3;1 2;3 4;5 6;4 5;6 7]"; if( !A.Inplace_SortByColumn(0) ) return false; // A = "[0 1;1 2;2 3;3 4;4 5;5 6;6 7]";
Definition at line 1874 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_Invert | ( | ) |
Computes the inplace inverse of the matrix.
Uses fast closed form solutions for: 1x1, 2x2, 3x3
Otherwise, the matrix is first tested to determine if it is a symmetric positive-definite matrix. If so, Cholesky decomposition is used to facilitate the inversion of a lower triangular matrix. If the matrix is not symmetric and positive-definite robust inversion using gaussing elimination is attempted.
If the matrix is singular, the original matrix is unchanged.
Matrix A; A = "[10 14; 14 20]"; if( !A.Inplace_Invert() ) return false; // A // 5 -3.5 // -3.5 2.5
Definition at line 1887 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_InvertRobust | ( | ) |
Perfroms an inplace inverse using Gaussian Elimination methods.
Matrix A; A = "[1 2; 3 4]"; if( !A.Inplace_InvertRobust() ) return false; // A // -2 1 // 1.5 -0.5
Definition at line 1900 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_LowerTriangularInverse | ( | ) |
Compute the inplace inverse of a unit lower triangular matrix.
Matrix A; // A // 1 0 0 // -2 2 0 // 4 -3 -3 A = "[1 0 0; -2 2 0; 4 -3 -3]"; if( !A.Inplace_LowerTriangularInverse() ) return false; // A // 1 0 0 // 1 1/2 0 // -1/3 1/2 1/3
Definition at line 1913 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_FFT | ( | ) |
Compute the inplace Fourier Transform of each column of the matrix.
Matrix A; A = "[0; 0; 0; 0; 1; 1; 1; 1;]"; if( !A.Inplace_FFT() ) return false; // A // 4 // -1+2.41421356237309i // 0 // -1+0.414213562373095i // 0 // -1-0.414213562373095i // 0 // -1-2.41421356237309i
endcode
Definition at line 1926 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_FFT2 | ( | ) |
Compute the inplace Two-Dimensional Fourier Transform of the matrix. FFT2 is equivalent to transpose( FFT( transpose( FFT(each column) ) ) ).
Matrix A; Matrix B; bool result; result = A.Inplace_colon(1.0,1.0,32.0); B = A*A.Transpose(); // (32x32 square matrix) result = B.Inplace_FFT2();
endcode
Definition at line 1939 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_IFFT | ( | ) |
Compute the inplace inverse Fourier Transform of each column of the matrix.
Matrix A; A = "[4; -1+2.41421356237309i; 0; -1+0.414213562373095i; 0; -1-0.414213562373095i; 0; -1-2.41421356237309i;]"; if( !A.Inplace_IFFT() ) return false; // A // 0 // 0 // 0 // 0 // 1 // 1 // 1 // 1
Definition at line 1952 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_IFFT2 | ( | ) |
Compute the inplace inverse Fourier Transform of the matrix. IFFT2 is equivalent to transpose( IFFT( transpose( IFFT(each column) ) ) ).
Definition at line 1965 of file Matrix.cpp.
Add A = B+C. The result, A, is stored in this matrix.
Matrix A; Matrix B; Matrix C; B = "[1 2; 3 4]"; C = "[-1 2; -3 4]"; if( !A.Add( B, C ) ) return false; // A // 0 4 // 0 8
Definition at line 1978 of file Matrix.cpp.
Subtract A = B-C. The result, A, is stored in this matrix.
Matrix A; Matrix B; Matrix C; B = "[1 2; 3 4]"; C = "[-1 2; -3 4]"; if( !A.Subtract( B, C ) ) return false; // A // 2 0 // 6 0
Definition at line 1991 of file Matrix.cpp.
Multiply A = B*C. The result, A, is stored in this matrix.
Matrix A; Matrix B; Matrix C; B = "[1 2; 3 4]"; C = "[-1 2; -3 4]"; if( !A.Multiply( B, C ) ) return false; // A // -7 10 // -15 22
Definition at line 2004 of file Matrix.cpp.
Multiply A = transpose(B)*C. The result, A, is stored in this matrix.
Matrix A; Matrix B; Matrix C; B = "[1 2; 3 4]"; C = "[-1 2; -3 4]"; if( !A.TransposeMultiply( B, C ) ) return false; // A // -10 14 // -14 20
Definition at line 2017 of file Matrix.cpp.
Multiply A = B*transpose(C). The result, A, is stored in this matrix.
Matrix A; Matrix B; Matrix C; B = "[1 2; 3 4]"; C = "[-1 2; -3 4]"; if( !A.MultiplyTranspose( B, C ) ) return false; // A // 3 5 // 5 7
Definition at line 2030 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_abs | ( | ) |
Compute the absolute value of each element of the matrix inplace.
Matrix A; A = "[-1 2 3]"; if( !A.Inplace_abs() ) return false; // A // [1 2 3]
Definition at line 2043 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_acos | ( | ) |
Compute the arc-cosine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in radians.
Matrix A; A = "[0 0.5 1]"; if( !A.Inplace_acos() ) return false; // A // [pi/2 pi/3 0]
Definition at line 1473 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_acosd | ( | ) |
Compute the arc-cosine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in degrees.
Matrix A; A = "[0 0.5 1]"; if( !A.Inplace_acosd() ) return false; // A // [90 60 0]
Definition at line 1486 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_acosh | ( | ) |
Compute the inverse hyperbolic cosine of each element of the matrix inplace. Results in radians.
Matrix A; A = "[0 1.0471975511966 1.5707963267949]"; if( !A.Inplace_acosh() ) return false; // A // [0 pi/3 pi/2]
Definition at line 1507 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_angle | ( | ) |
Compute the phase angle in radians of the elements of the matrix.
Matrix A; A = "[1+1i 1-1i 3+2i]"; if( !A.Inplace_acosh() ) return false; // A // [pi/4 -pi/4 0.588002603547568]
Definition at line 1520 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_asin | ( | ) |
Compute the arc-sine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in radians.
Matrix A; A = "[0 0.5 1.0]"; if( !A.Inplace_asin() ) return false; // A // [0 pi/6 pi/2]
Definition at line 1533 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_asind | ( | ) |
Compute the arc-sine of each element of the matrix inplace. Complex results are obtained if elements are greater than abs(1). Results in degrees.
Matrix A; A = "[0 0.5 1.0]"; if( !A.Inplace_asind() ) return false; // A // [0 30 90]
Definition at line 1546 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_asinh | ( | ) |
Compute the inverse hyperbolic sine of each element of the matrix inplace. Results in radians.
Matrix A; A = "[0 0.521095305493747 1.1752011936438]"; if( !A.Inplace_asinh() ) return false; // A // [0 0.5 1]
Definition at line 1567 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_atan | ( | ) |
Compute the arc-tangent of each element of the matrix inplace. Results in radians bounded [-pi/2, pi/2].
Matrix A; A = "[0 1.73205080756888 1.63312393531954e+016]"; if( !A.Inplace_atan() ) return false; // A // [0 pi/3 pi/2]
Definition at line 1580 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_atand | ( | ) |
Compute the arc-tangent of each element of the matrix inplace. Results in degrees bounded [-90, 90].
Matrix A; A = "[0 1.73205080756888 1.63312393531954e+016]"; if( !A.Inplace_atand() ) return false; // A // [0 60 90]
Definition at line 1593 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_atanh | ( | ) |
Compute the inverse hyperbolic tangent of each element of the matrix inplace.
Matrix A; A = "[0 0.46211715726001 0.761594155955765]"; if( !A.Inplace_atanh() ) return false; // A // [0 0.5 1]
Definition at line 1614 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_colon | ( | double | start, | |
double | increment, | |||
double | end | |||
) |
Create a column vector [start:increment:end) beginning at start with step size of increment until less than or equal to end. Note that arguments must be real scalars.
.
Matrix A; if( !A.Inplace_colon( 2, 2, 9 ) ) return false; // A // [2; 4; 6; 8] if( !A.Inplace_colon( 2, -2, -9 ) ) return false; // A // [2; 0; -2; -4; -6; -9;] if( !A.Inplace_colon( -10, 0.01, 10 ) ) return false; // A // [-10 -9.99 -9.98 ... 10]
Definition at line 2056 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_cos | ( | ) |
Compute the cosine of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 1.0471975511966 1.5707963267949]"; // [0 pi/3 pi/2] if( !A.Inplace_cos() ) return false; // A // 1 0.5 0
Definition at line 2082 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_cosh | ( | ) |
Compute the hyperbolic cosine of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.5 1]"; if( !A.Inplace_cosh() ) return false; // A // 1 1.12762596520638 1.54308063481524
Definition at line 2095 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_cot | ( | ) |
Compute the cotangent of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 1.0471975511966 1.5707963267949]"; // [0 pi/3 pi/2] if( !A.Inplace_cot() ) return false; // A // Inf 0.577350269189626 0
Definition at line 2108 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_coth | ( | ) |
Compute the hyperbolic cotangent of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.5 1]"; if( !A.Inplace_coth() ) return false; // A // Inf 2.16395341373865 1.31303528549933
Definition at line 2121 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_conj | ( | ) |
Complex conjugate. z = x+yi. conj(z) = x-yi.
Matrix A; A = "[2-2i -3+2i]"; if( !A.Inplace_conj() ) return false; // A // 2+2i -3-2i
Definition at line 2069 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_exp | ( | ) |
Compute the exponential of each element of the matrix inplace. If real, computes the exp(value) of each element in the matrix. If complex, computes exp(M) = exp(real)*(cos(imag)+i*sin(imag)).
Matrix A; A = "[1 2]"; if( !A.Inplace_exp() ) return false; // A // 2.71828182845905 7.38905609893065
Definition at line 2147 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_eye | ( | const unsigned | nrows, | |
const unsigned | ncols | |||
) |
Create an indentity matrix with nrows and ncols.
Matrix A; if( !A.eye(3,3) ) return false; // A // 1 0 0 // 0 1 0 // 0 0 1
Definition at line 2160 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_imag | ( | ) |
Imaginary part of the complex matrix. z = x+yi. real(z) = y.
Matrix A; A = "[2-2i -3+2i]"; if( !A.Inplace_imag() ) return false; // A // -2 2
Definition at line 2134 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_log2 | ( | ) |
Compute the log base 2 of the elements of the matrix. Complex results if elements are negative.
Matrix A; A = "[2 32]"; if( !A.Inplace_log2() ) return false; // A // 1 5
Definition at line 2173 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_log10 | ( | ) |
Compute the log base 10 of the elements of the matrix. Complex results if elements are negative.
Matrix A; A = "[10 1000]"; if( !A.Inplace_log10() ) return false; // A // 1 3
Definition at line 2194 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_ones | ( | const unsigned | nrows, | |
const unsigned | ncols | |||
) |
Create a matrix of nrows by ncols filled with 1.0.
Matrix A; if( !A.Inplace_ones(2,3) ) return false; // A // 1 1 1 // 1 1 1
Definition at line 2216 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_rand | ( | const unsigned | nrows, | |
const unsigned | ncols, | |||
const unsigned | seed = rand() | |||
) |
Produce a matrix that is composed of pseudo-random numbers. Values are elements are uniform distribution [0,1].
Matrix A; if( !A.Inplace_rand(1000,1) ) // create a 1000x1 vector with uniform distribution [0,1] return false;
Definition at line 2255 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_randn | ( | const unsigned | nrows, | |
const unsigned | ncols, | |||
const unsigned | seed = rand() | |||
) |
Produce a matrix that is composed of pseudo-random numbers. Values are elements are standard normal distribution with mean zero, variance of one and standard of deviation one. N(0,1).
Matrix A; if( !A.Inplace_randn(1000,1) ) // create a 1000x1 vector with standard normal distribution N[0,1] return false;
Definition at line 2268 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_real | ( | ) |
Real part of the complex matrix. z = x+yi. real(z) = x.
Matrix A; A = "[2-2i -3+2i]"; if( !A.Inplace_real() ) return false; // A // 2 3
Definition at line 2242 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_sin | ( | ) |
Compute the sine of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.523598775598299 1.5707963267949]"; //[0 pi/6 pi/2] if( !A.Inplace_sin() ) return false; // A // 0 0.5 1
Definition at line 2281 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_sinc | ( | ) |
Compute the sinc of each element*pi of the matrix inplace. i.e. y = sin(pi*x)./(pi*x).
Matrix A; A = "[0 0.523598775598299 1.5707963267949]"; //[0 pi/6 pi/2] if( !A.Inplace_sinc() ) return false; // A // 1 0.606257160324575 -0.19765087483668
Definition at line 2294 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_sinh | ( | ) |
Compute the hyperbolic sine of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.5 1]"; if( !A.Inplace_sinh() ) return false; // A // 0 0.521095305493747 1.1752011936438
Definition at line 2307 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_sqrt | ( | ) |
Compute the sqrt of each element of the matrix inplace.
Matrix A; A = "[0 9 121]"; if( !A.Inplace_sqrt() ) return false; // A // 0 3 11
Definition at line 2320 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_tan | ( | ) |
Compute the tangent of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.785398163397448 1.5707963267949]"; // [0 pi/4 pi/2] if( !A.Inplace_tan() ) return false; // A // 0 1 1.63312393531954e+016
Definition at line 2333 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_tanh | ( | ) |
Compute the hyperbolic tangent of each element of the matrix inplace. This function assumes radian values in the matrix.
Matrix A; A = "[0 0.785398163397448 1.5707963267949]"; // [0 pi/4 pi/2] if( !A.Inplace_tanh() ) return false; // A // 0 0.655794202632672 0.917152335667274
Definition at line 2346 of file Matrix.cpp.
bool Zenautics::Matrix::Inplace_zeros | ( | const unsigned | nrows, | |
const unsigned | ncols | |||
) |
Create a matrix of nrows by ncols filled with 0.0.
Matrix A; if( !A.Inplace_zeros(2,3) ) return false; // A // 0 0 0 // 0 0 0
Definition at line 2359 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxAbs | ( | unsigned & | row, | |
unsigned & | col, | |||
double & | value | |||
) |
Computes the value of the largest absolute element and its index.
Matrix A; unsigned row; unsigned col; double value; A = "[1 2 3 4 5]"; if( !A.GetStats_MaxAbs( row, col, value ) ) return false; // row == 0 // col == 4 // value == 5
Definition at line 2386 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Max | ( | unsigned & | row, | |
unsigned & | col, | |||
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the maximum element and its index. When complex the maximum absolute value is determined.
Matrix A; unsigned row; unsigned col; double re; double im; A = "[1 2 3 4 5-22i]"; if( !A.GetStats_Max( row, col, re, im ) ) return false; // row == 0 // col == 4 // re == 5 // im == -22
Definition at line 2399 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxVal | ( | double & | re, | |
double & | im | |||
) |
Computes the value (re+im*j) of the maximum element. When complex the maximum absolute value is determined.
Matrix A; double re; double im; A = "[1 2 3 4 5-22i]"; if( !A.GetStats_MaxVal( re, im ) ) return false; // re == 5 // im == -22
Definition at line 2412 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxAbsCol | ( | const unsigned | col, | |
double & | value, | |||
unsigned & | row | |||
) |
Computes the value of the largest absolute column element and its row index.
Matrix A; unsigned row; double value; A = "[1 2 3; 4 -5 6]"; if( !A.GetStats_MaxAbsCol( 1, value, row ) ) return false; // value == 5 // row == 1
Definition at line 2425 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxCol | ( | const unsigned | col, | |
double & | re, | |||
double & | im, | |||
unsigned & | row | |||
) |
Computes the value (re+im*j) of the maximum column element and its row index.
Definition at line 2438 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxColVal | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the maximum column element.
Definition at line 2451 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxAbsRow | ( | const unsigned | row, | |
double & | value, | |||
unsigned & | col | |||
) |
Computes the value of the largest absolute row element and its column index.
Definition at line 2464 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxRow | ( | const unsigned | row, | |
double & | re, | |||
double & | im, | |||
unsigned & | col | |||
) |
Computes the value (re+im*j) of the maximum row element and its column index.
Definition at line 2477 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MaxRowVal | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the maximum row element.
Definition at line 2490 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinAbs | ( | unsigned & | row, | |
unsigned & | col, | |||
double & | value | |||
) |
Computes the value of the smallest absolute element and its index.
Definition at line 2503 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Min | ( | unsigned & | row, | |
unsigned & | col, | |||
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the minimum element and its index.
Definition at line 2516 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinVal | ( | double & | re, | |
double & | im | |||
) |
Computes the value (re+im*j) of the minimum element.
Definition at line 2529 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinAbsCol | ( | const unsigned | col, | |
double & | value, | |||
unsigned & | row | |||
) |
Computes the value of the smallest absolute column element and its row index.
Definition at line 2542 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinCol | ( | const unsigned | col, | |
double & | re, | |||
double & | im, | |||
unsigned & | row | |||
) |
Computes the value (re+im*j) of the minimum column element and its row index.
Definition at line 2555 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinColVal | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the minimum column element.
Definition at line 2569 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinAbsRow | ( | const unsigned | row, | |
double & | value, | |||
unsigned & | col | |||
) |
Computes the value of the smallest absolute row element and its column index.
Definition at line 2582 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinRow | ( | const unsigned | row, | |
double & | re, | |||
double & | im, | |||
unsigned & | col | |||
) |
Computes the value (re+im*j) of the minimum row element and its column index.
Definition at line 2595 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_MinRowVal | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the value (re+im*j) of the minimum row element.
Definition at line 2608 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColRange | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the range of the data in the specified column. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2621 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowRange | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the range of the data in the specified row. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2634 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Range | ( | double & | re, | |
double & | im | |||
) |
Computes the range of the data in the matrix. Range = MaxVal - MinVal. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2647 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnSum | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the sum for the specified column. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2660 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowSum | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the sum for the specified row. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2673 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Sum | ( | double & | re, | |
double & | im | |||
) |
Computes the sum for the matrix. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2686 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnMean | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample mean for the specified column. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2699 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowMean | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample mean for the specified row. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2712 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Mean | ( | double & | re, | |
double & | im | |||
) |
Computes the sample mean for the matrix. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2725 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnStdev | ( | const unsigned | col, | |
double & | value | |||
) |
Computes the sample standard deviation for the specified column.
Definition at line 2738 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowStdev | ( | const unsigned | row, | |
double & | value | |||
) |
Computes the sample standard deviation for the specified row.
Definition at line 2751 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Stdev | ( | double & | value | ) |
Computes the sample standard deviation for the matrix.
Definition at line 2764 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnVar | ( | const unsigned | col, | |
double & | value | |||
) |
Computes the sample variance for the specified column.
Definition at line 2777 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowVar | ( | const unsigned | row, | |
double & | value | |||
) |
Computes the sample variance for the specified row.
Definition at line 2790 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Var | ( | double & | value | ) |
Computes the sample variance for the matrix.
Definition at line 2803 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnNorm | ( | const unsigned | col, | |
double & | value | |||
) |
Computes the norm of the specified column. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ).
Definition at line 2816 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowNorm | ( | const unsigned | row, | |
double & | value | |||
) |
Computes the norm of the specified row. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ).
Definition at line 2829 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Norm | ( | double & | value | ) |
Computes the norm of the matrix. If real, norm = sqrt( sum( val*val ) ). If complex, norm = sqrt( sum( val*conjugate(val) ) ).
Definition at line 2842 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnRMS | ( | const unsigned | col, | |
double & | value | |||
) |
Computes the sample RMS value for the specified column.
Definition at line 2855 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowRMS | ( | const unsigned | row, | |
double & | value | |||
) |
Computes the sample RMS value for the specified row.
Definition at line 2868 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RMS | ( | double & | value | ) |
Computes the sample RMS value for the matrix.
Definition at line 2881 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnSkewness | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample skewness value for the specified column. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2894 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowSkewness | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample skewness value for the specified row. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2907 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Skewness | ( | double & | re, | |
double & | im | |||
) |
Computes the sample skewness value for the matrix. The skewness is the third central moment divided by the cube of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set.
Definition at line 2920 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_ColumnKurtosis | ( | const unsigned | col, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample kurtosis value for the specified column. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
Definition at line 2933 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_RowKurtosis | ( | const unsigned | row, | |
double & | re, | |||
double & | im | |||
) |
Computes the sample kurtosis value for the specified row. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
Definition at line 2946 of file Matrix.cpp.
bool Zenautics::Matrix::GetStats_Kurtosis | ( | double & | re, | |
double & | im | |||
) |
Computes the sample kurtosis value for the matrix. The kurtosis is the fourth central moment divided by fourth power of the standard deviation. If the matrix is real, only the real value, re is set, im = 0. If the matrix is complex, both re and im are set. To adjust the computed kurtosis value for bias, subtract 3 from the real component. Reference: http://en.wikipedia.org/wiki/Kurtosis. Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
Definition at line 2959 of file Matrix.cpp.
bool Zenautics::Matrix::GetTrace | ( | double & | re, | |
double & | im | |||
) |
Computes the trace of M where M is a square matrix. / Trace = Sum of diagonal elements. / If the matrix is real, only the real value, re is set, im = 0. / If the matrix is complex, both re and im are set. /.
/
Definition at line 2972 of file Matrix.cpp.
bool Zenautics::Matrix::GetDeterminant | ( | double & | re, | |
double & | im | |||
) |
Computes the determinatnt of the square matrix M. / If the matrix is real, only the real value, re is set, im = 0. / If the matrix is complex, both re and im are set.
/
Definition at line 2985 of file Matrix.cpp.
bool Zenautics::Matrix::GetDiagonal | ( | Matrix & | DiagonalVector | ) |
Sets the diagonal elements of the matrix into DiagonalVector as a column vector. /.
/
Definition at line 2998 of file Matrix.cpp.
bool Zenautics::Matrix::GetColumnMovAvg | ( | const unsigned | col, | |
const unsigned | lead, | |||
const unsigned | lag, | |||
Matrix & | MovAvg | |||
) |
Computes a moving average using N lead samples and M lagging samples / for the specified column and stores it in MovAvg. /.
/
Definition at line 3011 of file Matrix.cpp.
bool Zenautics::Matrix::GetMovAvg | ( | const unsigned | lead, | |
const unsigned | lag, | |||
Matrix & | MovAvg | |||
) |
Computes a moving average using N lead samples and M lagging samples / for the matrix and stores it in MovAvg. /.
/
Definition at line 3024 of file Matrix.cpp.
bool Zenautics::Matrix::GetATAInverse | ( | Matrix & | InvATA | ) |
Computes: InvATA = inverse( transpose(A) * A ). Assumes this matrix is A. / e.g. Matrix A; Matrix InvATA; A = ...; bool result = A.GetATAInverse( InvATA ); /.
/
Definition at line 3037 of file Matrix.cpp.
bool Zenautics::Matrix::GetLUFactorization | ( | bool & | isFullRank, | |
Matrix & | P, | |||
Matrix & | L, | |||
Matrix & | U | |||
) |
LU factorization. / Performs a factorization to produce a unit lower triangular matrix, L, / an upper triangular matrix, U, and permutation matrix P so that / P*X = L*U. / P, L and U are copmuted correctly if IsFullRank is set to true. / e.g. Matrix A; A = ...; bool isFullRank, Matrix L,U,P; bool result = A.GetLUFactorization( isFullRank, P, L, U ); /.
/
Definition at line 3050 of file Matrix.cpp.
Lower x Diagonal x transpose(Lower): matrix factorization. This method avoids using square roots and can be used for any square, full rank, symmetrical matrix .
Matrix LDLt = "[3 6;6 16]"; Matrix L; Matrix d; bool result = LDLt.GetLDLt( L, d ); // L == [1 0;2 1] // d == [3; 4]; i.e. D == [3 0;0 4]
L | A unit lower triangular matrix. |
d | The diagonal vector from the diagonal of the D matrix. |
checkSymmetric | Enforce a symmetry check. Runs faster if disabled. |
Definition at line 3074 of file Matrix.cpp.
Upper x Diagonal x transpose(Upper): matrix factorization. This method avoids using square roots and can be used for any square, full rank, symmetrical matrix .
Matrix UDUt = "[19 8;8 4]"; Matrix U; Matrix d; bool result = UDUt.GetUDUt( U, d ); // U == [1 0;2 1] // d == [3; 4]; i.e. D == [3 0;0 4]
U | A unit upper triangular matrix. |
d | The diagonal vector from the diagonal of the D matrix. |
checkSymmetric | Enforce a symmetry check. Runs faster if disabled. |
Definition at line 3091 of file Matrix.cpp.
Retrieve the elements of the matrix specified by the index vectors. / The index vectors must be nx1 and preferably not complex. / /.
/
Definition at line 3108 of file Matrix.cpp.
bool Zenautics::Matrix::SetIndexedValues | ( | Matrix & | RowIndex, | |
Matrix & | ColIndex, | |||
Matrix & | SourceData | |||
) |
Set the elements of the matrix specified by the index vectors. The index vectors must be nx1 and preferably not complex.
Definition at line 3186 of file Matrix.cpp.
bool Zenautics::Matrix::Find_EqualTo | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value, | |||
const double | tolerance = 1e-12 | |||
) |
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value | Search for this value. |
tolerance | Search with this tolerance. |
Definition at line 3263 of file Matrix.cpp.
bool Zenautics::Matrix::Find_EqualTo | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value_re, | |||
const double | value_im, | |||
const double | tolerance | |||
) |
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value_re | Search for this complex value (re+i*im). |
value_im | Search for this complex value (re+i*im). |
tolerance | Search with this tolerance. No default parameter so there is no function overload confusion. |
Definition at line 3281 of file Matrix.cpp.
bool Zenautics::Matrix::Find_NotEqualTo | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value, | |||
const double | tolerance = 1e-12 | |||
) |
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value | Search for this value. |
tolerance | Search with this tolerance. |
Definition at line 3301 of file Matrix.cpp.
bool Zenautics::Matrix::Find_NotEqualTo | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value_re, | |||
const double | value_im, | |||
const double | tolerance | |||
) |
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value_re | Search for this complex value (re+i*im). |
value_im | Search for this complex value (re+i*im). |
tolerance | Search with this tolerance. No default parameter so there is no function overload confusion. |
Definition at line 3319 of file Matrix.cpp.
bool Zenautics::Matrix::Find_LessThan | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value | |||
) |
Set the index vector so that it contains are the indices of values that are less than the value specified from the column specified of this matrix. Complex values are compared in terms of magnitude (i.e. sqrt(re*re + im*im)).
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value | Search for this value. |
Definition at line 3339 of file Matrix.cpp.
bool Zenautics::Matrix::Find_MoreThan | ( | Matrix & | IndexVector, | |
const unsigned | col, | |||
const double | value | |||
) |
Set the index vector so that it contains are the indices of values that are more than the value specified from the column specified of this matrix. Complex values are compared in terms of magnitude (i.e. sqrt(re*re + im*im)).
IndexVector | Store the indexed values in this vector (nx1) |
col | Search this column (zero-based index). |
value | Search for this value. |
Definition at line 3357 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col, | |||
const std::string | bmpfilename = "plot.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label = "" , |
|||
const std::string | units = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot one series, X vs Y. The i'th column (x-axis) vs j'th column (y-axis) of the Matrix directly to a compressed (run-length-encoded) bitamp.
bool TryPlot() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix TS; // time | sin(time) double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; TS = T; result = TS.Concatonate( S ); if( !result ) return false; result = TS.Plot( 0, 1 ); // makes plot.bmp if( !result ) return false; result = F.Plot( 0, 1, "test1.bmp", "A Sinusoid", "time (s)", "voltage (V)", "sinusoid", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data (if this is the same as y_col, then the index is plotted as x). |
y_col | The column index (0toN-1) with the y series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label | The series label. |
units | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 5491 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col_1, | |||
const unsigned | y_col_2, | |||
const std::string | bmpfilename = "plot2.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label_1 = "" , |
|||
const std::string | units_1 = "" , |
|||
const std::string | series_label_2 = "" , |
|||
const std::string | units_2 = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot two series, X vs Y1, Y2 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp.
bool TryPlot2() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix C; // sin(time) Matrix F; // time | sin(time) | cos(time) double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; C = T; result = C.Inplace_cos(); if( !result ) return false; F = T; result = F.Concatonate( S ); if( !result ) return false; result = F.Concatonate( C ); if( !result ) return false; result = F.Plot( 0, 1, 2 ); // makes plot2.bmp if( !result ) return false; result = F.Plot( 0, 1, 2, "test2.bmp", "Two Sinusoids", "time (s)", "voltage (V)", "sine", "(V)", "cosine", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data. |
y_col_1 | The column index (0toN-1) with the y_1 series data. |
y_col_2 | The column index (0toN-1) with the y_2 series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label_1 | The series label. |
units_1 | The series data units. |
series_label_2 | The series label. |
units_2 | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 5573 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col_1, | |||
const unsigned | y_col_2, | |||
const unsigned | y_col_3, | |||
const std::string | bmpfilename = "plot3.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label_1 = "" , |
|||
const std::string | units_1 = "" , |
|||
const std::string | series_label_2 = "" , |
|||
const std::string | units_2 = "" , |
|||
const std::string | series_label_3 = "" , |
|||
const std::string | units_3 = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot three series, X vs Y1, Y2, Y3 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp.
bool TryPlot3() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix C; // sin(time) Matrix Sinc; // sin(time) Matrix F; // time | sin(time) | cos(time) | sinc(time) double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; C = T; result = C.Inplace_cos(); if( !result ) return false; Sinc = T; result = Sinc.Inplace_sinc(); if( !result ) return false; F = T; result = F.Concatonate( S ); if( !result ) return false; result = F.Concatonate( C ); if( !result ) return false; result = F.Concatonate( Sinc ); if( !result ) return false; result = F.Plot( 0, 1, 2, 3 ); // makes plot3.bmp if( !result ) return false; result = F.Plot( 0, 1, 2, 3, "plot3test.bmp", "sin cos sinc", "time (s)", "voltage (V)", "sine", "(V)", "cosine", "(V)", "sinc", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data. |
y_col_1 | The column index (0toN-1) with the y_1 series data. |
y_col_2 | The column index (0toN-1) with the y_2 series data. |
y_col_3 | The column index (0toN-1) with the y_3 series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label_1 | The series label. |
units_1 | The series data units. |
series_label_2 | The series label. |
units_2 | The series data units. |
series_label_3 | The series label. |
units_3 | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 5684 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col_1, | |||
const unsigned | y_col_2, | |||
const unsigned | y_col_3, | |||
const unsigned | y_col_4, | |||
const std::string | bmpfilename = "plot4.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label_1 = "" , |
|||
const std::string | units_1 = "" , |
|||
const std::string | series_label_2 = "" , |
|||
const std::string | units_2 = "" , |
|||
const std::string | series_label_3 = "" , |
|||
const std::string | units_3 = "" , |
|||
const std::string | series_label_4 = "" , |
|||
const std::string | units_4 = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot four series, X vs Y1, Y2, Y3 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp.
bool TryPlot3() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix C; // sin(time) Matrix Sinc; // sin(time) Matrix F; // time | sin(time) | cos(time) | sinc(time) | sin(time)+1 double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; C = T; result = C.Inplace_cos(); if( !result ) return false; Sinc = T; result = Sinc.Inplace_sinc(); if( !result ) return false; F = T; result = F.Concatonate( S ); if( !result ) return false; result = F.Concatonate( C ); if( !result ) return false; result = F.Concatonate( Sinc ); if( !result ) return false; S += 1.0; result = F.Concatonate( S ); if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4 ); // makes plot4.bmp if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4, "plot4test.bmp", "sin cos sinc sin+1", "time (s)", "voltage (V)", "sine", "(V)", "cosine", "(V)", "sinc", "(V)", "sin+1", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data. |
y_col_1 | The column index (0toN-1) with the y_1 series data. |
y_col_2 | The column index (0toN-1) with the y_2 series data. |
y_col_3 | The column index (0toN-1) with the y_3 series data. |
y_col_4 | The column index (0toN-1) with the y_4 series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label_1 | The series label. |
units_1 | The series data units. |
series_label_2 | The series label. |
units_2 | The series data units. |
series_label_3 | The series label. |
units_3 | The series data units. |
series_label_4 | The series label. |
units_4 | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 5822 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col_1, | |||
const unsigned | y_col_2, | |||
const unsigned | y_col_3, | |||
const unsigned | y_col_4, | |||
const unsigned | y_col_5, | |||
const std::string | bmpfilename = "plot5.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label_1 = "" , |
|||
const std::string | units_1 = "" , |
|||
const std::string | series_label_2 = "" , |
|||
const std::string | units_2 = "" , |
|||
const std::string | series_label_3 = "" , |
|||
const std::string | units_3 = "" , |
|||
const std::string | series_label_4 = "" , |
|||
const std::string | units_4 = "" , |
|||
const std::string | series_label_5 = "" , |
|||
const std::string | units_5 = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot five series, X vs Y1, Y2, Y3, Y4, Y5 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp.
bool TryPlot3() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix C; // sin(time) Matrix Sinc; // sin(time) Matrix F; // time | sin(time) | cos(time) | sinc(time) | sin(time)+1 | cos(time)-1 double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; C = T; result = C.Inplace_cos(); if( !result ) return false; Sinc = T; result = Sinc.Inplace_sinc(); if( !result ) return false; F = T; result = F.Concatonate( S ); if( !result ) return false; result = F.Concatonate( C ); if( !result ) return false; result = F.Concatonate( Sinc ); if( !result ) return false; S += 1.0; result = F.Concatonate( S ); if( !result ) return false; C -= 1.0; result = F.Concatonate( C ); if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4, 5 ); // makes plot5.bmp if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4, 5, "plot5test.bmp", "sin cos sinc sin+1 cos-1", "time (s)", "voltage (V)", "sine", "(V)", "cosine", "(V)", "sinc", "(V)", "sin+1", "(V)", "cos-1", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data. |
y_col_1 | The column index (0toN-1) with the y_1 series data. |
y_col_2 | The column index (0toN-1) with the y_2 series data. |
y_col_3 | The column index (0toN-1) with the y_3 series data. |
y_col_4 | The column index (0toN-1) with the y_4 series data. |
y_col_5 | The column index (0toN-1) with the y_5 series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label_1 | The series label. |
units_1 | The series data units. |
series_label_2 | The series label. |
units_2 | The series data units. |
series_label_3 | The series label. |
units_3 | The series data units. |
series_label_4 | The series label. |
units_4 | The series data units. |
series_label_5 | The series label. |
units_5 | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 5988 of file Matrix.cpp.
bool Zenautics::Matrix::Plot | ( | const unsigned | x_col, | |
const unsigned | y_col_1, | |||
const unsigned | y_col_2, | |||
const unsigned | y_col_3, | |||
const unsigned | y_col_4, | |||
const unsigned | y_col_5, | |||
const unsigned | y_col_6, | |||
const std::string | bmpfilename = "plot6.bmp" , |
|||
const std::string | title = "" , |
|||
const std::string | xlabel = "" , |
|||
const std::string | ylabel = "" , |
|||
const std::string | series_label_1 = "" , |
|||
const std::string | units_1 = "" , |
|||
const std::string | series_label_2 = "" , |
|||
const std::string | units_2 = "" , |
|||
const std::string | series_label_3 = "" , |
|||
const std::string | units_3 = "" , |
|||
const std::string | series_label_4 = "" , |
|||
const std::string | units_4 = "" , |
|||
const std::string | series_label_5 = "" , |
|||
const std::string | units_5 = "" , |
|||
const std::string | series_label_6 = "" , |
|||
const std::string | units_6 = "" , |
|||
const bool | isXGridOn = true , |
|||
const bool | isYGridOn = true , |
|||
const bool | includeStats = true , |
|||
const unsigned | precisionStats = 5 , |
|||
const unsigned | plot_height_cm = 8 , |
|||
const unsigned | plot_width_cm = 10 | |||
) |
Plot six series, X vs Y1, Y2, Y3, Y4, Y5, Y6 using columns of the Matrix. Plots directly to a compressed (run-length-encoded) bitamp.
bool TryPlot3() { bool result; Matrix T; // time Matrix S; // sin(time) Matrix C; // sin(time) Matrix Sinc; // sin(time) Matrix F; // time | sin(time) | cos(time) | sinc(time) | sin(time)+1 | cos(time)-1 | sinc^2(time) double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; C = T; result = C.Inplace_cos(); if( !result ) return false; Sinc = T; result = Sinc.Inplace_sinc(); if( !result ) return false; F = T; result = F.Concatonate( S ); if( !result ) return false; result = F.Concatonate( C ); if( !result ) return false; result = F.Concatonate( Sinc ); if( !result ) return false; S += 1.0; result = F.Concatonate( S ); if( !result ) return false; C -= 1.0; result = F.Concatonate( C ); if( !result ) return false; result = Sinc.Inplace_Sqr(); if( !result ) return false; result = F.Concatonate( Sinc ); if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4, 5, 6 ); // makes plot6.bmp if( !result ) return false; result = F.Plot( 0, 1, 2, 3, 4, 5, 6, "plot6test.bmp", "sin cos sinc sin+1 cos-1 sinc^2", "time (s)", "voltage (V)", "sine", "(V)", "cosine", "(V)", "sinc", "(V)", "sin+1", "(V)", "cos-1", "(V)", "sinc^2", "(V)" ); if( !result ) return false; return true; }
x_col | The column index (0toN-1) with the x series data. |
y_col_1 | The column index (0toN-1) with the y_1 series data. |
y_col_2 | The column index (0toN-1) with the y_2 series data. |
y_col_3 | The column index (0toN-1) with the y_3 series data. |
y_col_4 | The column index (0toN-1) with the y_4 series data. |
y_col_5 | The column index (0toN-1) with the y_5 series data. |
y_col_6 | The column index (0toN-1) with the y_5 series data. |
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
series_label_1 | The series label. |
units_1 | The series data units. |
series_label_2 | The series label. |
units_2 | The series data units. |
series_label_3 | The series label. |
units_3 | The series data units. |
series_label_4 | The series label. |
units_4 | The series data units. |
series_label_5 | The series label. |
units_5 | The series data units. |
series_label_6 | The series label. |
units_6 | The series data units. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6181 of file Matrix.cpp.
std::string Zenautics::Matrix::GetMatrixComment | ( | ) |
Retrieve the matrix comment string. The string will be empty if none is available. The matrix comment string is often the header line read when using ReadFromFile().
e.g. file.txt has: time(s) x(m) y(m) 1.0 20.0 30.0.
bool result; Matrix A; result = A.ReadFromFile("file.txt"); // A == [1.0 20.0 30.0] std::string comment = A.GetMatrixComment(); // comment == "time(s) x(m) y(m)"
Definition at line 3376 of file Matrix.cpp.
bool Zenautics::Matrix::TimeWindow | ( | const unsigned | timeColumn, | |
const double | startTime, | |||
const double | duration, | |||
const double | rolloverTime | |||
) |
Alter the matrix so that its data is within the startTime to the startTime+duration and compensate for any rollovers in the time system (e.g. GPS time in seconds rolls over at 604800.0 s). This function assumes that time is one of the matrix columns and requires this index, the timeColumn.
timeColumn | The column containing time. |
startTime | The specified start time (inclusive). |
duration | The duration to include. |
rolloverTime | The potential time at which system time rolls over. |
Definition at line 3386 of file Matrix.cpp.
bool Zenautics::Matrix::TimeLimit | ( | const unsigned | timeColumn, | |
const double | startTime, | |||
const double | endTime | |||
) |
Alter the matrix so that its data is within [startTime endTime]. This function assumes that time is one of the matrix columns and requires this index, the timeColumn.
timeColumn | The column containing time |
startTime | The specified start time (inclusive) |
endTime | The duration to include |
Definition at line 3409 of file Matrix.cpp.
bool Zenautics::Matrix::TimeMatch | ( | Matrix & | A, | |
const unsigned | timeColumnA, | |||
Matrix & | B, | |||
const unsigned | timeColumnB, | |||
const unsigned | precision, | |||
const double | rolloverTime | |||
) | [static] |
This static function matches matrices in time with specified precision where time is a column of each matrix. This function also allows time to rollover at a specified interval.
precision 0 = match to whole number
precision 1 = match to nearest 0.1
precision 2 = match to nearest 0.01
etc.
rolloverTime examples
GPS time of week (s): rolloverTime= 604800.0
hours : rolloverTime = 24.0
minutes : rolloverTime = 60.0
The time data must be non-decreasing but the time may rollover by the specified amount. e.g. rolloverTime = 60.0
0,1,2,3,4,...59,60,1,2,5,10,60,1,2,3...
This function may be called by: bool result = Matrix::TimeMatch( ... );
A | The matrix with interpolation times |
timeColumnA | The zero based column index for matrix A |
B | The matrix to be interpolated |
timeColumnB | The zero based column index for matrix B |
precision | The rounding precision used for time matching, 0 = whole, 1 = 0.1, 2 = 0.01, etc |
rolloverTime | The rollover time, e.g. 60 s for minute based timing, 0.0 means rollovers not allowed |
Definition at line 3430 of file Matrix.cpp.
bool Zenautics::Matrix::Interpolate | ( | Matrix & | A, | |
const unsigned | timeColumnA, | |||
Matrix & | B, | |||
const unsigned | timeColumnB, | |||
const double | maxInterpolationInterval, | |||
const double | rolloverTime | |||
) | [static] |
This static function interpolates Matrix B values by the times defined in the column in Matrix A. Time must be increasing but times can rollover with the specified rolloverTime.
This function returns A and B with the same number of rows and time aligned time columns.
This function may be called by: bool result = Matrix::Interpolate( ... );
A | The matrix with interpolation times |
timeColumnA | The zero based column index for matrix A |
B | The matrix to be interpolated |
timeColumnB | The zero based column index for matrix B |
maxInterpolationInterval | The largest interpolation interval allowed |
rolloverTime | The rollover time, e.g. 60 s for minute based timing, 0.0 means rollovers not allowed |
Definition at line 3472 of file Matrix.cpp.
Matrix Zenautics::Matrix::Column | ( | const unsigned | col | ) |
Return the column matrix specified by the column index. Returns (nrows x 1).
Definition at line 3515 of file Matrix.cpp.
Matrix Zenautics::Matrix::Row | ( | const unsigned | row | ) |
Return the row matrix specified by the column index. Returns (ncols x 1).
Definition at line 3527 of file Matrix.cpp.
Matrix Zenautics::Matrix::Transpose | ( | ) |
Matrix Zenautics::Matrix::T | ( | ) |
Matrix Zenautics::Matrix::Diagonal | ( | ) |
Matrix Zenautics::Matrix::Inverse | ( | ) |
Return the inverse of the matrix.
Matrix A = "[1 0 1; -2 1 3; 4 -1 -6]"; Matrix B = A.Inverse(); // B == "[0.6 0.2 0.2; 0 2 1; 0.4 -0.2 -0.2]";
Definition at line 3566 of file Matrix.cpp.
Matrix Zenautics::Matrix::Inv | ( | ) |
Return the inverse of the matrix.
Matrix A = "[1 0 1; -2 1 3; 4 -1 -6]"; Matrix B = A.Inv(); // B == "[0.6 0.2 0.2; 0 2 1; 0.4 -0.2 -0.2]";
Definition at line 3577 of file Matrix.cpp.
Matrix Zenautics::Matrix::FFT | ( | ) |
Return the Fourier Transform of each column of the matrix. Power of two uses FFT, otherwise fast DFT.
Definition at line 3583 of file Matrix.cpp.
Matrix Zenautics::Matrix::IFFT | ( | ) |
Return the inverse Fourier Transform of each column of the matrix. Power of two uses IFFT, otherwise fast IDFT.
Definition at line 3606 of file Matrix.cpp.
Matrix Zenautics::Matrix::FFT2 | ( | ) |
Return the Two Dimensional Fourier Transform of the matrix.
Definition at line 3594 of file Matrix.cpp.
Matrix Zenautics::Matrix::IFFT2 | ( | ) |
Return the Two Dimensional Inverse Fourier Transform of the matrix.
Definition at line 3616 of file Matrix.cpp.
Matrix Zenautics::Matrix::Real | ( | ) |
Return the real part of the matrix.
Matrix A = "[1-1i 2-2i 3-3i; 4-4i 5-5i 6-6i; 7-7i 8-8i 9-9i]"; Matrix B = A.Real(); // B == "[1 2 3; 4 5 6; 7 8 9]";
Definition at line 3652 of file Matrix.cpp.
Matrix Zenautics::Matrix::Imag | ( | ) |
Return the imag part of the matrix.
Matrix A = "[1-1i 2-2i 3-3i; 4-4i 5-5i 6-6i; 7-7i 8-8i 9-9i]"; Matrix B = A.Imag(); // B == "[-1 -2 -3; -4 -5 -6; -7 -8 -9]";
Definition at line 3663 of file Matrix.cpp.
Matrix Zenautics::Matrix::conj | ( | ) |
Return the complex conjugate of the matrix.
Matrix A = "[1-1i 2-2i 3-3i; 4-4i 5-5i 6-6i; 7-7i 8-8i 9-9i]"; Matrix B = A.conj(); // B == "[1+1i 2+2i 3+3i; 4+4i 5+5i 6+6i; 7+7i 8+8i 9+9i]";
Definition at line 3674 of file Matrix.cpp.
Matrix Zenautics::Matrix::AddIdentity | ( | ) |
Matrix Zenautics::Matrix::MinusIdentity | ( | ) |
Matrix Zenautics::Matrix::IdentityMinusMe | ( | ) |
Returns Identity minus the matrix.
Matrix A = "[1 2 3; 4 5 6; 7 8 9]"; Matrix B = A.IdentityMinusMe(); // B == "[0 -2 -3; -4 -4 -6; -7 -8 -8]";
Definition at line 3708 of file Matrix.cpp.
Matrix Zenautics::Matrix::Negate | ( | ) |
Returns the matrix * -1. This is more efficient than A *= -1.
Matrix A = "[1 2 3; 4 5 6; 7 8 9]"; Matrix B = A.Negate(); // B == "[-1 -2 -3; -4 -5 -6; -7 -8 -9]";
Definition at line 3718 of file Matrix.cpp.
bool Zenautics::Matrix::Hilbert | ( | const unsigned | N | ) |
Sets the matrix as the NxN hilbert matrix. H_ij = 1.0 / (i+j-1.0) for i=1:N, j=1:N.
Matrix H; bool result; result = H.Hilbert(3); // H == "[1 1/2 1/3; 1/2 1/3 1/4; 1/3 1/4 1/5]";
Definition at line 5478 of file Matrix.cpp.
Matrix Zenautics::Matrix::Sqrt | ( | ) |
Matrix Zenautics::Matrix::Exp | ( | ) |
Matrix Zenautics::Matrix::Ln | ( | ) |
Matrix Zenautics::Matrix::cos | ( | ) |
Matrix Zenautics::Matrix::acos | ( | ) |
Matrix Zenautics::Matrix::sin | ( | ) |
Matrix Zenautics::Matrix::asin | ( | ) |
Matrix Zenautics::Matrix::tan | ( | ) |
Matrix Zenautics::Matrix::atan | ( | ) |
Matrix Zenautics::Matrix::cosh | ( | ) |
Return the hyperbolic cosine of each element in the matrix.
Definition at line 3863 of file Matrix.cpp.
Matrix Zenautics::Matrix::acosh | ( | ) |
Return the inverse hyperbolic cosine of each element in the matrix.
Matrix Zenautics::Matrix::sinh | ( | ) |
Return the hyperbolic sine of each element in the matrix.
Definition at line 3877 of file Matrix.cpp.
Matrix Zenautics::Matrix::asinh | ( | ) |
Return the inverse hyperbolic sine of each element in the matrix.
Matrix Zenautics::Matrix::tanh | ( | ) |
Return the hyperbolic tangent of each element in the matrix.
Definition at line 3891 of file Matrix.cpp.
Matrix Zenautics::Matrix::atanh | ( | ) |
Return the inverse hyperbolic tangent of each element in the matrix.
Matrix Zenautics::Matrix::cot | ( | ) |
Matrix Zenautics::Matrix::coth | ( | ) |
Return the hyperbolic cotangent of each element in the matrix.
Definition at line 3919 of file Matrix.cpp.
Matrix Zenautics::Matrix::abs | ( | ) |
Return the absolute value (magnitude if complex) of each element in the matrix.
Definition at line 3933 of file Matrix.cpp.
Matrix Zenautics::Matrix::angle | ( | ) |
Return the phase angle in radians of the elements in the matrix. If M is a real matrix, Phase is a zero matrix. If M is a complex matrix, Phase is a real matrix = atan2(im,re).
Definition at line 3947 of file Matrix.cpp.
Matrix Zenautics::Matrix::pow | ( | const double | power_re, | |
const double | power_im = 0.0 | |||
) |
Return a matrix with all elements in raised to the power X^(power_re + power_im*i).
Definition at line 3961 of file Matrix.cpp.
Matrix Zenautics::Matrix::round | ( | const unsigned | precision | ) |
Return a matrix with elements rounded to the specified precision.
e.g. precision = 0 1.8 -> 2
e.g. precision = 1, 1.45 -> 1.5
e.g. precision = 2 1.456 -> 1.46
e.g. precision = 3, 1.4566 -> 1.457
precision has a maximum of 32. After which no rounding occurs.
Definition at line 3971 of file Matrix.cpp.
Matrix Zenautics::Matrix::floor | ( | ) |
Return a matrix with elements rounded to the nearest integers towards minus infinity.
Definition at line 3985 of file Matrix.cpp.
Matrix Zenautics::Matrix::ceil | ( | ) |
Return a matrix with elements rounded to the nearest integers towards infinity.
Definition at line 3999 of file Matrix.cpp.
Matrix Zenautics::Matrix::fix | ( | ) |
Return a matrix with elements rounded to the nearest integers towards zero.
Definition at line 4013 of file Matrix.cpp.
Matrix Zenautics::Matrix::dotInvert | ( | ) |
Matrix Zenautics::Matrix::oneMinusMe | ( | ) |
Return a matrix with each element subtracted from 1.0. i.e. 1-X.
Definition at line 4041 of file Matrix.cpp.
Return the matrix that has each element multiplied by each element of B. This matrix must be the same dimensions as B unless B is a scalar.
Definition at line 3627 of file Matrix.cpp.
Matrix::Element & Zenautics::Matrix::operator() | ( | unsigned | row, | |
unsigned | col | |||
) |
Get a reference to an element in the matrix to set or get its value.
Definition at line 4055 of file Matrix.cpp.
Matrix::Element & Zenautics::Matrix::operator() | ( | unsigned | index | ) |
Get a reference to an element in the matrix as a column or row vector to set or get its value. This can be used to access a matrix of (col,row), col = index/nrows, row = index/ncols. Matrix A(10); // The matrix is real with dimensions 10x1 A(0) = 10.0; // The matrix is real. stComplex cplx = {1.0,2.0}; A(1) = cplx; // The matrix is now complex with dimensions 10x1.
Definition at line 4073 of file Matrix.cpp.
bool Zenautics::Matrix::operator+= | ( | const int | scalar | ) | [inline] |
bool Zenautics::Matrix::operator+= | ( | const float | scalar | ) | [inline] |
bool Zenautics::Matrix::operator+= | ( | const double | scalar | ) |
bool Zenautics::Matrix::operator+= | ( | const std::complex< double > | cplx | ) |
bool Zenautics::Matrix::operator-= | ( | const int | scalar | ) | [inline] |
bool Zenautics::Matrix::operator-= | ( | const float | scalar | ) | [inline] |
bool Zenautics::Matrix::operator-= | ( | const double | scalar | ) |
bool Zenautics::Matrix::operator-= | ( | const std::complex< double > | cplx | ) |
subtract a scaler complex (shorthand notation: A -= (5+2i)).
Definition at line 4731 of file Matrix.cpp.
bool Zenautics::Matrix::operator *= | ( | const int | scalar | ) | [inline] |
bool Zenautics::Matrix::operator *= | ( | const float | scalar | ) | [inline] |
bool Zenautics::Matrix::operator *= | ( | const double | scalar | ) |
bool Zenautics::Matrix::operator *= | ( | const std::complex< double > | cplx | ) |
multiply a scaler complex (shorthand notation: A *= (5+2i)).
Definition at line 4741 of file Matrix.cpp.
bool Zenautics::Matrix::operator/= | ( | const int | scalar | ) | [inline] |
bool Zenautics::Matrix::operator/= | ( | const float | scalar | ) | [inline] |
bool Zenautics::Matrix::operator/= | ( | const double | scalar | ) |
bool Zenautics::Matrix::operator/= | ( | const std::complex< double > | cplx | ) |
divide a scaler complex (shorthand notation: A /= (5+2i)).
Definition at line 4751 of file Matrix.cpp.
bool Zenautics::Matrix::operator+= | ( | const Matrix & | mat | ) |
bool Zenautics::Matrix::operator-= | ( | const Matrix & | mat | ) |
Matrix::RealOnlyAccess Zenautics::Matrix::operator[] | ( | const unsigned | row | ) |
Retrieve a copy of a RealOnlyAccess object which is then used for the second [] overload.
Definition at line 5131 of file Matrix.cpp.
void Zenautics::Matrix::MatrixError | ( | const char * | error | ) |
Clear the matrix from memory and handle the error message.
Definition at line 384 of file Matrix.cpp.
void Zenautics::Matrix::MatrixError | ( | const char * | function, | |
const char * | error | |||
) |
Clear the matrix from memory and handle the error message.
Definition at line 390 of file Matrix.cpp.
void Zenautics::Matrix::StaticMatrixError | ( | const char * | error | ) | [static] |
void Zenautics::Matrix::StaticMatrixError | ( | const char * | function, | |
const char * | error | |||
) | [static] |
bool Zenautics::Matrix::IndexCheck | ( | const unsigned | row, | |
const unsigned | col | |||
) | [protected] |
Check the specified indices. Throw an exception if they are invalid.
Definition at line 5019 of file Matrix.cpp.
bool Zenautics::Matrix::IndexCheck | ( | const unsigned | index | ) | [protected] |
Check the specified index into the Matrix as a vector. Throw an exception if the index is invalid.
Definition at line 5036 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X, | |||
Matrix & | Y, | |||
const std::string | series_label, | |||
const std::string | units, | |||
const bool | isConnected, | |||
const MTX_enumColor | color, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot a single X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X | The series must be [Nx1] or [1xN]. |
Y | The series must be [Nx1] or [1xN]. |
series_label | The series label. |
units | The series units. |
isConnected | Are the data points connected. |
color | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6400 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X_1, | |||
Matrix & | Y_1, | |||
const std::string | series_label_1, | |||
const std::string | units_1, | |||
Matrix & | X_2, | |||
Matrix & | Y_2, | |||
const std::string | series_label_2, | |||
const std::string | units_2, | |||
const bool | isConnected_1, | |||
const MTX_enumColor | color_1, | |||
const bool | isConnected_2, | |||
const MTX_enumColor | color_2, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot two X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot2() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)", T, S+1.0, "sine+1", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X_1 | The series must be [Nx1] or [1xN]. |
Y_1 | The series must be [Nx1] or [1xN]. |
series_label_1 | The series label. |
units_1 | The series units. |
X_2 | The series must be [Nx1] or [1xN]. |
Y_2 | The series must be [Nx1] or [1xN]. |
series_label_2 | The series label. |
units_2 | The series units. |
isConnected_1 | Are the data points connected. |
color_1 | The color of the data points/line. |
isConnected_2 | Are the data points connected. |
color_2 | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6491 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X_1, | |||
Matrix & | Y_1, | |||
const std::string | series_label_1, | |||
const std::string | units_1, | |||
Matrix & | X_2, | |||
Matrix & | Y_2, | |||
const std::string | series_label_2, | |||
const std::string | units_2, | |||
Matrix & | X_3, | |||
Matrix & | Y_3, | |||
const std::string | series_label_3, | |||
const std::string | units_3, | |||
const bool | isConnected_1, | |||
const MTX_enumColor | color_1, | |||
const bool | isConnected_2, | |||
const MTX_enumColor | color_2, | |||
const bool | isConnected_3, | |||
const MTX_enumColor | color_3, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot three X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot3() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)", T, S+1.0, "sine+1", "(V)", T, S+2.0, "sine+2", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X_1 | The series must be [Nx1] or [1xN]. |
Y_1 | The series must be [Nx1] or [1xN]. |
series_label_1 | The series label. |
units_1 | The series units. |
X_2 | The series must be [Nx1] or [1xN]. |
Y_2 | The series must be [Nx1] or [1xN]. |
series_label_2 | The series label. |
units_2 | The series units. |
X_3 | The series must be [Nx1] or [1xN]. |
Y_3 | The series must be [Nx1] or [1xN]. |
series_label_3 | The series label. |
units_3 | The series units. |
isConnected_1 | Are the data points connected. |
color_1 | The color of the data points/line. |
isConnected_2 | Are the data points connected. |
color_2 | The color of the data points/line. |
isConnected_3 | Are the data points connected. |
color_3 | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6617 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X_1, | |||
Matrix & | Y_1, | |||
const std::string | series_label_1, | |||
const std::string | units_1, | |||
Matrix & | X_2, | |||
Matrix & | Y_2, | |||
const std::string | series_label_2, | |||
const std::string | units_2, | |||
Matrix & | X_3, | |||
Matrix & | Y_3, | |||
const std::string | series_label_3, | |||
const std::string | units_3, | |||
Matrix & | X_4, | |||
Matrix & | Y_4, | |||
const std::string | series_label_4, | |||
const std::string | units_4, | |||
const bool | isConnected_1, | |||
const MTX_enumColor | color_1, | |||
const bool | isConnected_2, | |||
const MTX_enumColor | color_2, | |||
const bool | isConnected_3, | |||
const MTX_enumColor | color_3, | |||
const bool | isConnected_4, | |||
const MTX_enumColor | color_4, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot four X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot4() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)", T, S+1.0, "sine+1", "(V)", T, S+2.0, "sine+2", "(V)", T, S+3.0, "sine+3", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X_1 | The series must be [Nx1] or [1xN]. |
Y_1 | The series must be [Nx1] or [1xN]. |
series_label_1 | The series label. |
units_1 | The series units. |
X_2 | The series must be [Nx1] or [1xN]. |
Y_2 | The series must be [Nx1] or [1xN]. |
series_label_2 | The series label. |
units_2 | The series units. |
X_3 | The series must be [Nx1] or [1xN]. |
Y_3 | The series must be [Nx1] or [1xN]. |
series_label_3 | The series label. |
units_3 | The series units. |
X_4 | The series must be [Nx1] or [1xN]. |
Y_4 | The series must be [Nx1] or [1xN]. |
series_label_4 | The series label. |
units_4 | The series units. |
isConnected_1 | Are the data points connected. |
color_1 | The color of the data points/line. |
isConnected_2 | Are the data points connected. |
color_2 | The color of the data points/line. |
isConnected_3 | Are the data points connected. |
color_3 | The color of the data points/line. |
isConnected_4 | Are the data points connected. |
color_4 | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6779 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X_1, | |||
Matrix & | Y_1, | |||
const std::string | series_label_1, | |||
const std::string | units_1, | |||
Matrix & | X_2, | |||
Matrix & | Y_2, | |||
const std::string | series_label_2, | |||
const std::string | units_2, | |||
Matrix & | X_3, | |||
Matrix & | Y_3, | |||
const std::string | series_label_3, | |||
const std::string | units_3, | |||
Matrix & | X_4, | |||
Matrix & | Y_4, | |||
const std::string | series_label_4, | |||
const std::string | units_4, | |||
Matrix & | X_5, | |||
Matrix & | Y_5, | |||
const std::string | series_label_5, | |||
const std::string | units_5, | |||
const bool | isConnected_1, | |||
const MTX_enumColor | color_1, | |||
const bool | isConnected_2, | |||
const MTX_enumColor | color_2, | |||
const bool | isConnected_3, | |||
const MTX_enumColor | color_3, | |||
const bool | isConnected_4, | |||
const MTX_enumColor | color_4, | |||
const bool | isConnected_5, | |||
const MTX_enumColor | color_5, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot five X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot5() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)", T, S+1.0, "sine+1", "(V)", T, S+2.0, "sine+2", "(V)", T, S+3.0, "sine+3", "(V)", T, S+4.0, "sine+4", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X_1 | The series must be [Nx1] or [1xN]. |
Y_1 | The series must be [Nx1] or [1xN]. |
series_label_1 | The series label. |
units_1 | The series units. |
X_2 | The series must be [Nx1] or [1xN]. |
Y_2 | The series must be [Nx1] or [1xN]. |
series_label_2 | The series label. |
units_2 | The series units. |
X_3 | The series must be [Nx1] or [1xN]. |
Y_3 | The series must be [Nx1] or [1xN]. |
series_label_3 | The series label. |
units_3 | The series units. |
X_4 | The series must be [Nx1] or [1xN]. |
Y_4 | The series must be [Nx1] or [1xN]. |
series_label_4 | The series label. |
units_4 | The series units. |
X_5 | The series must be [Nx1] or [1xN]. |
Y_5 | The series must be [Nx1] or [1xN]. |
series_label_5 | The series label. |
units_5 | The series units. |
isConnected_1 | Are the data points connected. |
color_1 | The color of the data points/line. |
isConnected_2 | Are the data points connected. |
color_2 | The color of the data points/line. |
isConnected_3 | Are the data points connected. |
color_3 | The color of the data points/line. |
isConnected_4 | Are the data points connected. |
color_4 | The color of the data points/line. |
isConnected_5 | Are the data points connected. |
color_5 | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 6977 of file Matrix.cpp.
bool Plot | ( | const std::string | bmpfilename, | |
const std::string | title, | |||
const std::string | xlabel, | |||
const std::string | ylabel, | |||
Matrix & | X_1, | |||
Matrix & | Y_1, | |||
const std::string | series_label_1, | |||
const std::string | units_1, | |||
Matrix & | X_2, | |||
Matrix & | Y_2, | |||
const std::string | series_label_2, | |||
const std::string | units_2, | |||
Matrix & | X_3, | |||
Matrix & | Y_3, | |||
const std::string | series_label_3, | |||
const std::string | units_3, | |||
Matrix & | X_4, | |||
Matrix & | Y_4, | |||
const std::string | series_label_4, | |||
const std::string | units_4, | |||
Matrix & | X_5, | |||
Matrix & | Y_5, | |||
const std::string | series_label_5, | |||
const std::string | units_5, | |||
Matrix & | X_6, | |||
Matrix & | Y_6, | |||
const std::string | series_label_6, | |||
const std::string | units_6, | |||
const bool | isConnected_1, | |||
const MTX_enumColor | color_1, | |||
const bool | isConnected_2, | |||
const MTX_enumColor | color_2, | |||
const bool | isConnected_3, | |||
const MTX_enumColor | color_3, | |||
const bool | isConnected_4, | |||
const MTX_enumColor | color_4, | |||
const bool | isConnected_5, | |||
const MTX_enumColor | color_5, | |||
const bool | isConnected_6, | |||
const MTX_enumColor | color_6, | |||
const bool | isXGridOn, | |||
const bool | isYGridOn, | |||
const bool | includeStats, | |||
const unsigned | precisionStats, | |||
const unsigned | plot_height_cm, | |||
const unsigned | plot_width_cm | |||
) | [friend] |
Plot six X vs Y series directly to a compressed (run-length-encoded) bitmap file.
bool TryPlot6() { Matrix T; Matrix S; bool result; double pi = 3.1415926535897; result = T.Inplace_colon( -2*pi, 0.01, 2*pi ); if( !result ) return false; S = T; result = S.Inplace_sin(); if( !result ) return false; result = Plot( "sine.bmp", "Testing Plot", "time (s)", "voltage (V)", T, S, "sine", "(V)", T, S+1.0, "sine+1", "(V)", T, S+2.0, "sine+2", "(V)", T, S+3.0, "sine+3", "(V)", T, S+4.0, "sine+4", "(V)", T, S+5.0, "sine+5", "(V)" ); if( !result ) return false; return true; }
bmpfilename | The file name (or full path name) of the output bitmap file. |
title | The plot title. |
xlabel | The x-axis label. |
ylabel | The y-axis label. |
X_1 | The series must be [Nx1] or [1xN]. |
Y_1 | The series must be [Nx1] or [1xN]. |
series_label_1 | The series label. |
units_1 | The series units. |
X_2 | The series must be [Nx1] or [1xN]. |
Y_2 | The series must be [Nx1] or [1xN]. |
series_label_2 | The series label. |
units_2 | The series units. |
X_3 | The series must be [Nx1] or [1xN]. |
Y_3 | The series must be [Nx1] or [1xN]. |
series_label_3 | The series label. |
units_3 | The series units. |
X_4 | The series must be [Nx1] or [1xN]. |
Y_4 | The series must be [Nx1] or [1xN]. |
series_label_4 | The series label. |
units_4 | The series units. |
X_5 | The series must be [Nx1] or [1xN]. |
Y_5 | The series must be [Nx1] or [1xN]. |
series_label_5 | The series label. |
units_5 | The series units. |
X_6 | The series must be [Nx1] or [1xN]. |
Y_6 | The series must be [Nx1] or [1xN]. |
series_label_6 | The series label. |
units_6 | The series units. |
isConnected_1 | Are the data points connected. |
color_1 | The color of the data points/line. |
isConnected_2 | Are the data points connected. |
color_2 | The color of the data points/line. |
isConnected_3 | Are the data points connected. |
color_3 | The color of the data points/line. |
isConnected_4 | Are the data points connected. |
color_4 | The color of the data points/line. |
isConnected_5 | Are the data points connected. |
color_5 | The color of the data points/line. |
isConnected_6 | Are the data points connected. |
color_6 | The color of the data points/line. |
isXGridOn | A boolean to indicate if the x grid lines are on. |
isYGridOn | A boolean to indicate if the y grid lines are on. |
includeStats | A boolean to indicate if statistics info should be included on the plot. |
precisionStats | The number of significant digits in the statistics. |
plot_height_cm | The plot height in cm. |
plot_width_cm | The plot width in cm. |
Definition at line 7211 of file Matrix.cpp.
The postfix ++ operator overload. Add +1.0 to all elements and returns matrix values after the increment, e.g. Matrix B = A++. Use Inplace_Increment for a boolean return for safer operation.
Definition at line 4767 of file Matrix.cpp.
The postfix -- operator overload. Subtract 1.0 to all elements and returns matrix values after the increment, e.g. Matrix B = A--. Use Inplace_Decrement for a boolean return for safer operation.
Definition at line 4778 of file Matrix.cpp.
Multiply two matrices and copy the result. Result = mat1 * mat2.
Definition at line 4803 of file Matrix.cpp.
Multiply two matrices and copy the result. Result = mat1 * mat2.
Definition at line 4790 of file Matrix.cpp.
Add two matrices and copy the result. Result = mat1 + mat2.
Definition at line 4819 of file Matrix.cpp.
Add two matrices and copy the result. Result = mat1 + mat2.
Definition at line 4832 of file Matrix.cpp.
Subtract two matrices and copy the result. Result = mat1 - mat2.
Definition at line 4848 of file Matrix.cpp.
Subtract two matrices and copy the result. Result = mat1 - mat2.
Definition at line 4861 of file Matrix.cpp.
Add to a matrix by a scalar variable: ie. A = 2.0 + B and B + 2.0 (adds to 2.0 to all elements).
Definition at line 4890 of file Matrix.cpp.
Subtract a matrix from a scalar variable: ie. A = 2.0 - B == -B + 2.0.
Definition at line 4909 of file Matrix.cpp.
Multiply matrix by a scalar variable: A = 2.0 * B and A = B * 2.0.
Definition at line 4936 of file Matrix.cpp.
Divide matrix into a scalar variable: A = 2.0 / B. e.g. A = [2.0 2.0; 2.0 2.0] / B, B is 2x2.
Definition at line 4974 of file Matrix.cpp.
Element Zenautics::Matrix::m_MatrixElement [protected] |
MTX Zenautics::Matrix::m_Matrix [protected] |
bool Zenautics::Matrix::m_IsMTXInitialized = false [static, protected] |