QMatrix Class Reference

Inheritance diagram for QMatrix:

QObject List of all members.

Detailed Description

Interface for matrices in Cuore analysis.

Every class written within the CUORE framework should use this class for matrix handling


Public Member Functions

 QMatrix ()
 default constructor
 QMatrix (int nrow, int ncol)
 constructor nrow x ncol
 QMatrix (const QVector &vec)
 constructor from QVector
 QMatrix (const QMatrix &orig)
 copy constructor
virtual ~QMatrix ()
 destructor
void Resize (int nrow, int ncol)
 resize a QMatrix
int GetNRow () const
 get number rows
int GetNCol () const
 get number of columns
void Initialize (double val=0)
 initialize all elements (default to 0)
void SetToIdentity ()
 initialize to identity
void SetCol (int ncol, const QVector &vec)
 set column to specific vector
void SetRow (int nrow, const QVector &vec)
 set row to specific vectors
void Set (const std::map< int, int > &p)
 get a QMatrix from a map
QVector GetCol (int ncol) const
 get column
QVector GetRow (int nrow) const
 get row
QVector GetRowByColumnIntValue (int col, int val) const
 get row matching the integer value val in column col if more than one value is found in column the first matching row is returned
double & operator() (int i, int j)
 retrieve an element
double operator() (int i, int j) const
 retrieve an element
const QMatrixoperator= (const QMatrix &orig)
 copy the content of another matrix
QMatrix operator- ()
 revert sign to alla components
const QMatrixoperator *= (double t)
 multiplication by scalar
const QMatrixoperator *= (const QMatrix &other)
 multiplication by another QMatrix
const QMatrixoperator/= (double t)
 division by scalar
const QMatrixoperator+= (const QMatrix &mat)
 add a QMatrix
const QMatrixoperator-= (const QMatrix &mat)
 subtract a QMatrix
const QMatrixMult (const QMatrix &mat)
 Multiply element by element.
const QMatrixDiv (const QMatrix &mat)
 Divide element by element.
QMatrix operator * (const QMatrix &mat)
 Matrix product.
QMatrix operator * (double t)
 Multiplication by scalar.
QMatrix operator/ (double t)
 Division by scalar.
QMatrix operator+ (const QMatrix &mat)
 sum matrix
QMatrix operator- (const QMatrix &mat)
 subtract matrix
QVector operator * (const QVector &vec)
 matrix-vector product
QMatrix T () const
 transpose
const QMatrixTranspose ()
 transpose
QMatrix Inv () const
 inverse
const QMatrixInvert ()
 inverse
double Det () const
 Determinant.

Protected Member Functions

 QMatrix (const gsl_matrix *mat)
 constructor from gsl_matrix

Private Attributes

gsl_matrix * m

Friends

class QVector


Constructor & Destructor Documentation

QMatrix::QMatrix ( int  nrow,
int  ncol 
)

constructor nrow x ncol

Parameters:
nrow number of rows
ncol number of columns

QMatrix::QMatrix ( const QVector vec  ) 

constructor from QVector

Parameters:
vec QVector of origin

QMatrix::QMatrix ( const QMatrix orig  ) 

copy constructor

Parameters:
orig QMatrix of origin

QMatrix::QMatrix ( const gsl_matrix *  mat  )  [protected]

constructor from gsl_matrix

Parameters:
mat gsl_matrix of origin


Member Function Documentation

void QMatrix::Resize ( int  nrow,
int  ncol 
)

resize a QMatrix

Parameters:
nrow new number of rows
ncol new number of cols
Returns:
none

int QMatrix::GetNRow (  )  const [inline]

get number rows

Returns:
number of rows

int QMatrix::GetNCol (  )  const [inline]

get number of columns

Returns:
number of columns

void QMatrix::Initialize ( double  val = 0  ) 

initialize all elements (default to 0)

Parameters:
val initialization value

void QMatrix::SetCol ( int  ncol,
const QVector vec 
)

set column to specific vector

Parameters:
ncol column index
vec initialization vector

void QMatrix::SetRow ( int  nrow,
const QVector vec 
)

set row to specific vectors

Parameters:
nrow row index
vec initialization vector

void QMatrix::Set ( const std::map< int, int > &  p  ) 

get a QMatrix from a map

Parameters:
std::map<int,int> @

QVector QMatrix::GetCol ( int  ncol  )  const

get column

Parameters:
ncol col index
Returns:
vec column with index ncol

QVector QMatrix::GetRow ( int  nrow  )  const

get row

Parameters:
nrow row index
Returns:
vec row with index nrow

QVector QMatrix::GetRowByColumnIntValue ( int  col,
int  val 
) const

get row matching the integer value val in column col if more than one value is found in column the first matching row is returned

Parameters:
col column index
val value to be matched
Returns:
QVector Row

double & QMatrix::operator() ( int  i,
int  j 
)

retrieve an element

Parameters:
i ith row
j jth col
Returns:
element i of the QVector

double QMatrix::operator() ( int  i,
int  j 
) const

retrieve an element

version for objects that cannot modify the QMatrix

Parameters:
i ith row
j jth col
Returns:
element i of the QVector

const QMatrix & QMatrix::operator= ( const QMatrix orig  ) 

copy the content of another matrix

Parameters:
orig QMatrix of origin
Returns:
the same object modified

const QMatrix & QMatrix::operator *= ( double  t  ) 

multiplication by scalar

Parameters:
t 
Returns:
the same object modified

const QMatrix & QMatrix::operator *= ( const QMatrix other  ) 

multiplication by another QMatrix

A*=B; replaces A with a matrix with the appropriate dimensions of A*B (matrix product)

Parameters:
other 
Returns:
the same object modified

const QMatrix & QMatrix::operator/= ( double  t  ) 

division by scalar

Parameters:
t 
Returns:
the same object modified

const QMatrix & QMatrix::operator+= ( const QMatrix mat  ) 

add a QMatrix

Parameters:
mat 
Returns:
the same object modified

const QMatrix & QMatrix::operator-= ( const QMatrix mat  ) 

subtract a QMatrix

Parameters:
mat 
Returns:
the same object modified

const QMatrix & QMatrix::Mult ( const QMatrix mat  ) 

Multiply element by element.

multiply element by element (a'_ij=a_ij*b_ij) --> NOT product between matrices

Parameters:
mat 
Returns:
the same object modified

const QMatrix & QMatrix::Div ( const QMatrix mat  ) 

Divide element by element.

divide element by element (a'_ij=a_ij/b_ij) --> NOT division between matrices

Parameters:
mat 
Returns:
the same object modified

QMatrix QMatrix::operator * ( const QMatrix mat  ) 

Matrix product.

Parameters:
mat right element
Returns:
Matrix product

QMatrix QMatrix::operator * ( double  t  ) 

Multiplication by scalar.

Parameters:
t scalar
Returns:
scaled matrix

QMatrix QMatrix::operator/ ( double  t  ) 

Division by scalar.

Parameters:
t scalar
Returns:
scaled matrix

QMatrix QMatrix::operator+ ( const QMatrix mat  ) 

sum matrix

Parameters:
mat right element
Returns:
sum matrix

QMatrix QMatrix::operator- ( const QMatrix mat  ) 

subtract matrix

Parameters:
mat right element
Returns:
matrix

QVector QMatrix::operator * ( const QVector vec  ) 

matrix-vector product

Parameters:
vec right element
Returns:
vector

QMatrix QMatrix::T (  )  const

transpose

Returns:
transposed matrix

const QMatrix & QMatrix::Transpose (  ) 

transpose

Returns:
the same matrix transposed

QMatrix QMatrix::Inv (  )  const

inverse

Returns:
the inverse matrix

const QMatrix & QMatrix::Invert (  ) 

inverse

Returns:
the same matrix inverted

double QMatrix::Det (  )  const

Determinant.

Returns:
the matrix determinant


The documentation for this class was generated from the following files:
Generated on Fri Mar 6 13:40:44 2009 for CUORE Software by  doxygen 1.5.1