diff --git a/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h b/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h index 2ca8d765..39495e00 100644 --- a/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h +++ b/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h @@ -8,6 +8,7 @@ Author: Peter Boyle Author: paboyle +Author: Chulwoo Jung This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,6 +46,9 @@ void LAPACK_dstegr(char *jobz, char *range, int *n, double *d, double *e, #include "DenseMatrix.h" #include "EigenSort.h" +// eliminate temorary vector in calc() +#define MEM_SAVE + namespace Grid { ///////////////////////////////////////////////////////////// @@ -496,8 +500,6 @@ until convergence */ // alternate implementation for minimizing memory usage. May affect the performance -#define MEM_SAVE -#undef MEM_SAVE2 void calc(DenseVector& eval, DenseVector& evec, const Field& src, @@ -520,13 +522,12 @@ until convergence DenseVector Qt(Nm*Nm); DenseVector Iconv(Nm); -#if (!defined MEM_SAVE ) || (!defined MEM_SAVE2) +#if (!defined MEM_SAVE ) DenseVector B(Nm,grid); // waste of space replicating #endif Field f(grid); Field v(grid); -// auto B2 = evec[0]._odata[0]; int k1 = 1; int k2 = Nk; @@ -612,7 +613,7 @@ until convergence assert(k20); -// DenseVector < decltype(B2) > B(Nm); -// std::vector < decltype( B2 ) > B(Nm*thr,B2); Field B(grid); PARALLEL_FOR_LOOP for(int ss=0;ss < grid->oSites();ss++){ +// auto B2 = evec[0]._odata[0]; +// std::vector < decltype( B2 ) > B(Nm*thr,B2); int thr=GridThread::GetThreads(); int me = GridThread::ThreadBarrier(); - printf("thr=%d ss=%d me=%d\n",thr,ss,me);fflush(stdout); +// printf("thr=%d ss=%d me=%d\n",thr,ss,me);fflush(stdout); + assert(Nm*throSites()); for(int j=0; joSites();ss++){ - auto B2 = evec[0]._odata[0]; - std::vector < decltype( B2 ) > B(Nm,B2); - for(int j=0; j B(Nm,B2); + assert( (Nm*thr)oSites()); + for(int j=0; j