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
|
#include <linalg.h>
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< TIntFltKdV > | ColSpVV |
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 |
TSparseColMatrix::TSparseColMatrix | ( | ) | [inline] |
TSparseColMatrix::TSparseColMatrix | ( | TVec< TIntFltKdV > | _ColSpVV | ) | [inline] |
TSparseColMatrix::TSparseColMatrix | ( | TVec< TIntFltKdV > | _ColSpVV, |
const int & | _RowN, | ||
const int & | _ColN | ||
) | [inline] |
void TSparseColMatrix::Load | ( | TSIn & | SIn | ) | [inline] |
int TSparseColMatrix::PGetCols | ( | ) | const [inline, protected, virtual] |
int TSparseColMatrix::PGetRows | ( | ) | const [inline, protected, virtual] |
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); } } }
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]; } } }
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); } } }
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]; } } }
void TSparseColMatrix::Save | ( | TSOut & | SOut | ) | [inline] |
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().