SNAP Library 2.1, User 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>

Inherits TMatrix.

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.

                         {
        SIn.Load(RowN); SIn.Load(ColN); ColSpVV = TVec<TIntFltKdV>(SIn); }
int TSparseColMatrix::PGetCols ( ) const [inline, protected, virtual]

Implements TMatrix.

Definition at line 72 of file linalg.h.

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

Implements TMatrix.

Definition at line 71 of file linalg.h.

{ 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.

                                                                                {
    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);
        }
    }
}
void TSparseColMatrix::PMultiply ( const TFltV Vec,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 15 of file linalg.cpp.

                                                                      {
    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];
        }
    }
}
void TSparseColMatrix::PMultiplyT ( const TFltVV B,
int  ColId,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 27 of file linalg.cpp.

                                                                                 {
    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);
        }
    }
}
void TSparseColMatrix::PMultiplyT ( const TFltV Vec,
TFltV Result 
) const [protected, virtual]

Implements TMatrix.

Definition at line 39 of file linalg.cpp.

                                                                       {
    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];
        }
    }
}
void TSparseColMatrix::Save ( TSOut SOut) [inline]

Definition at line 81 of file linalg.h.

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

Member Data Documentation

Definition at line 58 of file linalg.h.

Definition at line 60 of file linalg.h.

Definition at line 58 of file linalg.h.


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