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

#include <GenMat.h>

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

List of all members.

Public Member Functions

 ReverseMatT (MatT &A, real alpha)
int length () const
int width () const
void product (const Vec &x, Vec &y)
 y = alpha * x - A * x
void diag (Vec &d)
void diagonalOfSquare (Vec &d)

Protected Attributes

MatT & A_
real alpha_

Detailed Description

template<class MatT>
class PLearn::ReverseMatT< MatT >

represents (alpha*I-A) procedurally, where A is a square matrix represented by any "standard" matrix type, i.e., which has the 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 107 of file GenMat.h.


Constructor & Destructor Documentation

template<class MatT >
PLearn::ReverseMatT< MatT >::ReverseMatT ( MatT &  A,
real  alpha 
) [inline]

Definition at line 113 of file GenMat.h.

References PLERROR.

                                     : A_(A), alpha_(alpha)
    { 
        if (A.length() != A.width()) 
            PLERROR("ReverseMatT expects a square symmetric matrix"); 
    }

Member Function Documentation

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

Definition at line 128 of file GenMat.h.

References PLearn::diag().

    { 
        diag(A_, d); 
        diag*=-1;
        diag+=alpha_;
    }

Here is the call graph for this function:

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

Definition at line 134 of file GenMat.h.

References PLearn::diag(), PLearn::diagonalOfSquare(), and PLearn::multiplyAcc().

    {
        Vec diag_A(A_.length());
        diag(A_, diag_A);
        diagonalOfSquare(A_, d);
        multiplyAcc(d, diag_A,-2*alpha_);
        d+=alpha_*alpha_;
    }

Here is the call graph for this function:

template<class MatT >
int PLearn::ReverseMatT< MatT >::length ( ) const [inline]

Definition at line 118 of file GenMat.h.

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

y = alpha * x - A * x

Definition at line 121 of file GenMat.h.

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

    {
        product(A_, x,y);
        y*=-1;
        multiplyAcc(y, x,alpha_);
    }

Here is the call graph for this function:

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

Definition at line 119 of file GenMat.h.

{ return A_.width(); }

Member Data Documentation

template<class MatT >
MatT& PLearn::ReverseMatT< MatT >::A_ [protected]

Definition at line 110 of file GenMat.h.

template<class MatT >
real PLearn::ReverseMatT< MatT >::alpha_ [protected]

Definition at line 111 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