35#ifndef _BLAZE_MATH_DENSE_EIGEN_H_
36#define _BLAZE_MATH_DENSE_EIGEN_H_
78template<
typename MT,
bool SO,
typename VT,
bool TF >
79inline void eigen(
const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& w );
81template<
typename MT1,
bool SO1,
typename VT,
bool TF,
typename MT2,
bool SO2 >
82inline void eigen(
const DenseMatrix<MT1,SO1>& A, DenseVector<VT,TF>& w, DenseMatrix<MT2,SO2>& V );
110inline auto eigen_backend(
const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& w )
111 -> EnableIf_t< IsSymmetric_v<MT> && !IsDiagonal_v<MT> && IsFloatingPoint_v< ElementType_t<MT> > >
113 using ATmp = RemoveAdaptor_t< ResultType_t<MT> >;
124 syevd( Atmp, *w,
'N',
'L' );
153inline auto eigen_backend(
const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& w )
154 -> EnableIf_t< IsHermitian_v<MT> && IsComplex_v< ElementType_t<MT> > >
156 using ATmp = RemoveAdaptor_t< ResultType_t<MT> >;
167 heevd( Atmp, *w,
'N',
'L' );
196inline auto eigen_backend(
const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& w )
197 -> EnableIf_t< IsTriangular_v<MT> >
201 const size_t N( (*A).rows() );
203 CompositeType_t<MT> Atmp( *A );
207 for(
size_t i=0UL; i<N; ++i ) {
238inline auto eigen_backend(
const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& w )
239 ->
DisableIf_t< ( IsSymmetric_v<MT> && !IsDiagonal_v<MT> && IsFloatingPoint_v< ElementType_t<MT> > ) ||
240 ( IsHermitian_v<MT> &&
IsComplex_v< ElementType_t<MT> > ) ||
241 ( IsTriangular_v<MT> ) >
243 using ATmp = RemoveAdaptor_t< ResultType_t<MT> >;
368 eigen_backend( *A, wtmp );
370 if( IsContiguous_v<VT> ) {
398template<
typename MT1
404inline auto eigen_backend(
const DenseMatrix<MT1,SO1>& A, DenseVector<VT,TF>& w, DenseMatrix<MT2,SO2>& V )
405 -> EnableIf_t< IsSymmetric_v<MT1> && !IsDiagonal_v<MT1> && IsFloatingPoint_v< ElementType_t<MT1> > >
407 using ATmp = RemoveAdaptor_t< ResultType_t<MT1> >;
418 syevd( Atmp, *w,
'V',
'L' );
423 (*V) =
trans( Atmp );
450template<
typename MT1
456inline auto eigen_backend(
const DenseMatrix<MT1,SO1>& A, DenseVector<VT,TF>& w, DenseMatrix<MT2,SO2>& V )
457 -> EnableIf_t< IsHermitian_v<MT1> && IsComplex_v< ElementType_t<MT1> > >
459 using ATmp = RemoveAdaptor_t< ResultType_t<MT1> >;
470 heevd( Atmp, *w,
'V',
'L' );
475 (*V) =
trans( Atmp );
502template<
typename MT1
508inline auto eigen_backend(
const DenseMatrix<MT1,SO1>& A, DenseVector<VT,TF>& w, DenseMatrix<MT2,SO2>& V )
509 -> EnableIf_t< IsDiagonal_v<MT1> >
513 const size_t N( (*A).rows() );
515 CompositeType_t<MT1> Atmp( *A );
518 resize( *V, N, N,
false );
521 for(
size_t i=0UL; i<N; ++i ) {
523 (*V)(i,i) = ElementType_t<MT2>(1);
551template<
typename MT1
557inline auto eigen_backend(
const DenseMatrix<MT1,SO1>& A, DenseVector<VT,TF>& w, DenseMatrix<MT2,SO2>& V )
558 ->
DisableIf_t< ( IsSymmetric_v<MT1> && !IsDiagonal_v<MT1> && IsFloatingPoint_v< ElementType_t<MT1> > ) ||
559 ( IsHermitian_v<MT1> &&
IsComplex_v< ElementType_t<MT1> > ) ||
560 ( IsDiagonal_v<MT1> ) >
562 using ATmp = RemoveAdaptor_t< ResultType_t<MT1> >;
573 if( IsRowMajorMatrix_v<MT1> )
574 geev( Atmp, *V, *w );
576 geev( Atmp, *w, *V );
683template<
typename MT1
714 eigen_backend( *A, wtmp, Vtmp );
716 if( !IsContiguous_v<VT> ) {
720 if( !IsContiguous_v<MT2> ) {
Constraint on the data type.
Header file for auxiliary alias declarations.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsComplex type trait.
Header file for the IsContiguous type trait.
Header file for the IsDiagonal type trait.
Header file for the IsFloatingPoint type trait.
Header file for the IsHermitian type trait.
Header file for the IsRowMajorMatrix type trait.
Header file for the IsSymmetric type trait.
Header file for the IsTriangular type trait.
Constraint on the data type.
Header file for the RemoveAdaptor type trait.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Constraint on the data type.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
Header file for the LAPACK general matrix eigenvalue functions (geev)
void eigen(const DenseMatrix< MT1, SO1 > &A, DenseVector< VT, TF > &w, DenseMatrix< MT2, SO2 > &V)
Eigenvalue computation of the given dense matrix.
Definition: Eigen.h:689
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
void heevd(char jobz, char uplo, blas_int_t n, complex< float > *A, blas_int_t lda, float *w, complex< float > *work, blas_int_t lwork, float *rwork, blas_int_t lrwork, blas_int_t *iwork, blas_int_t liwork, blas_int_t *info)
LAPACK kernel for computing the eigenvalues of the given dense Hermitian single precision column-majo...
Definition: heevd.h:143
void geev(char jobvl, char jobvr, blas_int_t n, float *A, blas_int_t lda, float *wr, float *wi, float *VL, blas_int_t ldvl, float *VR, blas_int_t ldvr, float *work, blas_int_t lwork, blas_int_t *info)
LAPACK kernel for computing the eigenvalues of the given dense general single precision column-major ...
Definition: geev.h:179
void syevd(char jobz, char uplo, blas_int_t n, float *A, blas_int_t lda, float *w, float *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t liwork, blas_int_t *info)
LAPACK kernel for computing the eigenvalues of the given dense symmetric single precision column-majo...
Definition: syevd.h:141
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ADAPTOR_TYPE(T)
Constraint on the data type.
Definition: Adaptor.h:81
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.
Definition: MutableDataAccess.h:61
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
constexpr bool IsComplex_v
Auxiliary variable template for the IsComplex type trait.
Definition: IsComplex.h:139
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the LAPACK Hermitian matrix eigenvalue functions (heevd)
Header file for the LAPACK symmetric matrix eigenvalue functions (syevd)