EMatrix
|
#include <EMatrix.h>
Public Member Functions | |
virtual | ~Matrix () |
Virtual destructor, no need though. More... | |
Matrix () | |
Matrix (const Matrix< tData, tRows, tCols > &R) | |
Matrix (tData *tArray) | |
Matrix (const std::initializer_list< tData > &l) | |
const Matrix< tData, tRows, tCols > & | operator= (const Matrix< tData, tRows, tCols > &R) |
const Matrix< tData, tRows, tCols > & | operator= (const std::initializer_list< tData > &l) |
void | load (const tData *tArray) |
tData * | operator[] (size_t iRowIndex) const |
tData & | operator() (size_t iRowIndex, size_t iColIndex) const |
tData & | operator() (size_t iIndex) const |
tData * | pIJ (void) const |
size_t | rows (void) const |
size_t | cols (void) const |
bool | operator== (Matrix< tData, tRows, tCols > &R) |
bool | operator!= (Matrix< tData, tRows, tCols > &R) |
Matrix< tData, tRows, tCols > | operator+ () |
Matrix< tData, tRows, tCols > | operator- () |
Matrix< tData, tRows, tCols > | operator+ (const Matrix< tData, tRows, tCols > &R) |
Matrix< tData, tRows, tCols > | operator- (const Matrix< tData, tRows, tCols > &R) |
Matrix< tData, tRows, tCols > | operator* (const tData &scalar) |
Matrix< tData, tRows, tCols > | operator/ (const tData &scalar) |
template<size_t tColsR> | |
Matrix< tData, tRows, tColsR > | operator* (const Matrix< tData, tCols, tColsR > &R) |
Matrix< tData, tRows, tCols > | operator*= (const Matrix< tData, tRows, tCols > &R) |
Matrix< tData, tRows, tCols > | operator/= (const Matrix< tData, tRows, tCols > &R) |
Matrix< tData, tRows, tCols > | zeros (void) |
Matrix< tData, tRows, tCols > | ones (void) |
Matrix< tData, tRows, tCols > | eye (void) |
Matrix< tData, tRows, tCols > | randn (void) |
tData | n (void) const |
Matrix< tData, tRows, 1 > | u (void) const |
Protected Member Functions | |
void | matalloc (size_t iRowIndex, size_t iColIndex) |
Protected Attributes | |
size_t | iRows |
size_t | iCols |
tData * | ij [tRows] |
tData | storage [tRows *tCols] |
Friends | |
template<class tData0 , size_t tRows0, size_t tCols0> | |
std::ostream & | operator<< (std::ostream &s, const Matrix< tData0, tRows0, tCols0 > &A) |
template<class tData0 , size_t tRows0, size_t tCols0> | |
std::ostream & | octave (std::ostream &s, const Matrix< tData0, tRows0, tCols0 > &A, const char *Aname) |
template<class tData0 , size_t tRows0, size_t tCols0> | |
std::ostream & | octave (std::ostream &s, const Matrix< std::complex< tData0 >, tRows0, tCols0 > &A, const char *Aname) |
template<class tData0 , size_t tRows0, size_t tCols0> | |
Matrix< tData0, tRows0, tCols0 > | operator* (const tData0 &scalar, const Matrix< tData0, tRows0, tCols0 > &R) |
template<class tData0 , size_t tCols0, size_t tRowsT, size_t tRowsB> | |
Matrix< tData0, tRowsT+tRowsB, tCols0 > | operator& (const Matrix< tData0, tRowsT, tCols0 > &Top, const Matrix< tData0, tRowsB, tCols0 > &Bottom) |
template<class tData0 , size_t tRows0, size_t tColsL, size_t tColsR> | |
Matrix< tData0, tRows0, tColsL+tColsR > | operator| (const Matrix< tData0, tRows0, tColsL > &Left, const Matrix< tData0, tRows0, tColsR > &Right) |
template<class tData0 , size_t tRows0, size_t tCols0> | |
Matrix< tData0, tCols0, tRows0 > | trans (const Matrix< tData0, tRows0, tCols0 > &R) |
template<size_t tRows0, size_t tCols0> | |
Matrix< std::complex< float >, tCols0, tRows0 > | trans (const Matrix< std::complex< float >, tRows0, tCols0 > &R) |
template<size_t tRows0, size_t tCols0> | |
Matrix< std::complex< double >, tCols0, tRows0 > | trans (const Matrix< std::complex< double >, tRows0, tCols0 > &R) |
template<class tData0 , size_t tRows0> | |
Matrix< tData0, tRows0, 1 > | diag (const Matrix< tData0, tRows0, tRows0 > &R) |
template<class tData0 , size_t tRows0> | |
Matrix< tData0, tRows0, tRows0 > | diag (const Matrix< tData0, tRows0, 1 > &R) |
template<class tData0 , size_t tCols0> | |
Matrix< tData0, tCols0, tCols0 > | diag (const Matrix< tData0, 1, tCols0 > &R) |
template<class tData0 > | |
Matrix< tData0, 3, 3 > | skew (const Matrix< tData0, 3, 1 > &R) |
template<class tData0 > | |
Matrix< tData0, 3, 1 > | cross (const Matrix< tData0, 3, 1 > &L, const Matrix< tData0, 3, 1 > &R) |
template<class tData0 , size_t tRows0> | |
tData0 | dot (const Matrix< tData0, tRows0, 1 > &L, const Matrix< tData0, tRows0, 1 > &R) |
template<class tData0 , size_t tRows0> | |
tData0 | norm (const Matrix< tData0, tRows0, 1 > &R) |
template<size_t tRows0> | |
Matrix< float, tRows0, tRows0 > | inv (const Matrix< float, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
Matrix< std::complex< float >, tRows0, tRows0 > | inv (const Matrix< std::complex< float >, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
Matrix< double, tRows0, tRows0 > | inv (const Matrix< double, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
Matrix< std::complex< double >, tRows0, tRows0 > | inv (const Matrix< std::complex< double >, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
float | det (const Matrix< float, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
double | det (const Matrix< double, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
std::complex< float > | det (const Matrix< std::complex< float >, tRows0, tRows0 > &R) |
template<size_t tRows0> | |
std::complex< double > | det (const Matrix< std::complex< double >, tRows0, tRows0 > &R) |
template<class tData0 > | |
Matrix< tData0, 3, 3 > | R (tData0 angle, char axis) |
|
virtual |
ematrix::Matrix< tData, tRows, tCols >::Matrix | ( | ) |
Default constructor Usage: Matrix<double,2,3> A;
Definition at line 424 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::matalloc().
|
inline |
Copy constructor (not to be confused with the assignment operator) Usage: Matrix<float,2,3> A; Matrix<float,2,3> B=A;
Definition at line 430 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, ematrix::Matrix< tData, tRows, tCols >::iRows, and ematrix::Matrix< tData, tRows, tCols >::matalloc().
ematrix::Matrix< tData, tRows, tCols >::Matrix | ( | tData * | tArray | ) |
Array initialize contructor Usage: float a[2][3] = {{1.0,2.0,3.0},{4.0,5.0,6.0}}; Matrix<float,2,3> A(&a[0][0]);
Definition at line 437 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::matalloc(), and ematrix::Matrix< tData, tRows, tCols >::storage.
ematrix::Matrix< tData, tRows, tCols >::Matrix | ( | const std::initializer_list< tData > & | l | ) |
STL list initialize contructor (C++11) Usage: Matrix<double,3,3> A = {1.,2.,3.,0.,0.,0.,0,0,0};
Definition at line 444 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, ematrix::Matrix< tData, tRows, tCols >::iRows, and ematrix::Matrix< tData, tRows, tCols >::matalloc().
|
inline |
Get the number of cols in a matrix Usage: size_t i = A.cols();
Definition at line 185 of file EMatrix.h.
References ematrix::operator*(), and ematrix::R().
Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::eye | ( | void | ) |
Set contents to the identity matrix Usage: A.eye();
Definition at line 702 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Referenced by ematrix::inv(), and main().
void ematrix::Matrix< tData, tRows, tCols >::load | ( | const tData * | tArray | ) |
Array assignment Usage: double a[2][3] = {{1.1,2.1,3.1},{4.0,5.0,6.0}}; Matrix<double,2,3> A; A.load(&a[0][0]); Warning: Not congnizant of size, can read from unintended memory location;
Definition at line 472 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::storage.
Referenced by main().
|
protected |
Definition at line 410 of file EMatrix.h.
Referenced by ematrix::Matrix< tData, tRows, tCols >::Matrix().
tData ematrix::Matrix< tData, tRows, tCols >::n | ( | void | ) | const |
Take the norm of two vectors Usage: norm_a = a.n();
Definition at line 814 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::dot.
Referenced by ematrix::det(), ematrix::inv(), main(), and ematrix::Matrix< tData, tRows, tCols >::u().
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::ones | ( | void | ) |
Set contents to tData(1) Usage: A.ones();
Definition at line 694 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Referenced by main().
bool ematrix::Matrix< tData, tRows, tCols >::operator!= | ( | Matrix< tData, tRows, tCols > & | R | ) |
Boolean != operator Usage: if (A != B) ...
Definition at line 555 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::R.
|
inline |
Data access operator for Octave and FORTRAN indexing ... From 1 to n Note this does not imply FORTRAN memory storage Usage: Matrix<double,3,2> A = {1,2,3,4,5,6}; A(1,1) = 8; cerr << A(3,2) << endl; Note this looks similar to the deprecated memory initialize c_tor that uses va_arg. but is not the same thing
Definition at line 477 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
|
inline |
Vector Data access operator for Octave and FORTRAN indexing ... From 1 to n Usage: Matrix<double,6,1> V = {1,2,3,4,5,6}; V(1) = 8; cerr << V(6) << endl; Usage: Matrix<double,1,6> U = {1,2,3,4,5,6}; U(1) = 8; cerr << U(6) << endl; Note a non 1xn or nx1 matrix will assertion fail. Could not determine a way to force compile time error.
Definition at line 486 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator* | ( | const tData & | scalar | ) |
Scalar multiplication operator Usage: C = A * scalar;
Definition at line 600 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
|
inline |
Matrix multiplication operator Usage: C = A * B;
Definition at line 239 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::cols(), ematrix::cross(), ematrix::det(), ematrix::diag(), ematrix::dot(), ematrix::inv(), ematrix::norm(), ematrix::operator&(), ematrix::operator|(), ematrix::R(), ematrix::Matrix< tData, tRows, tCols >::rows(), ematrix::skew(), and ematrix::trans().
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator*= | ( | const Matrix< tData, tRows, tCols > & | R | ) |
Array multiplication operator Usage: C = (A *= B); Must use parentheses This mimics Octave's A .* B operator and not C's x *= 5 operator
Definition at line 630 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator+ | ( | ) |
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator+ | ( | const Matrix< tData, tRows, tCols > & | R | ) |
Addition operator Usage: C = A + B;
Definition at line 575 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator- | ( | ) |
Unary - operator Usage: C = (-A);
Definition at line 565 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator- | ( | const Matrix< tData, tRows, tCols > & | R | ) |
Subtaction operator Usage: C = A - B;
Definition at line 588 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator/ | ( | const tData & | scalar | ) |
Scalar division operator Usage: C = A / scalar;
Definition at line 620 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::operator/= | ( | const Matrix< tData, tRows, tCols > & | R | ) |
Array division operator Usage: C = (A /= B); Must use parentheses This mimics Octave's A ./ B operator and not C's x /= 5 operator
Definition at line 641 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
|
inline |
Assignment operator (not to be confused with the copy constructor) Usage: Y = X - Z;
Definition at line 454 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
|
inline |
STL initializer_list assignment (C++11) Usage: Matrix<double,3,2> A; A = {1.1,2.1,3.1,0.0,0.0,0.0};
Definition at line 463 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
bool ematrix::Matrix< tData, tRows, tCols >::operator== | ( | Matrix< tData, tRows, tCols > & | R | ) |
Boolean == operator Usage: if (A == B) ...
Definition at line 542 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
|
inline |
C like element access (0 to n-1), get and set. Usage: Matrix<double,3,2> A = {1,2,3,4,5,6}; A[0][0] = 7; cerr << A[2][1] << endl; Row operator returns the matrix row corresponding to iRowIndex, Warning: Does not provide column access safety.
Definition at line 117 of file EMatrix.h.
References ematrix::octave().
|
inline |
Get the storage pointer for the data in the matrix This is really only here for the friend functions Try not to use it Usage: tData* ptr = A.pIJ();
Definition at line 171 of file EMatrix.h.
Referenced by ematrix::det(), ematrix::dot(), ematrix::inv(), main(), and ematrix::skew().
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::randn | ( | void | ) |
Set all elements of the current matrix random ~N(0,1); Usage: u.randn();
Definition at line 713 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Referenced by main().
|
inline |
Get the number of rows in a matrix Usage: size_t i = A.rows();
Definition at line 178 of file EMatrix.h.
Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().
Matrix< tData, tRows, 1 > ematrix::Matrix< tData, tRows, tCols >::u | ( | void | ) | const |
return a unit vector in the direction of V Usage: u_v = V.u()
Definition at line 824 of file EMatrix.h.
References ematrix::cgesv_(), ematrix::dgesv_(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::sgesv_(), and ematrix::zgesv_().
Referenced by main(), and ematrix::uv_to_ae().
Matrix< tData, tRows, tCols > ematrix::Matrix< tData, tRows, tCols >::zeros | ( | void | ) |
Set contents to 0x0 Usage: A.zeros();
Definition at line 688 of file EMatrix.h.
References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, and ematrix::Matrix< tData, tRows, tCols >::iRows.
Referenced by main().
|
friend |
|
friend |
Matrix determinent, must link with Lapack Usage: A_det = det(A);
|
friend |
|
friend |
|
friend |
|
friend |
Matrix diagonal like Octave This friend function does not modify input contents. Usage: A_diag = diag(A);
|
friend |
|
friend |
|
friend |
Referenced by ematrix::Matrix< tData, tRows, tCols >::n(), and ematrix::norm().
|
friend |
Matrix inverse, must link with Lapack Usage: A_inv = inv(A);
|
friend |
|
friend |
|
friend |
|
friend |
Take the norm of two vectors Usage: norm_a = norm(a);
Referenced by ematrix::uv_to_ae().
|
friend |
Octave text output format, complex<double> Usage: Matrix< complex<double>,3,3 > ZA; octave(cout,ZA,"ZA") << endl; Can define: #define cout_octave(x) octave(cout,x,#x) for cout_octave(ZA) << endl;
|
friend |
Octave text output format, double Usage: Matrix<double,2,3> A(&a[0][0]); octave(cout,A,"A") << endl; Can define: #define cout_octave(x) octave(cout,x,#x) for cout_octave(A) << endl;
|
friend |
|
friend |
Friend scalar multiplication operator Usage: C = scalar * A;
|
friend |
Overloaded output stream operator << Usage: log_file << A;
|
friend |
|
friend |
Simple Rotation Usage: Rx = R(angle_rad, 'x'); Note that r_ECEF = trans(R(ws*t, 'z'))*r_ECI if ws*t is a positive rotation about the z axis. This is backwards on purpose.
Referenced by ematrix::cross(), ematrix::det(), ematrix::inv(), ematrix::Matrix< tData, tRows, tCols >::operator!=(), ematrix::operator*(), ematrix::TEL(), ematrix::TIE(), and ematrix::trans().
|
friend |
Referenced by ematrix::cross().
|
friend |
|
friend |
|
friend |
|
protected |
Definition at line 59 of file EMatrix.h.
Referenced by ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::Matrix(), ematrix::octave(), ematrix::Matrix< tData, tRows, tCols >::ones(), ematrix::operator&(), ematrix::Matrix< tData, tRows, tCols >::operator()(), ematrix::Matrix< tData, tRows, tCols >::operator*(), ematrix::operator*(), ematrix::Matrix< tData, tRows, tCols >::operator*=(), ematrix::Matrix< tData, tRows, tCols >::operator+(), ematrix::Matrix< tData, tRows, tCols >::operator-(), ematrix::Matrix< tData, tRows, tCols >::operator/(), ematrix::Matrix< tData, tRows, tCols >::operator/=(), ematrix::Matrix< tData, tRows, tCols >::operator=(), ematrix::Matrix< tData, tRows, tCols >::operator==(), ematrix::operator|(), ematrix::Matrix< tData, tRows, tCols >::randn(), and ematrix::Matrix< tData, tRows, tCols >::zeros().
|
protected |
Definition at line 61 of file EMatrix.h.
Referenced by ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::Matrix(), ematrix::Matrix< tData, tRows, tCols >::ones(), ematrix::Matrix< tData, tRows, tCols >::operator()(), ematrix::Matrix< tData, tRows, tCols >::operator*(), ematrix::operator*(), ematrix::Matrix< tData, tRows, tCols >::operator*=(), ematrix::Matrix< tData, tRows, tCols >::operator+(), ematrix::Matrix< tData, tRows, tCols >::operator-(), ematrix::Matrix< tData, tRows, tCols >::operator/(), ematrix::Matrix< tData, tRows, tCols >::operator/=(), ematrix::Matrix< tData, tRows, tCols >::operator=(), ematrix::Matrix< tData, tRows, tCols >::operator==(), ematrix::Matrix< tData, tRows, tCols >::randn(), and ematrix::Matrix< tData, tRows, tCols >::zeros().
|
protected |
Definition at line 59 of file EMatrix.h.
Referenced by ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::Matrix(), ematrix::octave(), ematrix::Matrix< tData, tRows, tCols >::ones(), ematrix::operator&(), ematrix::Matrix< tData, tRows, tCols >::operator()(), ematrix::Matrix< tData, tRows, tCols >::operator*(), ematrix::operator*(), ematrix::Matrix< tData, tRows, tCols >::operator*=(), ematrix::Matrix< tData, tRows, tCols >::operator+(), ematrix::Matrix< tData, tRows, tCols >::operator-(), ematrix::Matrix< tData, tRows, tCols >::operator/(), ematrix::Matrix< tData, tRows, tCols >::operator/=(), ematrix::Matrix< tData, tRows, tCols >::operator=(), ematrix::Matrix< tData, tRows, tCols >::operator==(), ematrix::operator|(), ematrix::Matrix< tData, tRows, tCols >::randn(), and ematrix::Matrix< tData, tRows, tCols >::zeros().
|
protected |
Definition at line 62 of file EMatrix.h.
Referenced by ematrix::Matrix< tData, tRows, tCols >::load(), and ematrix::Matrix< tData, tRows, tCols >::Matrix().