Class xlifepp::Matrix#
-
template<typename K>
class Matrix : public std::vector<K>#
-
Inheritence diagram for xlifepp::Matrix:
Collaboration diagram for xlifepp::Matrix:
to deal with numeric matrix (say real or complex vector).
inherited from std::vector<K> (dense storage by row) may be used even for matrix of matrices but restricted usage !
Subclassed by xlifepp::MatrixEigenDense< K >
Public Types
Public Functions
-
inline Matrix()#
-
default constructor (1x1 matrix)
-
inline Matrix(const char *f)#
-
constructor from input file given by name
-
inline Matrix(const dimen_t d, const SpecialMatrix sm)#
-
constructor for special square matrix
-
inline Matrix(const dimen_t r, const dimen_t c, const K &v)#
-
constructor for constant rectangular matrix
-
template<typename Iterator>
inline Matrix(const dimen_t r, const dimen_t c, Iterator it_v, Iterator it_ve)#
-
constructor from iterators
-
inline Matrix(const string_t &f)#
-
constructor from input file given by name
-
inline cit_vk begin() const#
-
overloaded const_iterator begin
-
inline void changesize(const dimen_t r, const dimen_t c, const K &v = K())#
-
resize matrix and assign v
-
inline void column(const dimen_t c, const std::vector<K> &v)#
-
set c-th column (c > 0) from a stl vector
-
inline void complexCastWarning(const string_t &s, const size_t r, const size_t c) const#
-
warning: try to cast a complex to a real
-
inline Matrix<K> &diag(const Matrix<K> &m)#
-
change matrix into diagonal matrix made of diagonal of matrix
-
inline Matrix<K> &diag(const std::vector<K> &v)#
-
reset matrix as a diagonal matrix with stl vector entries as diagonal entries
-
inline void divideByZero(const string_t &s) const#
-
error: divide by 0 in matrix operation s matrix dimension dim(op1)
-
inline std::pair<number_t, number_t> elementSize() const
-
return size of element of a matrix of matrices or a matrix of vectors (size of first block!)
-
inline cit_vk end() const#
-
overloaded const_iterator begin
-
inline Matrix<K> get(const std::pair<dimen_t, dimen_t> &rs, const std::pair<dimen_t, dimen_t> &cs) const#
-
return matrix coefficients along rs.first->rs.second and cs.first->cs.second numbers (indices starts from 1)
-
inline Matrix<K> get(const std::vector<dimen_t> &rs, const std::vector<dimen_t> &cs) const#
-
return matrix coefficients along rs and cs numbers (indices starts from 1)
-
inline Matrix<K> get(dimen_t r, const std::pair<dimen_t, dimen_t> &cs) const#
-
shortcuts to get routine
-
inline size_t hsize() const#
-
row length (number of columns)
-
inline bool isSelfAdjoint() const#
-
self adjoint matrix test
-
inline void isSingular() const#
-
error: non invertible matrix
-
inline bool isSkewAdjoint() const#
-
skew adjoint matrix test
-
inline bool isSkewSymmetric() const#
-
skew-symmetric matrix test
-
inline bool isSymmetric() const#
-
symmetric matrix test
-
inline void loadFromFile(const char *f)#
-
load matrix from file read from file a dense matrix, formated as:
nbRows nb_Cols a11 a12 ........ a21 a22 ........ ....
-
inline void mismatchDims(const string_t &s, const size_t r, const size_t c) const#
-
error: in matrix operation s dimensions disagree dim(op1)= … dim(op2)=…
-
inline void nonSquare(const string_t &s, const size_t r, const size_t c) const#
-
error: operation forbidden for non square matrix
-
inline const K &operator()(const dimen_t r, const dimen_t c) const#
-
protected access ( r > 0, c > 0 )
-
inline Matrix<K> operator()(const std::vector<dimen_t> &rs, const std::vector<dimen_t> &cs) const#
-
overload ()
-
template<typename KK>
inline Matrix<K> &operator+=(const Matrix<KK> &b)#
-
accumulated matrix addition A+=B
-
template<typename KK>
inline Matrix<K> &operator-=(const Matrix<KK> &b)#
-
accumulated matrix subtraction (with cast)
-
template<typename KK>
inline Matrix<K> &operator=(const Matrix<KK> &m)#
-
assignment operator=(deep copy)
-
inline Matrix<K> &operator=(const std::vector<std::vector<K>> &vv)#
-
assignment operator= vector of vector
-
inline Matrix<K> &operator=(const std::vector<Vector<K>> &vv)#
-
assignment operator= vector of Vector
-
inline void print() const#
-
write on default file stream
-
inline void print(std::ofstream &os) const#
-
write on a file stream
-
inline Matrix<K> &roundToZero(real_t aszero = 10 * theEpsilon)#
-
round to 0 all coefficients smaller (in norm) than a aszero, storage is not modified
-
inline void saveToFile(const char *f)#
-
save matrix to file
-
inline void set(const std::pair<dimen_t, dimen_t> &rs, const std::pair<dimen_t, dimen_t> &cs, const std::vector<K> &mat)#
-
set matrix coefficients along rs.first->rs.second and cs.first->cs.second numbers (indices starts from 1) rs and cs numbers has to be in current matrix index bounds matrix is given as a vector with row storage
-
inline void set(const std::vector<dimen_t> &rs, const std::vector<dimen_t> &cs, const std::vector<K> &mat)#
-
set matrix coefficients along rs and cs numbers (indices starts from 1) rs and cs numbers has to be in current matrix index bounds matrix is given as a vector with row storage
-
inline void set(dimen_t r, const std::pair<dimen_t, dimen_t> &cs, const std::vector<K> &mat)#
-
shorcuts to set routine
-
true if matrices bear same dimensions
-
inline real_t squaredNorm() const#
-
return squared norm of the matrix
-
inline StrucType strucType() const
-
get structure type
-
inline Matrix<K> subMatrix(number_t r1, number_t r2, number_t c1, number_t c2) const#
-
extract M[r1,r2],[c1,c2], indices start from 1
-
inline string_t typeStr() const#
-
type of matrix as string
-
inline ValueType valueType() const
-
get value type
-
inline size_t vsize() const#
-
column length (number of rows)
-
inline Matrix()#