#include <linalg.h>
List of all members.
Static Public Member Functions |
static void | SaveCsvTFltV (const TFltV &Vec, TSOut &SOut) |
static void | SaveMatlabTFltIntKdV (const TIntFltKdV &SpV, const int &ColN, TSOut &SOut) |
static void | SaveMatlabTFltV (const TFltV &m, const TStr &FName) |
static void | SaveMatlabTIntV (const TIntV &m, const TStr &FName) |
static void | SaveMatlabTFltVVCol (const TFltVV &m, int ColId, const TStr &FName) |
static void | SaveMatlabTFltVV (const TFltVV &m, const TStr &FName) |
static void | SaveMatlabTFltVVMjrSubMtrx (const TFltVV &m, int rowN, int colN, const TStr &FName) |
static void | LoadMatlabTFltVV (const TStr &FNm, TVec< TFltV > &ColV) |
static void | LoadMatlabTFltVV (const TStr &FNm, TFltVV &MatrixVV) |
static void | PrintTFltV (const TFltV &Vec, const TStr &VecNm) |
static void | PrintTFltVV (const TFltVV &A, const TStr &MatrixNm) |
static void | PrintTIntV (const TIntV &Vec, const TStr &VecNm) |
static void | FillRnd (TFltV &Vec) |
static void | FillRnd (TFltV &Vec, TRnd &Rnd) |
static void | Fill (TFltVV &M, const double &Val) |
static void | FillZero (TFltV &Vec) |
static void | FillZero (TFltVV &M) |
static void | FillIdentity (TFltVV &M) |
static void | FillIdentity (TFltVV &M, const double &Elt) |
static int | SumVec (const TIntV &Vec) |
static double | SumVec (const TFltV &Vec) |
static void | ToSpVec (const TFltV &Vec, TIntFltKdV &SpVec, const double &CutWordWgtSumPrc=0.0) |
static void | ToVec (const TIntFltKdV &SpVec, TFltV &Vec, const int &VecLen) |
Detailed Description
Definition at line 494 of file linalg.h.
Member Function Documentation
Definition at line 1691 of file linalg.cpp.
{
TVec<TFltV> ColV; LoadMatlabTFltVV(FNm, ColV);
if (ColV.Empty()) { MatrixVV.Clr(); return; }
const int Rows = ColV[0].Len(), Cols = ColV.Len();
MatrixVV.Gen(Rows, Cols);
for (int RowN = 0; RowN < Rows; RowN++) {
for (int ColN = 0; ColN < Cols; ColN++) {
MatrixVV(RowN, ColN) = ColV[ColN][RowN];
}
}
}
Definition at line 1704 of file linalg.cpp.
{
printf("%s = [", VecNm.CStr());
for (int i = 0; i < Vec.Len(); i++) {
printf("%.5f", Vec[i]());
if (i < Vec.Len() - 1) { printf(", "); }
}
printf("]\n");
}
Definition at line 1714 of file linalg.cpp.
{
printf("%s = [\n", MatrixNm.CStr());
for (int j = 0; j < A.GetRows(); j++) {
for (int i = 0; i < A.GetCols(); i++) {
printf("%f\t", A.At(i, j).Val);
}
printf("\n");
}
printf("]\n");
}
Definition at line 1725 of file linalg.cpp.
{
printf("%s = [", VecNm.CStr());
for (int i = 0; i < Vec.Len(); i++) {
printf("%d", Vec[i]());
if (i < Vec.Len() - 1) printf(", ");
}
printf("]\n");
}
Definition at line 1595 of file linalg.cpp.
{
const int Len = SpV.Len();
for (int ValN = 0; ValN < Len; ValN++) {
SOut.PutStrLn(TStr::Fmt("%d %d %g", SpV[ValN].Key+1, ColN+1, SpV[ValN].Dat()));
}
}
Definition at line 1759 of file linalg.cpp.
{
const int Len = Vec.Len();
int res = 0;
for (int i = 0; i < Len; i++)
res += Vec[i];
return res;
}
Definition at line 1767 of file linalg.cpp.
{
const int Len = Vec.Len();
double res = 0.0;
for (int i = 0; i < Len; i++)
res += Vec[i];
return res;
}
Definition at line 1775 of file linalg.cpp.
{
IAssert(0.0 <= CutSumPrc && CutSumPrc <= 1.0);
const int Elts = Vec.Len();
double EltSum = 0.0;
for (int EltN = 0; EltN < Elts; EltN++) {
EltSum += TFlt::Abs(Vec[EltN]); }
const double MnEltVal = CutSumPrc * EltSum;
SpVec.Clr();
for (int EltN = 0; EltN < Elts; EltN++) {
if (TFlt::Abs(Vec[EltN]) > MnEltVal) {
SpVec.Add(TIntFltKd(EltN, Vec[EltN]));
}
}
SpVec.Pack();
}
Definition at line 1795 of file linalg.cpp.
{
Vec.Gen(VecLen); Vec.PutAll(0.0);
int Elts = SpVec.Len();
for (int EltN = 0; EltN < Elts; EltN++) {
if (SpVec[EltN].Key < VecLen) {
Vec[SpVec[EltN].Key] = SpVec[EltN].Dat;
}
}
}
The documentation for this class was generated from the following files: