mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Apply clang-format to lapack/blas directories
This commit is contained in:
committed by
Antonio Sánchez
parent
4eac211e96
commit
186f8205db
@@ -11,52 +11,53 @@
|
||||
#include <Eigen/Eigenvalues>
|
||||
|
||||
// computes eigen values and vectors of a general N-by-N matrix A
|
||||
EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info))
|
||||
{
|
||||
EIGEN_LAPACK_FUNC(syev, (char* jobz, char* uplo, int* n, Scalar* a, int* lda, Scalar* w, Scalar* /*work*/, int* lwork,
|
||||
int* info)) {
|
||||
// TODO exploit the work buffer
|
||||
bool query_size = *lwork==-1;
|
||||
|
||||
bool query_size = *lwork == -1;
|
||||
|
||||
*info = 0;
|
||||
if(*jobz!='N' && *jobz!='V') *info = -1;
|
||||
else if(UPLO(*uplo)==INVALID) *info = -2;
|
||||
else if(*n<0) *info = -3;
|
||||
else if(*lda<std::max(1,*n)) *info = -5;
|
||||
else if((!query_size) && *lwork<std::max(1,3**n-1)) *info = -8;
|
||||
|
||||
if(*info!=0)
|
||||
{
|
||||
if (*jobz != 'N' && *jobz != 'V')
|
||||
*info = -1;
|
||||
else if (UPLO(*uplo) == INVALID)
|
||||
*info = -2;
|
||||
else if (*n < 0)
|
||||
*info = -3;
|
||||
else if (*lda < std::max(1, *n))
|
||||
*info = -5;
|
||||
else if ((!query_size) && *lwork < std::max(1, 3 * *n - 1))
|
||||
*info = -8;
|
||||
|
||||
if (*info != 0) {
|
||||
int e = -*info;
|
||||
return xerbla_(SCALAR_SUFFIX_UP"SYEV ", &e, 6);
|
||||
return xerbla_(SCALAR_SUFFIX_UP "SYEV ", &e, 6);
|
||||
}
|
||||
|
||||
if(query_size)
|
||||
{
|
||||
|
||||
if (query_size) {
|
||||
*lwork = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(*n==0)
|
||||
return 0;
|
||||
|
||||
PlainMatrixType mat(*n,*n);
|
||||
if(UPLO(*uplo)==UP) mat = matrix(a,*n,*n,*lda).adjoint();
|
||||
else mat = matrix(a,*n,*n,*lda);
|
||||
|
||||
bool computeVectors = *jobz=='V' || *jobz=='v';
|
||||
SelfAdjointEigenSolver<PlainMatrixType> eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly);
|
||||
|
||||
if(eig.info()==NoConvergence)
|
||||
{
|
||||
make_vector(w,*n).setZero();
|
||||
if(computeVectors)
|
||||
matrix(a,*n,*n,*lda).setIdentity();
|
||||
|
||||
if (*n == 0) return 0;
|
||||
|
||||
PlainMatrixType mat(*n, *n);
|
||||
if (UPLO(*uplo) == UP)
|
||||
mat = matrix(a, *n, *n, *lda).adjoint();
|
||||
else
|
||||
mat = matrix(a, *n, *n, *lda);
|
||||
|
||||
bool computeVectors = *jobz == 'V' || *jobz == 'v';
|
||||
SelfAdjointEigenSolver<PlainMatrixType> eig(mat, computeVectors ? ComputeEigenvectors : EigenvaluesOnly);
|
||||
|
||||
if (eig.info() == NoConvergence) {
|
||||
make_vector(w, *n).setZero();
|
||||
if (computeVectors) matrix(a, *n, *n, *lda).setIdentity();
|
||||
//*info = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
make_vector(w,*n) = eig.eigenvalues();
|
||||
if(computeVectors)
|
||||
matrix(a,*n,*n,*lda) = eig.eigenvectors();
|
||||
|
||||
|
||||
make_vector(w, *n) = eig.eigenvalues();
|
||||
if (computeVectors) matrix(a, *n, *n, *lda) = eig.eigenvectors();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user