25 if (Transposed) {
PMultiplyT(B, ColId, Result); }
35 if (Transposed) {
PMultiply(B, ColId, Result); }
40 if (Transposed) {
PMultiply(Vec, Result); }
78 TMatrix(), RowN(_RowN), ColN(_ColN), ColSpVV(_ColSpVV) {}
113 TMatrix(), RowN(_RowN), ColN(_ColN), RowSpVV(_RowSpVV) {}
220 static double Norm(
const TFltVV& X,
int ColId);
264 static void Gemm(
const double& Alpha,
const TFltVV& A,
const TFltVV& B,
const double& Beta,
282 static void Rotate(
const double& OldX,
const double& OldY,
const double& Angle,
double& NewX,
double& NewY);
302 static double sqr(
double a);
303 static double sign(
double a,
double b);
307 static double pythag(
double a,
double b);
419 const int& NumEig,
TFltV& EigValV,
420 const bool& DoLocalReortoP =
false,
421 const bool& SvdMatrixProductP =
false);
428 const bool& SvdMatrixProductP =
false);
432 const bool& SvdMatrixProductP =
false);
436 const int& CalcSV,
TFltV& SngValV,
437 const bool& DoLocalReortoP =
false);
445 int NumSV,
int IterN,
TFltV& SgnValV);
465 const double B,
double& J,
double& JA,
double& JB);
471 const double B,
const double U,
const double V,
const double lambda,
472 double& J,
double& JJ,
double& JJJ);
475 TSigmoid(
const double& A_,
const double& B_): A(A_), B(B_) { };
485 return 1.0 / (1.0 + exp(-A * x + B)); }
524 static void Fill(
TFltVV& M,
const double& Val);
536 const double& CutWordWgtSumPrc = 0.0);
543 template <
class TKey,
class TDat>
548 static void SparseMerge(
const TKeyDatV& SrcV1,
const TKeyDatV& SrcV2, TKeyDatV& DstV) {
550 const int Src1Len = SrcV1.
Len();
551 const int Src2Len = SrcV2.
Len();
552 int Src1N = 0, Src2N = 0;
553 while (Src1N < Src1Len && Src2N < Src2Len) {
554 if (SrcV1[Src1N].Key < SrcV2[Src2N].Key) {
555 DstV.
Add(SrcV1[Src1N]); Src1N++;
556 }
else if (SrcV1[Src1N].Key > SrcV2[Src2N].Key) {
557 DstV.
Add(SrcV2[Src2N]); Src2N++;
563 while (Src1N < Src1Len) { DstV.
Add(SrcV1[Src1N]); Src1N++; }
564 while (Src2N < Src2Len) { DstV.
Add(SrcV2[Src2N]); Src2N++; }
TNSException(const TStr &Msg)
static double EuclDist(const TFltV &x, const TFltV &y)
double GetVal(const double &x) const
static void Transpose(const TFltVV &A, TFltVV &B)
TVec< TKeyDat< TKey, TDat > > TKeyDatV
static double Norm(const TFltV &x)
TSparseOps< TInt, TFlt > TSparseOpsIntFlt
virtual int PGetCols() const =0
static void AssertOrtogonality(const TVec< TFltV > &Vecs, const double &Threshold)
static void SaveMatlabTFltIntKdV(const TIntFltKdV &SpV, const int &ColN, TSOut &SOut)
static double SumVec(const TFltV &x)
static double sqr(double a)
static double EvaluateFit(const TFltIntKdV &data, const double A, const double B)
virtual void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
static void GS(TVec< TFltV > &Q)
static void FillRnd(TFltV &Vec)
void MultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
static void Lanczos(const TMatrix &Matrix, int NumEig, int Iters, const TSpSVDReOrtoType &ReOrtoType, TFltV &EigValV, TFltVV &EigVecVV, const bool &SvdMatrixProductP=false)
static void ToVec(const TIntFltKdV &SpVec, TFltV &Vec, const int &VecLen)
static void SimpleLanczosSVD(const TMatrix &Matrix, const int &CalcSV, TFltV &SngValV, const bool &DoLocalReortoP=false)
void Save(TSOut &SOut) const
TVec< TIntFltKdV > RowSpVV
static void Lanczos2(const TMatrix &Matrix, int MaxNumEig, int MaxSecs, const TSpSVDReOrtoType &ReOrtoType, TFltV &EigValV, TFltVV &EigVecVV, const bool &SvdMatrixProductP=false)
static void SaveMatlabTFltVV(const TFltVV &m, const TStr &FName)
TSizeTy Len() const
Returns the number of elements in the vector.
TSparseColMatrix(TVec< TIntFltKdV > _ColSpVV)
static void SolveLinearSystem(TFltVV &A, const TFltV &b, TFltV &x)
static void FillZero(TFltV &Vec)
static void SaveMatlabTFltVVCol(const TFltVV &m, int ColId, const TStr &FName)
TSparseColMatrix(TVec< TIntFltKdV > _ColSpVV, const int &_RowN, const int &_ColN)
static void LanczosSVD(const TMatrix &Matrix, int NumSV, int Iters, const TSpSVDReOrtoType &ReOrtoType, TFltV &SgnValV, TFltVV &LeftSgnVecVV, TFltVV &RightSgnVecVV)
static void MultiplyT(const TFltVV &A, const TFltV &x, TFltV &y)
static void InverseSVD(const TFltVV &A, TFltVV &B)
static void InverseTriagonal(TFltVV &A)
void Save(TSOut &SOut) const
static void Normalize(TFltV &x)
static void NormalizeLinf(TFltV &x)
static void Project(const TIntFltKdV &Vec, const TFltVV &U, TFltV &ProjVec)
virtual int PGetRows() const =0
TSparseRowMatrix(TVec< TIntFltKdV > _RowSpVV)
static void SaveMatlabTFltVVMjrSubMtrx(const TFltVV &m, int rowN, int colN, const TStr &FName)
static void SparseMerge(const TKeyDatV &SrcV1, const TKeyDatV &SrcV2, TKeyDatV &DstV)
static int SumVec(const TIntV &Vec)
static void Rotate(const double &OldX, const double &OldY, const double &Angle, double &NewX, double &NewY)
static void MultiplyScalar(const double &k, const TFltV &x, TFltV &y)
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
static void NormalizeL1(TFltV &x)
virtual void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const =0
double operator()(const double &x) const
static void LUSolve(const TFltVV &A, const TIntV &indx, TFltV &b)
static double Norm2(const TFltV &x)
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
static void CholeskyDecomposition(TFltVV &A, TFltV &p)
static double NormLinf(const TFltV &x)
static void AddVec(const double &k, const TFltV &x, const TFltV &y, TFltV &z)
virtual void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const
static void PrintTIntV(const TIntV &Vec, const TStr &VecNm)
void GetSigmoidAB(double &A_, double &B_)
static void nrerror(const TStr &error_text)
static void EigSymmetricTridiag(TFltV &d, TFltV &e, int n, TFltVV &z)
TVec< TIntFltKdV > ColSpVV
static void PrintTFltVV(const TFltVV &A, const TStr &MatrixNm)
static void SolveSymetricSystem(TFltVV &A, const TFltV &b, TFltV &x)
static void FillZero(TFltVV &M)
static void Fill(TFltVV &M, const double &Val)
static void SaveMatlabTIntV(const TIntV &m, const TStr &FName)
virtual void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const
void Save(const bool &Bool)
static void Multiply(const TFltVV &A, const TFltV &x, TFltV &y)
static void SymetricToTridiag(TFltVV &a, int n, TFltV &d, TFltV &e)
static void CholeskySolve(const TFltVV &A, const TFltV &p, const TFltV &b, TFltV &x)
static void SimpleLanczos(const TMatrix &Matrix, const int &NumEig, TFltV &EigValV, const bool &DoLocalReortoP=false, const bool &SvdMatrixProductP=false)
void Multiply(const TFltVV &B, int ColId, TFltV &Result) const
static double NormL1(const TFltV &x)
static void LoadMatlabTFltVV(const TStr &FNm, TVec< TFltV > &ColV)
virtual void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
void Multiply(const TFltV &Vec, TFltV &Result) const
static void SaveCsvTFltV(const TFltV &Vec, TSOut &SOut)
static double pythag(double a, double b)
static void SaveMatlabTFltV(const TFltV &m, const TStr &FName)
static void FillIdentity(TFltVV &M)
TSparseRowMatrix(TVec< TIntFltKdV > _RowSpVV, const int &_RowN, const int &_ColN)
static void LUDecomposition(TFltVV &A, TIntV &indx, double &d)
virtual void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const
static double DotProduct(const TFltV &x, const TFltV &y)
TSigmoid(const double &A_, const double &B_)
static void InverseSubstitute(TFltVV &A, const TFltV &p)
static void Inverse(const TFltVV &A, TFltVV &B, const TLinAlgInverseType &DecompType)
static void ToSpVec(const TFltV &Vec, TIntFltKdV &SpVec, const double &CutWordWgtSumPrc=0.0)
static void OrtoIterSVD(const TMatrix &Matrix, int NumSV, int IterN, TFltV &SgnValV)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
static void Gemm(const double &Alpha, const TFltVV &A, const TFltVV &B, const double &Beta, const TFltVV &C, TFltVV &D, const int &TransposeFlags)
static void LinComb(const double &p, const TFltV &x, const double &q, const TFltV &y, TFltV &z)
static void ConvexComb(const double &p, const TFltV &x, const TFltV &y, TFltV &z)
void MultiplyT(const TFltV &Vec, TFltV &Result) const
static void InverseSymetric(TFltVV &A)
void Save(TSOut &SOut) const
static void PrintTFltV(const TFltV &Vec, const TStr &VecNm)
virtual void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
static void MultiplyATA(const TMatrix &Matrix, const TFltVV &Vec, int ColId, TFltV &Result)
static double EuclDist2(const TFltV &x, const TFltV &y)
virtual void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const =0
static double sign(double a, double b)