4#ifndef ROOT_Math_SMatrix
5#define ROOT_Math_SMatrix
70template <
class T,
unsigned int D>
class SVector;
152 template <
class A,
class R2>
169 template<
class InputIterator>
170 SMatrix(InputIterator
begin, InputIterator
end,
bool triang =
false,
bool lower =
true);
183 template<
class InputIterator>
190#ifndef UNSUPPORTED_TEMPLATE_EXPRESSION
193 template<
unsigned int N>
215 template <
class A,
class R2>
296 template<
class InputIterator>
310 template<
class InputIterator>
325 template <
class A,
class R2>
328 template <
class A,
class R2>
342 template <
class A,
class R2>
345 template <
class A,
class R2>
361 const T&
At(
unsigned int i,
unsigned int j)
const;
366 T&
At(
unsigned int i,
unsigned int j);
398 SMatrixRow_const
operator[](
unsigned int i)
const {
return SMatrixRow_const(*
this, i); }
402 SMatrixRow
operator[](
unsigned int i) {
return SMatrixRow(*
this, i); }
419 template <
class A,
class R2>
436 template <
class A,
class R2>
455 template <
class A,
class R2>
546 template <
unsigned int D>
551 template <
class A,
unsigned int D>
556 template <
unsigned int D>
561 template <
class A,
unsigned int D>
566 template <
unsigned int D3,
unsigned int D4,
class R2>
571 template <
class A,
unsigned int D3,
unsigned int D4,
class R2>
591 template <
class SubVector>
592 SubVector
SubRow(
unsigned int therow,
unsigned int col0 = 0 )
const;
599 template <
class SubVector>
600 SubVector
SubCol(
unsigned int thecol,
unsigned int row0 = 0)
const;
607 template <
class SubMatrix >
608 SubMatrix
Sub(
unsigned int row0,
unsigned int col0)
const;
621 template <
class Vector>
636#ifndef UNSUPPORTED_TEMPLATE_EXPRESSION
639 template<
class SubVector>
648#ifndef UNSUPPORTED_TEMPLATE_EXPRESSION
651 template<
class SubVector>
671 std::ostream&
Print(std::ostream& os)
const;
693template <
class T,
unsigned int D1,
unsigned int D2,
class R>
695 return rhs.
Print(os);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Expression wrapper class for Matrix objects.
const SMatrix< T, D1, D2, R > * fMat
const T & operator[](int j) const
SMatrixRow_const(const SMatrix< T, D1, D2, R > &rhs, unsigned int i)
SMatrix< T, D1, D2, R > * fMat
SMatrixRow(SMatrix< T, D1, D2, R > &rhs, unsigned int i)
SMatrix: a generic fixed size D1 x D2 Matrix class.
SVector< T, D1 > Col(unsigned int thecol) const
return a full Matrix column as a vector (copy the content in a new vector)
bool operator>(const SMatrix< T, D1, D2, R2 > &rhs) const
element wise comparison
SMatrix()
Default constructor:
SMatrix< T, D1, D2, R > & operator-=(const T &rhs)
subtraction with a scalar
T apply(unsigned int i) const
access the parse tree with the index starting from zero and following the C convention for the order ...
bool Det2(T &det) const
determinant of square Matrix via Dfact.
SVector< T, D1 *(D2+1)/2 > UpperBlock() const
return the upper Triangular block of the matrices (including the diagonal) as a vector of sizes N = D...
const T & At(unsigned int i, unsigned int j) const
read only access to matrix element, with indices starting from 0.
SMatrix< T, D1, D2, R > & operator*=(const SMatrix< T, D1, D2, R2 > &rhs)
multiplication with another compatible matrix (it is a real matrix multiplication) Note that this ope...
SMatrix< T, D1, D2, R > & operator-=(const Expr< A, T, D1, D2, R2 > &rhs)
subtraction with a compatible matrix expression
bool operator<(const Expr< A, T, D1, D2, R2 > &rhs) const
element wise comparison
bool operator>(const Expr< A, T, D1, D2, R2 > &rhs) const
element wise comparison
bool Det(T &det)
determinant of square Matrix via Dfact.
void SetElements(InputIterator begin, unsigned int size, bool triang=false, bool lower=true)
Constructor with STL iterator interface.
SubVector SubCol(unsigned int thecol, unsigned int row0=0) const
return a slice of the column as a vector starting at the row value row0 until row0+Dsub.
bool operator>(const T &rhs) const
element wise comparison
std::ostream & Print(std::ostream &os) const
Print: used by operator<<().
SMatrix< T, D1, D2, R > & operator=(const M &rhs)
Assign from another compatible matrix.
SMatrix< T, D1, D2, R > & Place_at(const SMatrix< T, D3, D4, R2 > &rhs, unsigned int row, unsigned int col)
place a matrix in this matrix
SMatrix(const SMatrix< T, D1, D2, R2 > &rhs)
construct from a matrix with different representation.
SMatrix< T, D1, D2, R > Inverse(int &ifail) const
Invert a square Matrix and returns a new matrix.
SMatrixRow operator[](unsigned int i)
read/write access to matrix element with indices starting from 0 : m[i][j]
SubMatrix Sub(unsigned int row0, unsigned int col0) const
return a submatrix with the upper left corner at the values (row0, col0) and with sizes N1,...
SMatrix< T, D1, D2, R > & operator*=(const T &rhs)
multiplication with a scalar
bool operator<(const T &rhs) const
element wise comparison
bool operator==(const SMatrix< T, D1, D2, R2 > &rhs) const
element wise comparison
void SetElements(InputIterator begin, InputIterator end, bool triang=false, bool lower=true)
Set matrix elements with STL iterator interface.
const_iterator begin() const
STL const_iterator interface.
MatRepStd< double, 2, 2 > fRep
SMatrix(SMatrixNoInit)
construct from without initialization
SMatrix< T, D1, D2, R > & operator+=(const Expr< A, T, D1, D2, R2 > &rhs)
addition with a compatible matrix expression
SMatrix< T, D1, D2, R > InverseFast(int &ifail) const
Invert a square Matrix and returns a new matrix.
T * Array()
return pointer to internal array
SMatrix(const Expr< A, T, D1, D2, R2 > &rhs)
Construct from an expression.
bool operator==(const T &rhs) const
element wise comparison
SMatrixRow_const operator[](unsigned int i) const
read only access to matrix element, with indices starting from 0 : m[i][j]
SMatrix< T, D1, D2, R > & Place_in_row(const SVector< T, D > &rhs, unsigned int row, unsigned int col)
place a vector in a Matrix row
SVector< T, D1 > Diagonal() const
return diagonal elements of a matrix as a Vector.
SMatrix< T, D1, D2, R > InverseChol(int &ifail) const
Invert of a symmetric positive defined Matrix using Choleski decomposition.
void SetDiagonal(const Vector &v)
Set the diagonal elements from a Vector Require that vector implements SVector::kSize since a check (...
SMatrix(const SMatrix< T, D1, D2, R > &rhs)
copy constructor (from a matrix of the same representation
SMatrix(SMatrixIdentity)
construct from an identity matrix
bool operator!=(const T &rhs) const
element wise comparison
SMatrix< T, D1, D2, R > & operator=(SMatrixIdentity)
Assign from an identity matrix.
T * iterator
STL iterator interface.
const T * const_iterator
STL const_iterator interface.
T & At(unsigned int i, unsigned int j)
read/write access to matrix element with indices starting from 0.
SMatrix< T, D1, D2, R > & operator+=(const T &rhs)
addition with a scalar
bool InvertChol()
Inversion of a symmetric positive defined Matrix using Choleski decomposition.
bool Invert()
Invert a square Matrix ( this method changes the current matrix).
bool IsInUse(const T *p) const
Function to check if a matrix is sharing same memory location of the passed pointer This function is ...
SMatrix(const T &rhs)
Construct from a scalar value (only for size 1 matrices).
R rep_type
storage representation type
T & operator()(unsigned int i, unsigned int j)
read/write access to matrix element with indices starting from 0
SMatrix< T, D1, D2, R > & operator=(const Expr< A, T, D1, D2, R2 > &rhs)
Assign from a matrix expression.
SMatrix< T, D1, D2, R > & operator/=(const T &rhs)
division with a scalar
SMatrix< T, D1, D2, R > & operator=(const T &rhs)
Assign from a scalar value (only for size 1 matrices).
T value_type
contained scalar type
bool operator<(const SMatrix< T, D1, D2, R2 > &rhs) const
element wise comparison
bool InvertFast()
Fast inversion of a square Matrix ( this method changes the current matrix).
SVector< T, D1 *(D2+1)/2 > LowerBlock() const
return the lower Triangular block of the matrices (including the diagonal) as a vector of sizes N = D...
SMatrix< T, D1, D2, R > & Place_in_row(const VecExpr< A, T, D > &rhs, unsigned int row, unsigned int col)
place a vector expression in a Matrix row
bool operator!=(const Expr< A, T, D1, D2, R2 > &rhs) const
element wise comparison
SMatrix(InputIterator begin, unsigned int size, bool triang=false, bool lower=true)
Constructor with STL iterator interface.
SMatrix< T, D1, D2, R > & operator+=(const SMatrix< T, D1, D2, R2 > &rhs)
addition with another matrix of any compatible representation
T Trace() const
return the trace of a matrix Sum of the diagonal elements
SMatrix< T, D1, D2, R > & Place_at(const Expr< A, T, D3, D4, R2 > &rhs, unsigned int row, unsigned int col)
place a matrix expression in this matrix
SMatrix(InputIterator begin, InputIterator end, bool triang=false, bool lower=true)
Constructor with STL iterator interface.
bool operator==(const Expr< A, T, D1, D2, R2 > &rhs) const
element wise comparison
SubVector SubRow(unsigned int therow, unsigned int col0=0) const
return a slice of therow as a vector starting at the column value col0 until col0+N,...
const_iterator end() const
STL const_iterator interface.
SMatrix< T, D1, D2, R > & operator=(const SMatrix< T, D1, D2, R > &rhs)
bool operator!=(const SMatrix< T, D1, D2, R > &rhs) const
element wise comparison
SMatrix< T, D1, D2, R > & operator-=(const SMatrix< T, D1, D2, R2 > &rhs)
subtraction with another matrix of any compatible representation
const T & operator()(unsigned int i, unsigned int j) const
read only access to matrix element, with indices starting from 0
SVector< T, D2 > Row(unsigned int therow) const
return a full Matrix row as a vector (copy the content in a new vector)
SMatrix(const SVector< T, D1 *(D2+1)/2 > &v, bool lower=true)
constructor of a symmetrix a matrix from a SVector containing the lower (upper) triangular part.
const T * Array() const
return read-only pointer to internal array
SMatrix< T, D1, D2, R > & Place_in_col(const VecExpr< A, T, D > &rhs, unsigned int row, unsigned int col)
place a vector expression in a Matrix column
SMatrix< T, D1, D2, R > & Place_in_col(const SVector< T, D > &rhs, unsigned int row, unsigned int col)
place a vector in a Matrix column
SMatrix< T, D1, D2, R > & operator*=(const Expr< A, T, D1, D2, R2 > &rhs)
multiplication with a compatible matrix expression (it is a real matrix multiplication)
SVector: a generic fixed size Vector class.
Expression wrapper class for Vector objects.
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
namespace associated R package for ROOT.