From 44861dcbfeee041223c4aac1ee075e92fa4daa01 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Sep 2016 12:42:15 +0200 Subject: update --- eigen/lapack/eigenvalues.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 eigen/lapack/eigenvalues.cpp (limited to 'eigen/lapack/eigenvalues.cpp') diff --git a/eigen/lapack/eigenvalues.cpp b/eigen/lapack/eigenvalues.cpp new file mode 100644 index 0000000..a1526eb --- /dev/null +++ b/eigen/lapack/eigenvalues.cpp @@ -0,0 +1,79 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "common.h" +#include + +// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges +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; + + *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 eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly); + + if(eig.info()==NoConvergence) + { + vector(w,*n).setZero(); + if(computeVectors) + matrix(a,*n,*n,*lda).setIdentity(); + //*info = 1; + return 0; + } + + vector(w,*n) = eig.eigenvalues(); + if(computeVectors) + matrix(a,*n,*n,*lda) = eig.eigenvectors(); + + return 0; +} -- cgit v1.2.3