ldmat Class Reference

Matrix stored in LD form, (typically known as UD). More...

#include <libDC.h>

Inheritance diagram for ldmat:

Inheritance graph
[legend]
Collaboration diagram for ldmat:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ldmat (const mat &L, const vec &D)
 Construct by copy of L and D.
 ldmat (const mat &V)
 Construct by decomposition of full matrix V.
 ldmat (vec D0)
 Construct diagonal matrix with diagonal D0.
 ldmat ()
 Default constructor.
 ldmat (const int dim0)
 Default initialization with proper size.
virtual ~ldmat ()
 Destructor for future use;.
void opupdt (const vec &v, double w)
mat to_mat ()
 Conversion to full matrix.
void mult_sym (const mat &C)
 Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.
void mult_sym_t (const mat &C)
 Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.
void add (const ldmat &ld2, double w=1.0)
 Add another matrix in LD form with weight w.
double logdet () const
 Logarithm of a determinant.
double qform (const vec &v) const
 Evaluates quadratic form $x= v'*V*v$;.
double invqform (const vec &v) const
 Evaluates quadratic form $x= v'*inv(V)*v$;.
void clear ()
 Clearing matrix so that it corresponds to zeros.
int cols () const
 access function
int rows () const
 access function
vec sqrt_mult (const vec &v) const
 Multiplies square root of $V$ by vector $x$.
virtual void inv (ldmat &Inv) const
 Matrix inversion preserving the chosen form.
void mult_sym (const mat &C, ldmat &U) const
 Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.
void mult_sym_t (const mat &C, ldmat &U) const
 Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.
void ldform (const mat &A, const vec &D0)
 Transforms general $A'D0 A$ into pure $L'DL$.
void setD (const vec &nD)
 Access functions.
void setD (const vec &nD, int i)
 Access functions.
void setL (const vec &nL)
 Access functions.
const vec & _D () const
 Access functions.
const mat & _L () const
 Access functions.
ldmatoperator+= (const ldmat &ldA)
 add another ldmat matrix
ldmatoperator-= (const ldmat &ldA)
 subtract another ldmat matrix
ldmatoperator*= (double x)
 multiply by a scalar

Protected Attributes

vec D
 Positive vector $D$.
mat L
 Lower-triangular matrix $L$.

Friends

std::ostream & operator<< (std::ostream &os, const ldmat &sq)
 print both L and D


Detailed Description

Matrix stored in LD form, (typically known as UD).

Matrix is decomposed as follows:

\[M = L'DL\]

where only $L$ and $D$ matrices are stored. All inplace operations modifies only these and the need to compose and decompose the matrix is avoided.


Member Function Documentation

void ldmat::opupdt ( const vec &  v,
double  w 
) [virtual]

Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$.

Parameters:
v Vector forming the outer product to be added
w weight of updating; can be negative
BLAS-2b operation.

Implements sqmat.

References D, sqmat::dim, and L.

Referenced by add(), ARX::bayes(), and inv().

void ldmat::mult_sym ( const mat &  C  )  [virtual]

Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.

Parameters:
C multiplying matrix,

Implements sqmat.

References D, L, and ldform().

void ldmat::mult_sym_t ( const mat &  C  )  [virtual]

Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.

Parameters:
C multiplying matrix,

Implements sqmat.

References D, L, and ldform().

vec ldmat::sqrt_mult ( const vec &  v  )  const [virtual]

Multiplies square root of $V$ by vector $x$.

Used e.g. in generating normal samples.

Implements sqmat.

References D, sqmat::dim, and L.

void ldmat::inv ( ldmat Inv  )  const [virtual]

Matrix inversion preserving the chosen form.

Parameters:
Inv a space where the inverse is stored.

References clear(), D, sqmat::dim, L, and opupdt().

void ldmat::mult_sym ( const mat &  C,
ldmat U 
) const

Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.

Parameters:
C matrix to multiply with
U a space where the inverse is stored.

References D, L, and ldform().

void ldmat::mult_sym_t ( const mat &  C,
ldmat U 
) const

Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.

Parameters:
C matrix to multiply with
U a space where the inverse is stored.

References D, L, and ldform().

void ldmat::ldform ( const mat &  A,
const vec &  D0 
)

Transforms general $A'D0 A$ into pure $L'DL$.

The new decomposition fullfills: $A'*diag(D)*A = self.L'*diag(self.D)*self.L$

Parameters:
A general matrix
D0 general vector

References D, sqmat::dim, and L.

Referenced by ldmat(), mult_sym(), and mult_sym_t().

ldmat & ldmat::operator+= ( const ldmat ldA  )  [inline]

add another ldmat matrix

Operations: mapping of add operation to operators

ldmat & ldmat::operator-= ( const ldmat ldA  )  [inline]

subtract another ldmat matrix

mapping of negative add operation to operators


The documentation for this class was generated from the following files:

Generated on Fri May 9 23:06:43 2008 for mixpp by  doxygen 1.5.5