#include <linalg.h>
|
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) |
|
Definition at line 494 of file linalg.h.
static void TLAMisc::Fill |
( |
TFltVV & |
M, |
|
|
const double & |
Val |
|
) |
| |
|
static |
void TLAMisc::FillIdentity |
( |
TFltVV & |
M | ) |
|
|
static |
Definition at line 1751 of file linalg.cpp.
1754 for (
int i = 0; i < Len; i++) {
1755 for (
int j = 0; j < Len; j++) M(i,j) = 0.0;
void TLAMisc::FillIdentity |
( |
TFltVV & |
M, |
|
|
const double & |
Elt |
|
) |
| |
|
static |
Definition at line 1760 of file linalg.cpp.
1763 for (
int i = 0; i < Len; i++) {
1764 for (
int j = 0; j < Len; j++) M(i,j) = 0.0;
static void TLAMisc::FillRnd |
( |
TFltV & |
Vec | ) |
|
|
inlinestatic |
Definition at line 521 of file linalg.h.
static void FillRnd(TFltV &Vec)
void TLAMisc::FillRnd |
( |
TFltV & |
Vec, |
|
|
TRnd & |
Rnd |
|
) |
| |
|
static |
Definition at line 1745 of file linalg.cpp.
1746 int Len = Vec.
Len();
1747 for (
int i = 0; i < Len; i++)
TSizeTy Len() const
Returns the number of elements in the vector.
static void TLAMisc::FillZero |
( |
TFltV & |
Vec | ) |
|
|
inlinestatic |
Definition at line 526 of file linalg.h.
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
static void TLAMisc::FillZero |
( |
TFltVV & |
M | ) |
|
|
inlinestatic |
Definition at line 527 of file linalg.h.
static void Fill(TFltVV &M, const double &Val)
void TLAMisc::LoadMatlabTFltVV |
( |
const TStr & |
FNm, |
|
|
TVec< TFltV > & |
ColV |
|
) |
| |
|
static |
Definition at line 1670 of file linalg.cpp.
1673 int Row = 0, Col = 0; ColV.
Clr();
1676 while (Lx.Sym !=
syEof) {
1677 if (Lx.Sym ==
syFlt) {
1678 if (ColV.
Len() > Col) {
1679 IAssert(ColV[Col].Len() == Row);
1680 ColV[Col].
Add(Lx.Flt);
1686 }
else if (Lx.Sym ==
syEoln) {
TSizeTy Len() const
Returns the number of elements in the vector.
static PSIn New(const TStr &FNm)
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
static TVec< TFlt, int > GetV(const TFlt &Val1)
Returns a vector on element Val1.
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void TLAMisc::LoadMatlabTFltVV |
( |
const TStr & |
FNm, |
|
|
TFltVV & |
MatrixVV |
|
) |
| |
|
static |
Definition at line 1701 of file linalg.cpp.
1703 if (ColV.
Empty()) { MatrixVV.
Clr();
return; }
1704 const int Rows = ColV[0].
Len(), Cols = ColV.
Len();
1705 MatrixVV.
Gen(Rows, Cols);
1706 for (
int RowN = 0; RowN < Rows; RowN++) {
1707 for (
int ColN = 0; ColN < Cols; ColN++) {
1708 MatrixVV(RowN, ColN) = ColV[ColN][RowN];
TSizeTy Len() const
Returns the number of elements in the vector.
bool Empty() const
Tests whether the vector is empty.
static void LoadMatlabTFltVV(const TStr &FNm, TVec< TFltV > &ColV)
void Gen(const TSizeTy &_XDim, const TSizeTy &_YDim)
void TLAMisc::PrintTFltV |
( |
const TFltV & |
Vec, |
|
|
const TStr & |
VecNm |
|
) |
| |
|
static |
Definition at line 1714 of file linalg.cpp.
1715 printf(
"%s = [", VecNm.
CStr());
1716 for (
int i = 0; i < Vec.
Len(); i++) {
1717 printf(
"%.5f", Vec[i]());
1718 if (i < Vec.
Len() - 1) { printf(
", "); }
TSizeTy Len() const
Returns the number of elements in the vector.
void TLAMisc::PrintTFltVV |
( |
const TFltVV & |
A, |
|
|
const TStr & |
MatrixNm |
|
) |
| |
|
static |
Definition at line 1724 of file linalg.cpp.
1725 printf(
"%s = [\n", MatrixNm.
CStr());
1726 for (
int j = 0; j < A.
GetRows(); j++) {
1727 for (
int i = 0; i < A.
GetCols(); i++) {
1728 printf(
"%f\t", A.
At(i, j).
Val);
const TVal & At(const TSizeTy &X, const TSizeTy &Y) const
void TLAMisc::PrintTIntV |
( |
const TIntV & |
Vec, |
|
|
const TStr & |
VecNm |
|
) |
| |
|
static |
Definition at line 1735 of file linalg.cpp.
1736 printf(
"%s = [", VecNm.
CStr());
1737 for (
int i = 0; i < Vec.
Len(); i++) {
1738 printf(
"%d", Vec[i]());
1739 if (i < Vec.
Len() - 1) printf(
", ");
TSizeTy Len() const
Returns the number of elements in the vector.
void TLAMisc::SaveCsvTFltV |
( |
const TFltV & |
Vec, |
|
|
TSOut & |
SOut |
|
) |
| |
|
static |
Definition at line 1598 of file linalg.cpp.
1599 for (
int ValN = 0; ValN < Vec.
Len(); ValN++) {
virtual int PutCh(const char &Ch)=0
TSizeTy Len() const
Returns the number of elements in the vector.
int PutLn(const int &Lns=1)
int PutFlt(const double &Flt)
void TLAMisc::SaveMatlabTFltIntKdV |
( |
const TIntFltKdV & |
SpV, |
|
|
const int & |
ColN, |
|
|
TSOut & |
SOut |
|
) |
| |
|
static |
Definition at line 1605 of file linalg.cpp.
1606 const int Len = SpV.
Len();
1607 for (
int ValN = 0; ValN < Len; ValN++) {
TSizeTy Len() const
Returns the number of elements in the vector.
static TStr Fmt(const char *FmtStr,...)
int PutStrLn(const TStr &Str, const bool &ForceInLn=false)
void TLAMisc::SaveMatlabTFltV |
( |
const TFltV & |
m, |
|
|
const TStr & |
FName |
|
) |
| |
|
static |
Definition at line 1612 of file linalg.cpp.
1614 const int RowN = m.
Len();
1615 for (
int RowId = 0; RowId < RowN; RowId++) {
static PSOut New(const TStr &FNm, const bool &Append=false)
TSizeTy Len() const
Returns the number of elements in the vector.
void TLAMisc::SaveMatlabTFltVV |
( |
const TFltVV & |
m, |
|
|
const TStr & |
FName |
|
) |
| |
|
static |
Definition at line 1643 of file linalg.cpp.
1647 for (
int RowId = 0; RowId < RowN; RowId++) {
1648 for (
int ColId = 0; ColId < ColN; ColId++) {
static PSOut New(const TStr &FNm, const bool &Append=false)
void TLAMisc::SaveMatlabTFltVVCol |
( |
const TFltVV & |
m, |
|
|
int |
ColId, |
|
|
const TStr & |
FName |
|
) |
| |
|
static |
Definition at line 1632 of file linalg.cpp.
1635 for (
int RowId = 0; RowId < RowN; RowId++) {
static PSOut New(const TStr &FNm, const bool &Append=false)
void TLAMisc::SaveMatlabTFltVVMjrSubMtrx |
( |
const TFltVV & |
m, |
|
|
int |
rowN, |
|
|
int |
colN, |
|
|
const TStr & |
FName |
|
) |
| |
|
static |
Definition at line 1657 of file linalg.cpp.
1661 for (
int RowId = 0; RowId < RowN; RowId++) {
1662 for (
int ColId = 0; ColId < ColN; ColId++) {
1663 out->PutStr(
TFlt::GetStr(m(RowId,ColId), 20, 18)); out->PutCh(
' ');
static PSOut New(const TStr &FNm, const bool &Append=false)
void TLAMisc::SaveMatlabTIntV |
( |
const TIntV & |
m, |
|
|
const TStr & |
FName |
|
) |
| |
|
static |
Definition at line 1622 of file linalg.cpp.
1624 const int RowN = m.
Len();
1625 for (
int RowId = 0; RowId < RowN; RowId++) {
1626 out->PutInt(m[RowId]);
static PSOut New(const TStr &FNm, const bool &Append=false)
TSizeTy Len() const
Returns the number of elements in the vector.
int TLAMisc::SumVec |
( |
const TIntV & |
Vec | ) |
|
|
static |
Definition at line 1769 of file linalg.cpp.
1770 const int Len = Vec.
Len();
1772 for (
int i = 0; i < Len; i++)
TSizeTy Len() const
Returns the number of elements in the vector.
double TLAMisc::SumVec |
( |
const TFltV & |
Vec | ) |
|
|
static |
Definition at line 1777 of file linalg.cpp.
1778 const int Len = Vec.
Len();
1780 for (
int i = 0; i < Len; i++)
TSizeTy Len() const
Returns the number of elements in the vector.
void TLAMisc::ToSpVec |
( |
const TFltV & |
Vec, |
|
|
TIntFltKdV & |
SpVec, |
|
|
const double & |
CutWordWgtSumPrc = 0.0 |
|
) |
| |
|
static |
Definition at line 1785 of file linalg.cpp.
1789 IAssert(0.0 <= CutSumPrc && CutSumPrc <= 1.0);
1790 const int Elts = Vec.
Len();
1791 double EltSum = 0.0;
1792 for (
int EltN = 0; EltN < Elts; EltN++) {
1794 const double MnEltVal = CutSumPrc * EltSum;
1797 for (
int EltN = 0; EltN < Elts; EltN++) {
TSizeTy Len() const
Returns the number of elements in the vector.
TKeyDat< TInt, TFlt > TIntFltKd
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
static double Abs(const double &Flt)
void Pack()
Reduces vector capacity (frees memory) to match its size.
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void TLAMisc::ToVec |
( |
const TIntFltKdV & |
SpVec, |
|
|
TFltV & |
Vec, |
|
|
const int & |
VecLen |
|
) |
| |
|
static |
Definition at line 1805 of file linalg.cpp.
1807 int Elts = SpVec.
Len();
1808 for (
int EltN = 0; EltN < Elts; EltN++) {
1809 if (SpVec[EltN].Key < VecLen) {
1810 Vec[SpVec[EltN].Key] = SpVec[EltN].Dat;
TSizeTy Len() const
Returns the number of elements in the vector.
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
The documentation for this class was generated from the following files: