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

Inherits TMatrix.

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.

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

Member Function Documentation

void TFullColMatrix::Load ( TSIn SIn)
inline

Definition at line 151 of file linalg.h.

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

Implements TMatrix.

Definition at line 143 of file linalg.h.

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

Implements TMatrix.

Definition at line 142 of file linalg.h.

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.

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
void TFullColMatrix::PMultiply ( const TFltV Vec,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 155 of file linalg.cpp.

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
void TFullColMatrix::PMultiplyT ( const TFltVV B,
int  ColId,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 133 of file linalg.cpp.

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
void TFullColMatrix::PMultiplyT ( const TFltV Vec,
TFltV Result 
) const
protectedvirtual

Implements TMatrix.

Definition at line 140 of file linalg.cpp.

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
void TFullColMatrix::Save ( TSOut SOut)
inline

Definition at line 150 of file linalg.h.

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

Member Data Documentation

int TFullColMatrix::ColN

Definition at line 129 of file linalg.h.

TVec<TFltV> TFullColMatrix::ColV

Definition at line 131 of file linalg.h.

int TFullColMatrix::RowN

Definition at line 129 of file linalg.h.


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