library: libMatrix #include "TMatrixDSym.h" |
TMatrixDSym
class description - source file - inheritance tree (.pdf)
protected:
virtual void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb = 0, Int_t col_lwb = 0, Int_t init = 0, Int_t nr_nonzeros = -1)
void AMultA(const TMatrixDSym& a, Int_t constr = 1)
void AtMultA(const TMatrixD& a, Int_t constr = 1)
void AtMultA(const TMatrixDSym& a, Int_t constr = 1)
void Delete_m(Int_t size, Double_t*&)
Int_t Memcpy_m(Double_t* newp, const Double_t* oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
Double_t* New_m(Int_t size)
public:
TMatrixDSym()
TMatrixDSym(Int_t nrows)
TMatrixDSym(Int_t row_lwb, Int_t row_upb)
TMatrixDSym(Int_t nrows, const Double_t* data, Option_t* option = "")
TMatrixDSym(Int_t row_lwb, Int_t row_upb, const Double_t* data, Option_t* option = "")
TMatrixDSym(const TMatrixDSym& another)
TMatrixDSym(const TMatrixFSym& another)
TMatrixDSym(TMatrixDBase::EMatrixCreatorsOp1 op, const TMatrixDSym& prototype)
TMatrixDSym(TMatrixDBase::EMatrixCreatorsOp1 op, const TMatrixD& prototype)
TMatrixDSym(const TMatrixDSym& a, TMatrixDBase::EMatrixCreatorsOp2 op, const TMatrixDSym& b)
TMatrixDSym(const TMatrixDSymLazy& lazy_constructor)
TMatrixDSym GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
virtual ~TMatrixDSym()
virtual TMatrixDBase& Apply(const TElementActionD& action)
virtual TMatrixDBase& Apply(const TElementPosActionD& action)
static TClass* Class()
virtual void Clear(Option_t* = "")
virtual Double_t Determinant() const
virtual void Determinant(Double_t& d1, Double_t& d2) const
const TMatrixD EigenVectors(TVectorD& eigenValues) const
virtual const Int_t* GetColIndexArray() const
virtual Int_t* GetColIndexArray()
virtual const Double_t* GetMatrixArray() const
virtual Double_t* GetMatrixArray()
virtual const Int_t* GetRowIndexArray() const
virtual Int_t* GetRowIndexArray()
TMatrixDSym& GetSub(Int_t row_lwb, Int_t row_upb, TMatrixDSym& target, Option_t* option = "S") const
virtual TMatrixDBase& GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixDBase& target, Option_t* option = "S") const
TMatrixDSym& Invert(Double_t* det = 0)
TMatrixDSym& InvertFast(Double_t* det = 0)
virtual TClass* IsA() const
virtual Bool_t IsSymmetric() const
virtual Double_t operator()(Int_t rown, Int_t coln) const
virtual Double_t& operator()(Int_t rown, Int_t coln)
TMatrixDSym& operator*=(Double_t val)
TMatrixDSym& operator+=(Double_t val)
TMatrixDSym& operator+=(const TMatrixDSym& source)
TMatrixDSym& operator-=(Double_t val)
TMatrixDSym& operator-=(const TMatrixDSym& source)
TMatrixDSym& operator=(const TMatrixDSym& source)
TMatrixDSym& operator=(const TMatrixFSym& source)
TMatrixDSym& operator=(const TMatrixDSymLazy& source)
TMatrixDSym& operator=(Double_t val)
const TMatrixDRow_const operator[](Int_t rown) const
TMatrixDRow operator[](Int_t rown)
virtual TMatrixDBase& Randomize(Double_t alpha, Double_t beta, Double_t& seed)
virtual TMatrixDSym& RandomizePD(Double_t alpha, Double_t beta, Double_t& seed)
TMatrixDSym& Rank1Update(const TVectorD& v, Double_t alpha = 1.0)
virtual TMatrixDBase& ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros = -1)
virtual TMatrixDBase& ResizeTo(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros = -1)
TMatrixDBase& ResizeTo(const TMatrixDSym& m)
virtual TMatrixDBase& SetColIndexArray(Int_t*)
virtual TMatrixDBase& SetMatrixArray(const Double_t* data, Option_t* option = "")
virtual TMatrixDBase& SetRowIndexArray(Int_t*)
TMatrixDSym& SetSub(Int_t row_lwb, const TMatrixDBase& source)
virtual TMatrixDBase& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixDBase& source)
virtual TMatrixDBase& Shift(Int_t row_shift, Int_t col_shift)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
TMatrixDSym& Similarity(const TMatrixD& n)
TMatrixDSym& Similarity(const TMatrixDSym& n)
TMatrixDSym& SimilarityT(const TMatrixD& n)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TMatrixDSym& T()
TMatrixDSym& Transpose(const TMatrixDSym& source)
TMatrixDSym& Use(Int_t nrows, Double_t* data)
TMatrixDSym& Use(Int_t row_lwb, Int_t row_upb, Double_t* data)
TMatrixDSym& Use(TMatrixDSym& a)
protected:
Double_t fDataStack[25] ! data container
Double_t* fElements [fNelems] elements themselves
TMatrixDSym
Implementation of a symmetric matrix in the linear algebra package
Note that in this implementation both matrix element m[i][j] and
m[j][i] are updated and stored in memory . However, when making the
object persistent only the upper right triangle is stored .
TMatrixDSym(Int_t no_rows)
TMatrixDSym(Int_t row_lwb,Int_t row_upb)
TMatrixDSym(Int_t no_rows,const Double_t *elements,Option_t *option)
option="F": array elements contains the matrix stored column-wise
like in Fortran, so a[i,j] = elements[i+no_rows*j],
else it is supposed that array elements are stored row-wise
a[i,j] = elements[i*no_cols+j]
array elements are copied
TMatrixDSym(Int_t row_lwb,Int_t row_upb,const Double_t *elements,Option_t *option)
array elements are copied
TMatrixDSym(const TMatrixDSym &another) : TMatrixDBase()
TMatrixDSym(const TMatrixFSym &another) : TMatrixDBase()
TMatrixDSym(EMatrixCreatorsOp1 op,const TMatrixDSym &prototype)
Create a matrix applying a specific operation to the prototype.
Example: TMatrixDSym a(10,12); ...; TMatrixDSym b(TMatrixDBase::kTransposed, a);
Supported operations are: kZero, kUnit, kTransposed, kInverted and kAtA.
TMatrixDSym(EMatrixCreatorsOp1 op,const TMatrixD &prototype)
TMatrixDSym(const TMatrixDSym &a,EMatrixCreatorsOp2 op,const TMatrixDSym &b)
TMatrixDSym(const TMatrixDSymLazy &lazy_constructor)
void Delete_m(Int_t size,Double_t *&m)
delete data pointer m, if it was assigned on the heap
Double_t* New_m(Int_t size)
return data pointer . if requested size <= kSizeMax, assign pointer
to the stack space
Int_t Memcpy_m(Double_t *newp,const Double_t *oldp,Int_t copySize,
Int_t newSize,Int_t oldSize)
copy copySize doubles from *oldp to *newp . However take care of the
situation where both pointers are assigned to the same stack space
void Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb,Int_t col_lwb,
Int_t init,Int_t /*nr_nonzeros*/)
Allocate new matrix. Arguments are number of rows, columns, row
lowerbound (0 default) and column lowerbound (0 default).
void AtMultA(const TMatrixD &a,Int_t constr)
Create a matrix C such that C = A' * A. In other words,
c[i,j] = SUM{ a[k,i] * a[k,j] }. Note, matrix C is allocated for constr=1.
void AtMultA(const TMatrixDSym &a,Int_t constr)
Matrix multiplication, with A symmetric
Create a matrix C such that C = A' * A = A * A = A * A'
Note, matrix C is allocated for constr=1.
TMatrixDSym& Use(Int_t row_lwb,Int_t row_upb,Double_t *data)
TMatrixDSym& GetSub(Int_t row_lwb,Int_t row_upb,TMatrixDSym &target,Option_t *option) const
Get submatrix [row_lwb..row_upb][row_lwb..row_upb]; The indexing range of the
returned matrix depends on the argument option:
option == "S" : return [0..row_upb-row_lwb+1][0..row_upb-row_lwb+1] (default)
else : return [row_lwb..row_upb][row_lwb..row_upb]
TMatrixDBase& GetSub(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
TMatrixDBase &target,Option_t *option) const
Get submatrix [row_lwb..row_upb][col_lwb..col_upb]; The indexing range of the
returned matrix depends on the argument option:
option == "S" : return [0..row_upb-row_lwb+1][0..col_upb-col_lwb+1] (default)
else : return [row_lwb..row_upb][col_lwb..col_upb]
TMatrixDSym& SetSub(Int_t row_lwb,const TMatrixDBase &source)
Insert matrix source starting at [row_lwb][row_lwb], thereby overwriting the part
[row_lwb..row_lwb+nrows_source][row_lwb..row_lwb+nrows_source];
TMatrixDBase& SetSub(Int_t row_lwb,Int_t col_lwb,const TMatrixDBase &source)
Insert matrix source starting at [row_lwb][col_lwb] in a symmetric fashion, thereby overwriting the part
[row_lwb..row_lwb+nrows_source][row_lwb..row_lwb+nrows_source];
TMatrixDBase& SetMatrixArray(const Double_t *data,Option_t *option)
TMatrixDBase& Shift(Int_t row_shift,Int_t col_shift)
TMatrixDBase& ResizeTo(Int_t nrows,Int_t ncols,Int_t /*nr_nonzeros*/)
Set size of the matrix to nrows x ncols
New dynamic elements are created, the overlapping part of the old ones are
copied to the new structures, then the old elements are deleted.
TMatrixDBase& ResizeTo(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
Int_t /*nr_nonzeros*/)
Set size of the matrix to [row_lwb:row_upb] x [col_lwb:col_upb]
New dynamic elemenst are created, the overlapping part of the old ones are
copied to the new structures, then the old elements are deleted.
Double_t Determinant() const
void Determinant(Double_t &d1,Double_t &d2) const
TMatrixDSym& Invert(Double_t *det)
Invert the matrix and calculate its determinant
Notice that we need to invoke an additional LU decomposition in order to
calculate the determinant beacuse the Bunch-Kaufman does not result in a
convenient triagularr matrix .
TMatrixDSym& InvertFast(Double_t *det)
Invert the matrix and calculate its determinant
TMatrixDSym& Transpose(const TMatrixDSym &source)
Transpose a matrix.
TMatrixDSym& Rank1Update(const TVectorD &v,Double_t alpha)
Perform a rank 1 operation on the matrix:
A += alpha * v * v^T
TMatrixDSym& Similarity(const TMatrixD &b)
Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb)
This is a similarity transform when B is orthogonal . It is more
efficient than applying the actual multiplication because this
routine realizes that the final matrix is symmetric .
TMatrixDSym& Similarity(const TMatrixDSym &b)
Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb)
This is a similarity transform when B is orthogonal . It is more
efficient than applying the actual multiplication because this
routine realizes that the final matrix is symmetric .
TMatrixDSym& SimilarityT(const TMatrixD &b)
Calculate B^T * (*this) * B , final matrix will be (ncolsb x ncolsb)
It is more efficient than applying the actual multiplication because this
routine realizes that the final matrix is symmetric .
TMatrixDBase& Apply(const TElementActionD &action)
TMatrixDBase& Apply(const TElementPosActionD &action)
Apply action to each element of the matrix. To action the location
of the current element is passed.
TMatrixDBase& Randomize(Double_t alpha,Double_t beta,Double_t &seed)
randomize matrix element values but keep matrix symmetric
TMatrixDSym& RandomizePD(Double_t alpha,Double_t beta,Double_t &seed)
randomize matrix element values but keep matrix symmetric positive definite
const TMatrixD EigenVectors(TVectorD &eigenValues) const
Return a matrix containing the eigen-vectors ordered by descending eigen-values.
For full functionality use TMatrixDSymEigen .
void Streamer(TBuffer &R__b)
Stream an object of class TMatrixDSym.
Inline Functions
void ~TMatrixDSym()
void AMultA(const TMatrixDSym& a, Int_t constr = 1)
TMatrixDSym TMatrixDSym(const TMatrixDSymLazy& lazy_constructor)
const Double_t* GetMatrixArray() const
Double_t* GetMatrixArray()
const Int_t* GetRowIndexArray() const
Int_t* GetRowIndexArray()
const Int_t* GetColIndexArray() const
Int_t* GetColIndexArray()
TMatrixDBase& SetRowIndexArray(Int_t*)
TMatrixDBase& SetColIndexArray(Int_t*)
void Clear(Option_t* = "")
Bool_t IsSymmetric() const
TMatrixDSym& Use(Int_t row_lwb, Int_t row_upb, Double_t* data)
TMatrixDSym& Use(TMatrixDSym& a)
TMatrixDSym GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
TMatrixDBase& ResizeTo(const TMatrixDSym& m)
TMatrixDSym& T()
Double_t operator()(Int_t rown, Int_t coln) const
Double_t& operator()(Int_t rown, Int_t coln)
const TMatrixDRow_const operator[](Int_t rown) const
TMatrixDRow operator[](Int_t rown)
TMatrixDSym& operator=(const TMatrixDSym& source)
TMatrixDSym& operator=(const TMatrixFSym& source)
TMatrixDSym& operator=(const TMatrixDSymLazy& source)
TMatrixDSym& operator=(Double_t val)
TMatrixDSym& operator-=(Double_t val)
TMatrixDSym& operator+=(Double_t val)
TMatrixDSym& operator*=(Double_t val)
TMatrixDSym& operator+=(const TMatrixDSym& source)
TMatrixDSym& operator-=(const TMatrixDSym& source)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void StreamerNVirtual(TBuffer& b)
Last update: root/matrix:$Name: $:$Id: TMatrixDSym.cxx,v 1.23 2005/03/28 20:38:35 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.