12#ifndef BELFEM_FN_BZ_EIGEN_HPP
13#define BELFEM_FN_BZ_EIGEN_HPP
14#include <blaze/util/typetraits/IsComplex.h>
29 const bool aAbortOnComplex =
true )
34 "eigen(): matrix must be square ( %lu x %lu )",
35 (
unsigned long ) aMatrix.n_rows(), (
unsigned long ) aMatrix.n_cols() );
37 "eigen(): matrix has non-finite entries" );
39 blaze::DynamicVector<blaze::complex<real>, blaze::columnVector > tValues ;
40 blaze::eigen( aMatrix.matrix_data(), tValues );
42 size_t tN = aMatrix.n_cols() ;
43 aValues.set_size( aMatrix.n_cols() );
45 int_t tNumComplex = 0 ;
47 for(
size_t k=0; k<tN; ++k )
52 "eigen(): eigenvalue %u of this matrix is complex ( %g %+g i ), and a real "
53 "Vector cannot hold it. Use eigen_sym() if the matrix is symmetric, or pass "
54 "aAbortOnComplex = false to receive a count and NaN entries instead.",
56 (
double ) std::real( tValues[ k ] ),
57 (
double ) std::imag( tValues[ k ] ) );
64 aValues( k ) = std::real( tValues[ k ] );
80 "eigen_sym(): matrix must be square ( %lu x %lu )",
81 (
unsigned long ) aMatrix.n_rows(), (
unsigned long ) aMatrix.n_cols() );
83 "eigen_sym(): matrix has non-finite entries" );
85 aValues.set_size( aMatrix.n_cols() );
93 blaze::syev( tWork.matrix_data(), aValues.vector_data(),
'N',
'U' );
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
Finiteness test for a whole matrix or vector, backend-free.
int_t eigen(const Matrix< real > &aMatrix, Vector< real > &aValues, const bool aAbortOnComplex=true)
Eigenvalues of a general (not necessarily symmetric) square matrix.
Definition fn_AR_eigen.hpp:25
void eigen_sym(const Matrix< real > &aMatrix, Vector< real > &aValues)
Eigenvalues of a symmetric matrix.
Definition fn_AR_eigen.hpp:76
USER GUIDES:
Definition cl_Capacitor.cpp:16
constexpr real BELFEM_EPSILON
Definition typedefs.hpp:89
bool is_finite(const Matrix< T > &aA)
true if every entry of aA is finite ( no NaN, no infinity ).
Definition fn_is_finite.hpp:37
int32_t int_t
Definition typedefs.hpp:51
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:86