SNAP Library 2.1, Developer Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TSparseColMatrix Class Reference

#include <linalg.h>

Inheritance diagram for TSparseColMatrix:
Collaboration diagram for TSparseColMatrix:

List of all members.

Public Member Functions

 TSparseColMatrix ()
 TSparseColMatrix (TVec< TIntFltKdV > _ColSpVV)
 TSparseColMatrix (TVec< TIntFltKdV > _ColSpVV, const int &_RowN, const int &_ColN)
void Save (TSOut &SOut)
void Load (TSIn &SIn)

Public Attributes

int RowN
int ColN
TVec< TIntFltKdVColSpVV

Protected Member Functions

virtual void PMultiply (const TFltVV &B, int ColId, TFltV &Result) const
virtual void PMultiply (const TFltV &Vec, TFltV &Result) const
virtual void PMultiplyT (const TFltVV &B, int ColId, TFltV &Result) const
virtual void PMultiplyT (const TFltV &Vec, TFltV &Result) const
int PGetRows () const
int PGetCols () const

Detailed Description

Definition at line 55 of file linalg.h.


Constructor & Destructor Documentation

Definition at line 75 of file linalg.h.

: TMatrix() {}

Definition at line 76 of file linalg.h.

: TMatrix(), ColSpVV(_ColSpVV) {}
TSparseColMatrix::TSparseColMatrix ( TVec< TIntFltKdV _ColSpVV,
const int &  _RowN,
const int &  _ColN 
) [inline]

Definition at line 77 of file linalg.h.

                                                                                   : 
                TMatrix(), RowN(_RowN), ColN(_ColN), ColSpVV(_ColSpVV) {}

Member Function Documentation

void TSparseColMatrix::Load ( TSIn SIn) [inline]

Definition at line 83 of file linalg.h.

References ColN, ColSpVV, TSIn::Load(), and RowN.

                         {
        SIn.Load(RowN); SIn.Load(ColN); ColSpVV = TVec<TIntFltKdV>(SIn); }

Here is the call graph for this function:

int TSparseColMatrix::PGetCols ( ) const [inline, protected, virtual]

Implements TMatrix.

Definition at line 72 of file linalg.h.

References ColN.

{ return ColN; }
int TSparseColMatrix::PGetRows ( ) const [inline, protected, virtual]

Implements TMatrix.

Definition at line 71 of file linalg.h.

References RowN.

{ return RowN; }
void TSparseColMatrix::PMultiply ( const TFltVV B,
int  ColId,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 3 of file linalg.cpp.

References Assert, TVec< TVal, TSizeTy >::BegI(), ColN, ColSpVV, TVVec< TVal >::GetRows(), TVec< TVal, TSizeTy >::Len(), and RowN.

                                                                                {
    Assert(B.GetRows() >= ColN && Result.Len() >= RowN);
    int i, j; TFlt *ResV = Result.BegI();
    for (i = 0; i < RowN; i++) ResV[i] = 0.0;
    for (j = 0; j < ColN; j++) {
        const TIntFltKdV& ColV = ColSpVV[j]; int len = ColV.Len();
        for (i = 0; i < len; i++) {
            ResV[ColV[i].Key] += ColV[i].Dat * B(j,ColId);
        }
    }
}

Here is the call graph for this function:

void TSparseColMatrix::PMultiply ( const TFltV Vec,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 15 of file linalg.cpp.

References Assert, TVec< TVal, TSizeTy >::BegI(), ColN, ColSpVV, TVec< TVal, TSizeTy >::Len(), and RowN.

                                                                      {
    Assert(Vec.Len() >= ColN && Result.Len() >= RowN);
    int i, j; TFlt *ResV = Result.BegI();
    for (i = 0; i < RowN; i++) ResV[i] = 0.0;
    for (j = 0; j < ColN; j++) {
        const TIntFltKdV& ColV = ColSpVV[j]; int len = ColV.Len();
        for (i = 0; i < len; i++) {
            ResV[ColV[i].Key] += ColV[i].Dat * Vec[j];
        }
    }
}

Here is the call graph for this function:

void TSparseColMatrix::PMultiplyT ( const TFltVV B,
int  ColId,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 27 of file linalg.cpp.

References Assert, TVec< TVal, TSizeTy >::BegI(), ColN, ColSpVV, TVVec< TVal >::GetRows(), TVec< TVal, TSizeTy >::Len(), and RowN.

                                                                                 {
    Assert(B.GetRows() >= RowN && Result.Len() >= ColN);
    int i, j, len; TFlt *ResV = Result.BegI();
    for (j = 0; j < ColN; j++) {
        const TIntFltKdV& ColV = ColSpVV[j];
        len = ColV.Len(); ResV[j] = 0.0;
        for (i = 0; i < len; i++) {
            ResV[j] += ColV[i].Dat * B(ColV[i].Key, ColId);
        }
    }
}

Here is the call graph for this function:

void TSparseColMatrix::PMultiplyT ( const TFltV Vec,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 39 of file linalg.cpp.

References Assert, TVec< TVal, TSizeTy >::BegI(), ColN, ColSpVV, TVec< TVal, TSizeTy >::Len(), and RowN.

                                                                       {
    Assert(Vec.Len() >= RowN && Result.Len() >= ColN);
    int i, j, len; TFlt *VecV = Vec.BegI(), *ResV = Result.BegI();
    for (j = 0; j < ColN; j++) {
        const TIntFltKdV& ColV = ColSpVV[j];
        len = ColV.Len(); ResV[j] = 0.0;
        for (i = 0; i < len; i++) {
            ResV[j] += ColV[i].Dat * VecV[ColV[i].Key];
        }
    }
}

Here is the call graph for this function:

void TSparseColMatrix::Save ( TSOut SOut) [inline]

Definition at line 81 of file linalg.h.

References ColN, ColSpVV, RowN, TSOut::Save(), and TVec< TVal, TSizeTy >::Save().

                           {
        SOut.Save(RowN); SOut.Save(ColN); ColSpVV.Save(SOut); }

Here is the call graph for this function:


Member Data Documentation

Definition at line 58 of file linalg.h.

Referenced by Load(), PGetCols(), PMultiply(), PMultiplyT(), and Save().

Definition at line 60 of file linalg.h.

Referenced by Load(), PMultiply(), PMultiplyT(), and Save().

Definition at line 58 of file linalg.h.

Referenced by Load(), PGetRows(), PMultiply(), PMultiplyT(), and Save().


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