PLearn 0.1
Public Member Functions | Public Attributes
PLearn::MatTPlusSumSquaredVec< MatT > Class Template Reference

#include <GenMat.h>

Collaboration diagram for PLearn::MatTPlusSumSquaredVec< MatT >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MatTPlusSumSquaredVec (MatT &A, int alloc_n_vectors)
 MatTPlusSumSquaredVec (MatT &A, Mat &X)
void squaredVecAcc (Vec &x)
int length () const
int width () const
void product (const Vec &x, Vec &y)
 y = A + sum_t x_t x_t' x
void diag (Vec &d)
void diagonalOfSquare (Vec &d)

Public Attributes

MatT & A_
Mat X_
 the rows of X are the above x_t's

Detailed Description

template<class MatT>
class PLearn::MatTPlusSumSquaredVec< MatT >

Represents A + sum_{t=1}^T x_t x_t' procedurally keep a generic matrix A and a set of vectors x_t, and performing the matrix vector product with A v + sum_t x_t (x_t . v) The generic matrix A must have the following operations:

void product(const Vec& x, Vec& y); < y = A * x void diagonalOfSquare(Vec& d); < d[i] = |A[i]|^2 where A[i] could either be i-th row or col void diag(Vec& d); < d[i] = A[i,i] int length(); int width();

Definition at line 157 of file GenMat.h.


Constructor & Destructor Documentation

template<class MatT>
PLearn::MatTPlusSumSquaredVec< MatT >::MatTPlusSumSquaredVec ( MatT &  A,
int  alloc_n_vectors 
) [inline]

Definition at line 163 of file GenMat.h.

                                                        : A_(A), X_(alloc_n_vectors,A.length())
    { X_.resize(0,A.length()); }
template<class MatT>
PLearn::MatTPlusSumSquaredVec< MatT >::MatTPlusSumSquaredVec ( MatT &  A,
Mat X 
) [inline]

Definition at line 165 of file GenMat.h.

References PLERROR, and PLearn::TMat< T >::width().

                                           : A_(A), X_(X) 
    { 
        if (X.width()!=A.length() || A.length()!=A.width()) 
            PLERROR("MatTPlusSumSquaredVec(MatT,Mat) arguments don't match"); 
    }

Here is the call graph for this function:


Member Function Documentation

template<class MatT>
void PLearn::MatTPlusSumSquaredVec< MatT >::diag ( Vec d) [inline]

Definition at line 188 of file GenMat.h.

References PLearn::diag(), and PLearn::squareAcc().

    { 
        diag(A_, d); 
        for (int t=0;t<X_.length();t++)
            squareAcc(d, X_(t));
    }

Here is the call graph for this function:

template<class MatT>
void PLearn::MatTPlusSumSquaredVec< MatT >::diagonalOfSquare ( Vec d) [inline]

Definition at line 194 of file GenMat.h.

References PLERROR.

    { PLERROR("MatTPlusSumSquaredVec::diagonalOfSquare not implemented"); }
template<class MatT>
int PLearn::MatTPlusSumSquaredVec< MatT >::length ( ) const [inline]

Definition at line 175 of file GenMat.h.

{ return A_.length(); }
template<class MatT>
void PLearn::MatTPlusSumSquaredVec< MatT >::product ( const Vec x,
Vec y 
) [inline]

y = A + sum_t x_t x_t' x

Definition at line 178 of file GenMat.h.

References PLearn::dot(), PLearn::multiplyAcc(), and PLearn::product().

    {
        product(A_, x,y);
        for (int t=0;t<X_.length();t++)
        {
            Vec x_t = X_(t);
            multiplyAcc(y, x_t,dot(x_t,x));
        }
    }

Here is the call graph for this function:

template<class MatT>
void PLearn::MatTPlusSumSquaredVec< MatT >::squaredVecAcc ( Vec x) [inline]

Definition at line 170 of file GenMat.h.

Referenced by PLearn::SymmMatNullSpaceByInversePowerIteration().

    {
        X_.resize(X_.length()+1,X_.width());
        X_(X_.length()-1) << x;
    }

Here is the caller graph for this function:

template<class MatT>
int PLearn::MatTPlusSumSquaredVec< MatT >::width ( ) const [inline]

Definition at line 176 of file GenMat.h.

{ return A_.width(); }

Member Data Documentation

template<class MatT>
MatT& PLearn::MatTPlusSumSquaredVec< MatT >::A_

Definition at line 160 of file GenMat.h.

template<class MatT>
Mat PLearn::MatTPlusSumSquaredVec< MatT >::X_

the rows of X are the above x_t's

Definition at line 161 of file GenMat.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines