ASL
0.1.7
Advanced Simulation Library
|
Go to the documentation of this file.
30 #include "../aslUtilities.h"
38 template <
typename T =
double>
class AMatr
46 inline AMatr(
unsigned int nR,
unsigned int nC);
52 inline T&
operator()(
int i,
int j) {
return internalVec[i*nCol+j];}
54 inline const T&
operator()(
int i,
int j)
const {
return internalVec[i*nCol+j];}
58 inline const T&
operator[](
int i)
const {
return internalVec[i];}
61 inline void resize(
unsigned int nR,
unsigned int nCol);
106 template <
typename T>
127 template <
typename T>
178 template <
typename T>
182 template <
typename T>
186 template <
typename T>
197 template <
typename T>
inline AMatr<T>::AMatr(
unsigned int nR,
unsigned int nC):
203 template <
typename T>
inline AMatr<T>::AMatr(
const AMatr<T> &a):
206 internalVec(a.internalVec)
209 template <
typename T>
inline AMatr<T>::AMatr(
unsigned int nR,
unsigned int nC, AVec<T> v):
216 template <
typename T>
inline AVec<T> & AMatr<T>::getInternalVec()
221 template <
typename T>
inline const AVec<T> & AMatr<T>::getInternalVec()
const
226 template <
typename T>
inline unsigned int AMatr<T>::getNRow()
const
231 template <
typename T>
inline unsigned int AMatr<T>::getNCol()
const
236 template <
typename T>
237 inline void AMatr<T>::resize(
unsigned int nr,
unsigned int nc)
241 internalVec.resize(nr*nc);
244 template <
typename T>
245 inline const AMatr<T> &
operator+=(AMatr<T> & a,
const AMatr<T> & b)
247 a.getInternalVec += b.getInternalVec;
251 template <
typename T>
252 inline const AMatr<T>
operator+ (
const AMatr<T> & a,
const AMatr<T> & b)
254 return {a.getNRow(),a.getNCol(),a.getInternalVec() + b.getInternalVec()};
257 template <
typename T>
258 inline const AMatr<T>
operator- (
const AMatr<T> & a,
const AMatr<T> & b)
260 return {a.getNRow(),a.getNCol(),a.getInternalVec() - b.getInternalVec()};
263 template <
typename T>
264 inline const AMatr<T>
operator/ (
const AMatr<T> & b,
const T & a)
266 return {b.getNRow(), b.getNCol(), b.getInternalVec() / a};
290 void getEValEVecMatSym2x2(
double a,
double b,
double c,
double & l1,
double &
l2,
double & v1x,
double & v1y,
double & v2x,
double & v2y);
312 void getEValEVecMatSym2x2(
double a,
double b,
double c,
double & l1,
double &
l2,
double & v1x,
double & v1y,
double & v2x,
double & v2y);
346 double & l1,
double &
l2,
double & l3,
347 double & v1x,
double & v1y,
double & v1z,
348 double & v2x,
double & v2y,
double & v2z,
349 double & v3x,
double & v3y,
double & v3z);
AMatr(unsigned int nR, unsigned int nC)
AMatr< T > replaceRow(const AMatr< T > &a, const AVec< T > &b, unsigned int r)
generate matrix with content of the matrix a but with replaced row r by vector b<T>
VectorOfElements l2(QuaternionOfElements &a)
L2 norm of a quaternion.
const AVec< T > & getInternalVec() const
AVec< T > getDiagonal(const AMatr< T > &a)
returns AVec containing the diagonal elements
AMatr< T > makeAMatr(const AVec< T > &a)
generates a matrix with a row
SPDistanceFunction operator-(SPDistanceFunction a)
const T & operator[](int i) const
doesn't chek boundaries
AVec< T > getOffDiagonalUp(const AMatr< T > &a)
returns AVec<T> containing the uper off diagonal elements
void setColumn(unsigned int c, const AVec< T > &a)
AMatr(const AMatr< T > &a)
const AMatr< T > & operator=(const AMatr &a)
const T trace(const AMatr< T > &a, const AMatr< T > &b)
Trace of a matrix product .
AMatr(unsigned int nR, unsigned int nC, AVec< T > v)
void getEValEVecMatSym3x3(double a, double b, double c, double e, double f, double g, double &l1, double &l2, double &l3, double &v1x, double &v1y, double &v1z, double &v2x, double &v2y, double &v2z, double &v3x, double &v3y, double &v3z)
Eigenvalues and eigenvectors calcutaion for symetric matrix 2x2.
void resize(unsigned int nR, unsigned int nCol)
unsigned int getNCol() const
T & operator[](int i)
doesn't chek boundaries
AMatr< T > makeAMatr(AVec< T > *a, unsigned int n)
generates a matrix with n rows
AMatr< T > makeAMatr(const AVec< T > &a, const AVec< T > &b)
generates a matrix with two rows
const AMatr< T > operator+(const AMatr< T > &a, const AMatr< T > &b)
void getEValEVecMatSym2x2(double a, double b, double c, double &l1, double &l2, double &v1x, double &v1y, double &v2x, double &v2y)
Eigenvalues and eigenvectors calcutaion for symetric matrix 2x2.
AMatr(const AMatr< T1 > &a)
ComplexNumOfElements operator+(ComplexNumOfElements &a, ComplexNumOfElements &b)
summ of two matrices
const AMatr< T > & operator+=(AMatr< T > &a, const AMatr< T > &b)
const T & operator()(int i, int j) const
doesn't chek boundaries
SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b)
std::ostream & operator<<(std::ostream &f, const AMatr< T > &a)
AVec< T > solveSystem(const AMatr< T > &a, const AVec< T > &b)
returns solution of a system of linear equations
ComplexNumOfElements operator-(ComplexNumOfElements &a, ComplexNumOfElements &b)
difference of two matrices
const AMatr< T > operator/(const AMatr< T > &b, const T &a)
AMatr< T > inverseMatrix(const AMatr< T > &a)
returns inverse matrix for cases 2x2 and 3x3<T>
AMatr< T > elementProduct(const AVec< T > &a, const AVec< T > &b)
element product of two vectors
MatrixOfElements operator/(const MatrixOfElements &a, const VectorOfElements &b)
division of a matrix on a VectorOfElements with 1 element
T & operator()(int i, int j)
doesn't chek boundaries
unsigned int getNRow() const
const T trace(const AMatr< T > &a)
Trace of a matrix .
definition of class АVec<T>
void setRow(unsigned int r, const AVec< T > &a)
VectorOfElements operator+=(const VectorOfElements &a, const VectorOfElements &b)
AMatr< T > makeAMatrUnit(unsigned int n)
Advanced Simulation Library.
AVec< T > & getInternalVec()
AMatr< T > makeAMatr(const AVec< T > &a, const AVec< T > &b, const AVec< T > &c)
generates a matrix with three rows
AMatr< T > replaceColumn(const AMatr< T > &a, const AVec< T > &b, unsigned int c)
generate matrix with content of the matrix a but with replaced column c by vector b<T>
T det(const AMatr< T > &m)
computes determinant expression fo cases 2x2 and 3x3 only