30 #include "../aslUtilities.h" 38 template <
typename T =
double>
class AMatr
46 inline AMatr(
unsigned int nR,
unsigned int nC);
47 inline AMatr(
const AMatr<T> &a);
48 inline AMatr(
unsigned int nR,
unsigned int nC, AVec<T> v);
49 template <
typename T1>
AMatr(
const AMatr<T1> &a);
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];}
59 inline unsigned int getNRow()
const;
60 inline unsigned int getNCol()
const;
61 inline void resize(
unsigned int nR,
unsigned int nCol);
70 template <
typename T> std::ostream& operator<<(std::ostream &f,const AMatr<T> & a);
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):
206 internalVec(a.internalVec)
236 template <
typename T>
241 internalVec.resize(nr*nc);
244 template <
typename T>
247 a.getInternalVec += b.getInternalVec;
251 template <
typename T>
254 return {a.getNRow(),a.getNCol(),a.getInternalVec() + b.getInternalVec()};
257 template <
typename T>
260 return {a.getNRow(),a.getNCol(),a.getInternalVec() - b.getInternalVec()};
263 template <
typename T>
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);
unsigned int getNRow() const
Advanced Simulation Library.
AVec< T > solveSystem(const AMatr< T > &a, const AVec< T > &b)
returns solution of a system of linear equations
void resize(unsigned int nR, unsigned int nCol)
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)
const T & operator()(int i, int j) const
doesn't chek boundaries
const AMatr< T > & operator=(const AMatr &a)
const AVec< T > & getInternalVec() const
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
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.
const T l2(const AVec< T > &a)
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< 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 & operator[](int i)
doesn't chek boundaries
const AMatr< T > operator-(const AMatr< T > &a, const AMatr< T > &b)
const AMatr< T > & operator+=(AMatr< T > &a, const AMatr< T > &b)
T & operator()(int i, int j)
doesn't chek boundaries
unsigned int getNCol() const
const T trace(const AMatr< T > &a)
Trace of a matrix .
AMatr< T > makeAMatr(const AVec< T > &a)
generates a matrix with a row
const T & operator[](int i) const
doesn't chek boundaries
const AMatr< T > operator*(const AMatr< T > &a, const AMatr< T > &b)
T det(const AMatr< T > &m)
computes determinant expression fo cases 2x2 and 3x3 only
AMatr< T > elementProduct(const AVec< T > &a, const AVec< T > &b)
element product of two vectors
const AMatr< T > operator/(const AMatr< T > &b, const T &a)
const AMatr< T > operator+(const AMatr< T > &a, const AMatr< T > &b)
AVec< T > getDiagonal(const AMatr< T > &a)
returns AVec containing the diagonal elements
AMatr< T > inverseMatrix(const AMatr< T > &a)
returns inverse matrix for cases 2x2 and 3x3
AMatr< T > makeAMatrUnit(unsigned int n)
void setRow(unsigned int r, const AVec< T > &a)