SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TFullColMatrix Class Reference

#include <linalg.h>

Inheritance diagram for TFullColMatrix:
Collaboration diagram for TFullColMatrix:

Public Member Functions

 TFullColMatrix ()
 
 TFullColMatrix (const TStr &MatlabMatrixFNm)
 
void Save (TSOut &SOut)
 
void Load (TSIn &SIn)
 
- Public Member Functions inherited from TMatrix
 TMatrix ()
 
virtual ~TMatrix ()
 
void Multiply (const TFltVV &B, int ColId, TFltV &Result) const
 
void Multiply (const TFltV &Vec, TFltV &Result) const
 
void MultiplyT (const TFltVV &B, int ColId, TFltV &Result) const
 
void MultiplyT (const TFltV &Vec, TFltV &Result) const
 
int GetRows () const
 
int GetCols () const
 
void Transpose ()
 

Public Attributes

int RowN
 
int ColN
 
TVec< TFltVColV
 

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 126 of file linalg.h.

Constructor & Destructor Documentation

TFullColMatrix::TFullColMatrix ( )
inline

Definition at line 146 of file linalg.h.

146 : TMatrix() {}
TMatrix()
Definition: linalg.h:20
TFullColMatrix::TFullColMatrix ( const TStr MatlabMatrixFNm)

Definition at line 125 of file linalg.cpp.

References ColN, ColV, TStr::Fmt(), IAssertR, TVec< TVal, TSizeTy >::Len(), TLAMisc::LoadMatlabTFltVV(), and RowN.

125  : TMatrix() {
126  TLAMisc::LoadMatlabTFltVV(MatlabMatrixFNm, ColV);
127  RowN=ColV[0].Len(); ColN=ColV.Len();
128  for (int i = 0; i < ColN; i++) {
129  IAssertR(ColV[i].Len() == RowN, TStr::Fmt("%d != %d", ColV[i].Len(), RowN));
130  }
131 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< TFltV > ColV
Definition: linalg.h:131
static void LoadMatlabTFltVV(const TStr &FNm, TVec< TFltV > &ColV)
Definition: linalg.cpp:1670
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TMatrix()
Definition: linalg.h:20

Here is the call graph for this function:

Member Function Documentation

void TFullColMatrix::Load ( TSIn SIn)
inline

Definition at line 151 of file linalg.h.

References TVec< TVal, TSizeTy >::Load().

151 { ColV.Load(SIn); }
void Load(TSIn &SIn)
Definition: ds.h:946
TVec< TFltV > ColV
Definition: linalg.h:131

Here is the call graph for this function:

int TFullColMatrix::PGetCols ( ) const
inlineprotectedvirtual

Implements TMatrix.

Definition at line 143 of file linalg.h.

References ColN.

143 { return ColN; }
int TFullColMatrix::PGetRows ( ) const
inlineprotectedvirtual

Implements TMatrix.

Definition at line 142 of file linalg.h.

References RowN.

142 { return RowN; }
void TFullColMatrix::PMultiply ( const TFltVV B,
int  ColId,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 147 of file linalg.cpp.

References TLinAlg::AddVec(), Assert, ColN, ColV, TVVec< TVal, TSizeTy >::GetRows(), TVec< TVal, TSizeTy >::Len(), and RowN.

147  {
148  Assert(B.GetRows() >= ColN && Result.Len() >= RowN);
149  for (int i = 0; i < RowN; i++) { Result[i] = 0.0; }
150  for (int i = 0; i < ColN; i++) {
151  TLinAlg::AddVec(B(i, ColId), ColV[i], Result, Result);
152  }
153 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static void AddVec(const double &k, const TFltV &x, const TFltV &y, TFltV &z)
Definition: linalg.cpp:232
#define Assert(Cond)
Definition: bd.h:251
TSizeTy GetRows() const
Definition: ds.h:2252
TVec< TFltV > ColV
Definition: linalg.h:131

Here is the call graph for this function:

void TFullColMatrix::PMultiply ( const TFltV Vec,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 155 of file linalg.cpp.

References TLinAlg::AddVec(), Assert, ColN, ColV, TVec< TVal, TSizeTy >::Len(), and RowN.

155  {
156  Assert(Vec.Len() >= ColN && Result.Len() >= RowN);
157  for (int i = 0; i < RowN; i++) { Result[i] = 0.0; }
158  for (int i = 0; i < ColN; i++) {
159  TLinAlg::AddVec(Vec[i], ColV[i], Result, Result);
160  }
161 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static void AddVec(const double &k, const TFltV &x, const TFltV &y, TFltV &z)
Definition: linalg.cpp:232
#define Assert(Cond)
Definition: bd.h:251
TVec< TFltV > ColV
Definition: linalg.h:131

Here is the call graph for this function:

void TFullColMatrix::PMultiplyT ( const TFltVV B,
int  ColId,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 133 of file linalg.cpp.

References Assert, ColN, ColV, TLinAlg::DotProduct(), TVVec< TVal, TSizeTy >::GetRows(), TVec< TVal, TSizeTy >::Len(), and RowN.

133  {
134  Assert(B.GetRows() >= RowN && Result.Len() >= ColN);
135  for (int i = 0; i < ColN; i++) {
136  Result[i] = TLinAlg::DotProduct(B, ColId, ColV[i]);
137  }
138 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
#define Assert(Cond)
Definition: bd.h:251
TSizeTy GetRows() const
Definition: ds.h:2252
TVec< TFltV > ColV
Definition: linalg.h:131
static double DotProduct(const TFltV &x, const TFltV &y)
Definition: linalg.cpp:165

Here is the call graph for this function:

void TFullColMatrix::PMultiplyT ( const TFltV Vec,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 140 of file linalg.cpp.

References Assert, ColN, ColV, TLinAlg::DotProduct(), TVec< TVal, TSizeTy >::Len(), and RowN.

140  {
141  Assert(Vec.Len() >= RowN && Result.Len() >= ColN);
142  for (int i = 0; i < ColN; i++) {
143  Result[i] = TLinAlg::DotProduct(Vec, ColV[i]);
144  }
145 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
#define Assert(Cond)
Definition: bd.h:251
TVec< TFltV > ColV
Definition: linalg.h:131
static double DotProduct(const TFltV &x, const TFltV &y)
Definition: linalg.cpp:165

Here is the call graph for this function:

void TFullColMatrix::Save ( TSOut SOut)
inline

Definition at line 150 of file linalg.h.

References TVec< TVal, TSizeTy >::Save().

150 { ColV.Save(SOut); }
void Save(TSOut &SOut) const
Definition: ds.h:954
TVec< TFltV > ColV
Definition: linalg.h:131

Here is the call graph for this function:

Member Data Documentation

int TFullColMatrix::ColN

Definition at line 129 of file linalg.h.

Referenced by PGetCols(), PMultiply(), PMultiplyT(), SymeigsSmallest(), and TFullColMatrix().

TVec<TFltV> TFullColMatrix::ColV
int TFullColMatrix::RowN

Definition at line 129 of file linalg.h.

Referenced by PGetRows(), PMultiply(), PMultiplyT(), SymeigsSmallest(), and TFullColMatrix().


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