SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <linalg.h>
Inherits TMatrix.
Public Member Functions | |
TSparseRowMatrix () | |
TSparseRowMatrix (TVec< TIntFltKdV > _RowSpVV) | |
TSparseRowMatrix (TVec< TIntFltKdV > _RowSpVV, const int &_RowN, const int &_ColN) | |
TSparseRowMatrix (const TStr &MatlabMatrixFNm) | |
void | Save (TSOut &SOut) |
void | Load (TSIn &SIn) |
Public Attributes | |
int | RowN |
int | ColN |
TVec< TIntFltKdV > | RowSpVV |
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 |
TSparseRowMatrix::TSparseRowMatrix | ( | ) | [inline] |
TSparseRowMatrix::TSparseRowMatrix | ( | TVec< TIntFltKdV > | _RowSpVV | ) | [inline] |
TSparseRowMatrix::TSparseRowMatrix | ( | TVec< TIntFltKdV > | _RowSpVV, |
const int & | _RowN, | ||
const int & | _ColN | ||
) | [inline] |
TSparseRowMatrix::TSparseRowMatrix | ( | const TStr & | MatlabMatrixFNm | ) |
Definition at line 53 of file linalg.cpp.
{ FILE *F = fopen(MatlabMatrixFNm.CStr(), "rt"); IAssert(F != NULL); TVec<TTriple<TInt, TInt, TSFlt> > MtxV; RowN = 0; ColN = 0; while (! feof(F)) { int row=-1, col=-1; float val; if (fscanf(F, "%d %d %f\n", &row, &col, &val) == 3) { IAssert(row > 0 && col > 0); MtxV.Add(TTriple<TInt, TInt, TSFlt>(row, col, val)); RowN = TMath::Mx(RowN, row); ColN = TMath::Mx(ColN, col); } } fclose(F); // create matrix MtxV.Sort(); RowSpVV.Gen(RowN); int cnt = 0; for (int row = 1; row <= RowN; row++) { while (cnt < MtxV.Len() && MtxV[cnt].Val1 == row) { RowSpVV[row-1].Add(TIntFltKd(MtxV[cnt].Val2-1, MtxV[cnt].Val3())); cnt++; } } }
void TSparseRowMatrix::Load | ( | TSIn & | SIn | ) | [inline] |
int TSparseRowMatrix::PGetCols | ( | ) | const [inline, protected, virtual] |
int TSparseRowMatrix::PGetRows | ( | ) | const [inline, protected, virtual] |
void TSparseRowMatrix::PMultiply | ( | const TFltVV & | B, |
int | ColId, | ||
TFltV & | Result | ||
) | const [protected, virtual] |
Implements TMatrix.
Definition at line 101 of file linalg.cpp.
void TSparseRowMatrix::PMultiply | ( | const TFltV & | Vec, |
TFltV & | Result | ||
) | const [protected, virtual] |
Implements TMatrix.
Definition at line 112 of file linalg.cpp.
void TSparseRowMatrix::PMultiplyT | ( | const TFltVV & | B, |
int | ColId, | ||
TFltV & | Result | ||
) | const [protected, virtual] |
Implements TMatrix.
Definition at line 79 of file linalg.cpp.
void TSparseRowMatrix::PMultiplyT | ( | const TFltV & | Vec, |
TFltV & | Result | ||
) | const [protected, virtual] |
Implements TMatrix.
Definition at line 90 of file linalg.cpp.
void TSparseRowMatrix::Save | ( | TSOut & | SOut | ) | [inline] |