59template<
class Derived>
66 typedef typename ArrayU::Type
Type;
83 template<
class OtherDerived>
116 for (
int i=
D_.begin();
i<
D_.end(); ++
i )
126 if (
D_.abs().minElt() > 0)
127 {
det_ = s * std::exp(
D_.abs().log().sum());}
132 for (
int i=
D_.begin();
i<
D_.end(); ++
i )
157 if (
U_.empty()) {
return true;}
159 if (!this->
asDerived().runImpl())
return false;
172 template<
class OtherArray>
178 V_.resize(0,0),
D_.resize(0);
184 template<
class OtherArray>
208 inline int nrowU()
const {
return U_.sizeRows();}
210 inline int ncolU()
const {
return U_.sizeCols();}
212 inline int nrowD()
const {
return D_.sizeRows();}
214 inline int ncolD()
const {
return D_.sizeCols();}
216 inline int nrowV()
const {
return V_.sizeRows();}
218 inline int ncolV()
const {
return V_.sizeCols();}
225template<
class Derived>
226template<
class OtherArray>
232 if (U_.cols() != D_.range())
235 for (
int i= D_.begin();
i< D_.end(); ++
i) { diag[
i]=D_[
i];}
236 res = V_ * diag.safeInverse(
tol) * U_.transpose();
240 res = V_ * D_.diagonalize().safeInverse(
tol) * U_.transpose();
In this file we define and implement utilies class and method for the Algebra project.
This file include all the header files of the project STKernel.
Interface base class for all classes implementing the curious recursive template paradigm.
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.
Abstract base class for all classes having a.
Compute the Singular Value Decomposition of an array.
virtual bool run()
implement the run method
hidden::AlgebraTraits< Derived >::ArrayV ArrayV
ISvd(ArrayBase< OtherDerived > const &A, bool withU=true, bool withV=true)
constructor with other kind of array/expression
virtual void finalize()
Finalize any operations that have to be done after the computation of the decomposition.
ArrayD D_
Diagonal array of the singular values.
OtherArray & ginv(OtherArray &res) const
Compute the generalized inverse of the matrix and put the result in res.
ISvd & operator=(const ISvd &S)
Operator = : overwrite the ISvd with S.
virtual ~ISvd()
destructor.
hidden::AlgebraTraits< Derived >::ArrayU ArrayU
ISvd(ArrayU const &A, bool ref, bool withU=true, bool withV=true)
Default constructor.
void setData(OtherArray const &A, bool withU=true, bool withV=true)
Set a new data set to ISvd class.
hidden::AlgebraTraits< Derived >::ArrayD ArrayD
ISvd(ISvd const &S)
Copy Constructor.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Type sign(Type const &x, Type const &y=Type(1))
template sign value sign(x) * y: Type should be an integral type
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.
traits class for the algebra methods.