35#ifndef STK_ISYMEIGEN_H
36#define STK_ISYMEIGEN_H
63template<
class Derived>
93 template<
class OtherDerived>
140 template<
class OtherDerived>
155 template<
class ArraySquare>
168 template<
class ArraySquare>
180 template<
class ArraySquare>
219template<
class Derived>
231 ,YOU_HAVE_TO_USE_A_SQUARE_MATRIX_IN_THIS_METHOD)
240template<
class Derived>
243 , range_(data.range()), trace_(
Type(0)), norm_(
Type(0)), rank_(
Type(0)), det_(
Type(0))
244 , eigenVectors_(data, ref)
245 , eigenValues_(data.size(), 0.)
246 , SupportEigenVectors_(2*data.size(), 0)
252 ,YOU_HAVE_TO_USE_A_SQUARE_MATRIX_IN_THIS_METHOD)
257template<
class Derived>
258template<
class OtherDerived>
261 , range_(data.range()), trace_(
Type(0)), norm_(0.), rank_(0), det_(0.)
262 , eigenVectors_(data.asDerived())
263 , eigenValues_(data.size(), 0.)
264 , SupportEigenVectors_(2*data.size(), 0)
270 ,YOU_HAVE_TO_USE_A_SQUARE_MATRIX_IN_THIS_METHOD)
275template<
class Derived>
279 , eigenVectors_(
eigen.eigenVectors_)
280 , eigenValues_(
eigen.eigenValues_)
281 , SupportEigenVectors_(
eigen.SupportEigenVectors_)
287 ,YOU_HAVE_TO_USE_A_SQUARE_MATRIX_IN_THIS_METHOD)
293template<
class Derived>
299 for (
int i=eigenValues_.begin();
i< eigenValues_.end(); ++
i )
301 Type value = eigenValues_[
i];
307 norm_ = eigenValues_.maxElt();
309 if (eigenValues_.abs().minElt() > 0)
310 { det_ = s * std::exp(eigenValues_.abs().log().sum());}
313 rank_ = eigenValues_.size();
315 for (
int i=eigenValues_.begin();
i< eigenValues_.end(); ++
i )
316 {
if (std::abs(eigenValues_[
i]) <
tol) { rank_--;}}
In this file we define and implement utilies class and method for the Algebra project.
In this file we implement the final class CArraySquare.
In this file we implement the final class CArrayVector.
#define STK_STATIC_ASSERT(COND, MSG)
This file include all the other header files of the project Sdk.
TransposeOperator< Derived > const transpose() const
DiagonalizeOperator< Derived > const diagonalize() const
Derived & resize(Range const &I, Range const &J)
resize the Array.
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.
bool hasRun_
true if run has been used, false otherwise
The class ISymEigen is an interface class for the method computing the eigenvalue Decomposition of a ...
Range const & range() const
Type const & norm() const
CArraySquare< Type, size_ > const & eigenVectors() const
hidden::AlgebraTraits< Derived >::SquareArray SquareArray
void finalizeStep()
finalize the computation by computing the trace, rank, trace norm and determinant of the matrix.
Range range_
range of the original data set.
ISymEigen()
Default constructor.
ArraySquare & ginv(ArraySquare &res) const
Compute the generalized inverse of the symmetric matrix and put the result in res.
hidden::Traits< SquareArray >::Type Type
ISymEigen(ExprBase< OtherDerived > const &data)
template constructor
CArrayVector< Type, size_ > eigenValues_
Array of the eigenvalues.
ISymEigen(SquareArray const &data, bool ref=false)
Constructor The original data set can be overwritten by the eigenvectors if it is stored in a CSquare...
ISymEigen & operator=(ISymEigen const &eigen)
Operator = : overwrite the ISymEigen with eigen.
ArraySquare & ginvsqrt(ArraySquare &res) const
Compute the generalized square root inverse of the symmetric matrix and put the result in res.
~ISymEigen()
virtual destructor
CArraySquare< Type, size_ > eigenVectors_
Square matrix or the eigenvectors.
CVectorXi SupportEigenVectors_
Array for the support of the eigenvectors.
ArraySquare & gsqrt(ArraySquare &res) const
Compute the square root of the symmetric matrix and put the result in res.
ISymEigen(ISymEigen const &eigen)
Copy constructor.
Type const & trace() const
CArrayVector< Type, size_ > const & eigenValues() const
CArraySquare< Type, size_ > const & rotation() const
virtual bool run()
Find the eigenvalues and eigenvectors of the matrix.
void setData(ExprBase< OtherDerived > const &data)
overloading of setData.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
@ lower_symmetric_
lower symmetric matrix/array/expression
@ symmetric_
symmetric matrix/array/expression
@ upper_symmetric_
upper symmetric matrix/array/expression
@ square_
square matrix/array/expression
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.