From 3b92abcdb224ff66acefa5bf049ef750d83e1352 Mon Sep 17 00:00:00 2001 From: jiri Date: Wed, 20 May 2020 16:27:52 +0000 Subject: [PATCH] *** empty log message *** --- davidson.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/davidson.h b/davidson.h index be7daa7..b284f89 100644 --- a/davidson.h +++ b/davidson.h @@ -26,7 +26,7 @@ namespace LA { -//Davidson diagonalization of real symmetric matrix (modified Lanczos) +//Davidson diagonalization of real symmetric matrix (modified Lanczos), works also for right eigenvectors on non-symmetric matrix //matrix can be any class which has nrows(), ncols(), diagonalof(), issymmetric(), and gemv() available //does not even have to be explicitly stored - direct CI @@ -211,7 +211,11 @@ for(i=0; i::normtype vnorm= vec1.norm(); +if(vnorm) laerror("Zero Krylov vector in Davidson - perhaps try different initial guess"); +else +{ +vec1 *= (1./vnorm); for(j=0; j<=krylovsize; ++j) { typename LA_traits::normtype vnorm; @@ -223,6 +227,7 @@ for(j=0; j<=krylovsize; ++j) vec1 *= (1./vnorm); } while (vnorm<0.99); } +} //here it is possible to apply some purification procedure if the eivector has to fulfill other conditions //vec1.normalize(); //after the purification