CHROMA
ritz_array.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Ritz code for eigenvalues
3  */
4 
5 #include "chromabase.h"
6 #include "meas/eig/ritz_array.h"
8 
9 namespace Chroma {
10 
11 //! Minimizes the Ritz functional with a CG based algorithm
12 /*!
13  * \ingroup eig
14  *
15  * This subroutine minimizes the Ritz functional with a CG based
16  * algorithm to find the n-th lowest eigenvalue of a hermitian A
17 
18  * lambda_n = min_z <z|Az>/<z|z>
19 
20  * In the subspace orthogonal to the (n-1) lower eigenvectors of A
21 
22  * This routine can handle the original version or be a part of a
23  * Kalkreuter Simma algorithm.
24  *
25  * The algorithm has been modified that there is now only one target
26  * residue -- the relative one.
27  *
28  * so the original stopping criterion is now:
29  *
30  * || g || < Rsd_r * lambda
31  *
32  * The two key features for Kalkreuter - Simma over the normal procedure
33  * are:
34  * i) Adaptive termination of the procedure (controlled from caller)
35  *
36  * The iteration will stop if the gradient has decreased by at least
37  * a given factor of gamma^{-1} which according to the paper is O(10)
38  *
39  * ii) The initial error estimate is now the "delta_cycle" criterion.
40  * basically this scales the norm of || g^2 ||. So the iteration will
41  * also stop if delta_cycle || gamma^2 || < Rsd_r mu.
42  *
43  * To run in non K-S mode, set gamma = 1, delta_cycle = 1.
44  *
45  * For details of the Kalkreuter Simma algorithm see
46  * hep-lat/9507023
47  *
48  * Algorithm:
49 
50  * Apsi[0] := A . Psi[0] ;
51  * mu[0] := < Psi[0] | A . Psi[0] > ; Initial Ritz value
52  * Note: we assume < Psi[0] |Psi[0] > = 1
53  * p[1] = g[0] := ( A - mu[0] ) Psi[0] ; Initial direction
54  * if converged then return
55  * FOR k FROM 1 TO MaxCG DO CG iterations
56  * s1 = (mu[k-1] + < p[k] | A p[k] >/p[k]|^2) / 2;
57  * s2 = (mu[k-1] - < p[k] | A p[k] >/p[k]|^2) / 2;
58  * s3 = |g[k-1]|^2 / |p[k]|;
59  * Compute a and cos(theta), sin(theta)
60  * (see DESY internal report, September 1994, by Bunk, Jansen,
61  * Luescher and Simma)
62  * lambda = mu[k] = mu[k-1] - 2 a sin^2(theta);
63  * Psi[k] = cos(theta) Psi[k-1] + sin(theta) p[k]/|p[k]|;
64  * Apsi[k] = cos(theta) Apsi[k-1] + sin(theta) A p[k]/|p[k]|;
65  * g[k] = Apsi[k] - mu[k] Psi[k]
66  *
67  * if now converged, then exit
68  *
69  * b[k+1] := cos(theta) |g[k]|^2 / |g[k-1]|^2;
70  * p[k+1] := g[k] + b[k+1] (p[k] - Psi[k] < Psi[k] | p[k] >); New direction
71 
72  * Arguments:
73 
74  * A The hermitian Matrix as a lin op (Read)
75  * lambda Eigenvalue to find (Write)
76  * Psi_all Eigenvectors (Modify)
77  * N_eig Current Eigenvalue number (Read)
78  * RsdR_r (relative) residue (Read)
79  * n_renorm Renormalize every n_renorm iter.(Read)
80  * n_min Minimum no of CG iters to do (Read)
81  * n_max Maximum no of CG iters to do (Read)
82  * n_count Number of CG iteration (done) (Write)
83  * Kalk_Sim Use Kalkreuter-Simma criterion (Read)
84  * delta_cycle The initial error estimate (Read)
85  * gamma "Convergence factor" gamma required (Read)
86  * ProjApsiP flag for projecting A.psi (Read)
87 
88  * Local Variables:
89 
90  * psi New eigenstd::vector
91  * p Direction std::vector
92  * Apsi Temporary for A.psi
93  * Ap Temporary for A.p, and other
94  * mu Ritz functional value
95  * g2 | g[k] |**2
96  * p2 | p[k] |**2
97  * k CG iteration counter
98  * b beta[k+1]
99  * and some others...
100  */
101 
102 template < typename T >
103 void RitzArray_t(const LinearOperatorArray<T>& A, // Herm Pos Def
104  Real& lambda, // Current E-value
105  multi2d<T>& psi_all, // E-std::vector array
106  int N_eig, // Current evec index
107  const Real& Rsd_r, // Target relative residue
108  const Real& Rsd_a, // Target absolute residue
109  const Real& zero_cutoff, // if ev-slips below this
110  // we consider it to be a zero
111  int n_renorm, // Renormalise frequency
112  int n_min, int n_max, // minimum / maximum no of iters to do
113  int MaxCG, // Max iters after which we bomb
114  bool ProjApsiP, // Project A (?) -- user option
115  int& n_count, // No of iters actually taken
116  Real& final_grad, // || g || at the end
117  bool Kalk_Sim, // Are we in Kalk Simma mode?
118  const Real& delta_cycle, // Initial error estimate (KS mode)
119  const Real& gamma_factor) // Convergence factor Gamma
120 {
121  START_CODE();
122 
123  int N5 = psi_all.size1();
124  int n;
125 
126  multi1d<T> psi(N5);
127  multi1d<T> p(N5);
128  multi1d<T> Apsi(N5);
129  multi1d<T> Ap(N5);
130 
131  const Subset& s = A.subset(); // Subset over which A acts
132 // const Subset& s = all;
133 
134 
135  // Make Psi_all(N_eig-1) orthogonal to the previous eigenvectors */
136  int N_eig_index = N_eig - 1;
137  int N_eig_minus_one = N_eig_index;
138 
139  // For now equate worry about concrete subsetting later
140  for(n=0; n < N5; n++) {
141  psi[n][s] = psi_all[N_eig_index][n];
142  }
143 
144  QDPIO::cout << "ritz: a" << std::endl;
145 
146  // Project out subspace of previous
147  if( N_eig_minus_one > 0 ) {
148  GramSchmArray(psi, psi_all, N_eig_minus_one, s);
149  }
150 
151  // Normalize
152  Double dd = sqrt(norm2(psi,s));
153  Real d = Real(dd);
154 
155  for(n=0; n < N5; n++) {
156  psi[n][s] /= dd;
157  }
158 
159  QDPIO::cout << "ritz: b" << std::endl;
160 
161  // Now we can start
162  // Apsi[0] := A . Psi[0]
163  // A expects multi1d.
164  A(Apsi, psi, PLUS);
165 
166  // Project to orthogonal subspace, if wanted
167  // Should not be necessary, following Kalkreuter-Simma **/
168  if( N_eig_minus_one > 0 ) {
169  if (ProjApsiP) {
170  GramSchmArray(Apsi, psi_all, N_eig_index, s);
171  }
172  }
173 
174  QDPIO::cout << "ritz: c" << std::endl;
175 
176  // mu := < Psi[0] | A Psi[0] >
177  Double mu = innerProductReal(psi[0], Apsi[0], s);
178  for(n=1; n < N5; n++) {
179  mu += innerProductReal(psi[n], Apsi[n], s);
180  }
181 
182  // p[0] = g[0] := ( A - mu[0] ) Psi[0] = Apsi - mu psi */
183  lambda = Real(mu);
184 
185 
186  // Psi and Apsi are both projected so p should also be (?)
187  for(n=0; n < N5; n++) {
188  p[n][s] = Apsi[n];
189  p[n][s] -= lambda * psi[n];
190  }
191 
192  QDPIO::cout << "ritz: d" << std::endl;
193 
194  // g2 = p2 = |g[0]|^2 = |p[0]|^2
195  Double g2;
196  Double p2;
197  Double g2_0;
198  Double g2_p;
199 
200  g2 = norm2(p,s);
201 
202  QDPIO::cout << "ritz: e" << std::endl;
203 
204  // Keep hold of initial g2
205  g2_0 = g2;
206  p2 = g2;
207 
208 #if 1
209  // Debugging
210  QDPIO::cout << "Starting Ritz: N_eig=" << N_eig << ", mu = " << mu
211  << ", g2_0 = " << g2_0 << std::endl;
212 #endif
213 
214  // Check whether we have converged
215  bool convP;
216  bool minItersDoneP = n_min <= 0;
217  bool maxItersDoneP = n_max <= 0;
218  bool zeroFoundP;
219  bool CGConvP;
220  bool KSConvP;
221  bool deltaCycleConvP;
222 
223  Double rsd_r_sq;
224  Double rsd_a_sq;
225 
226  // Make up the stopping criteria
227  rsd_a_sq = Rsd_a * Rsd_a; // Absolute
228  rsd_r_sq = Rsd_r * Rsd_r * mu * mu; // Relative
229 
230  // Converged if g2 < Max( absolute_target, relative-target)
231  // This is necessary for low lying non-zero modes, where
232  // the relative error can reach below machine precision
233  // (ie g2 never gets smaller than it )
234  CGConvP = toBool( g2 < rsd_r_sq ) || toBool(g2 < rsd_a_sq );
235 
236  // Zero Ev-s can reach the cutoff value quickly, also
237  // the absolute error doesn't apply to them.
238  // I could try and use the absolute error as a zero cutoff...
239  // But lets allow this flexibility
240  zeroFoundP = toBool( fabs(mu) < zero_cutoff );
241 
242  // error based on delta_cycle
243  // NOT USED AT THIS TIME BUT POSSIBLY IN THE FUTURE
244  Double delta_cycle_err = delta_cycle;
245 
246  if( Kalk_Sim == false )
247  {
248  // Normal CG stopping criterion
249  // The stopping criterion is satisfied AND
250  // we have performed the minimum number of iterations
251  convP = minItersDoneP && ( CGConvP || zeroFoundP );
252  }
253  else
254  {
255  // Kalk-Sim stopping criterion
256  // The iteration terminates if
257  //
258  // i) The minimum no of iters is done and max iters is also done
259  // (this is iteration 0 so I ignore max iters at this pint
260  //
261  // AND either the following is true
262  //
263  // i) The delta cycle bound is reached (*)
264  // ii) If the normal CG criterion is satisfied
265  // iii) If mu has reached the zero cutoff
266  //
267  // (*) KS delta cycle bount is not in use at this time.
268  //KSConvP = toBool( delta_cycle_err < rsd );
269  KSConvP = false; // Not in use
270 
271  convP = minItersDoneP && ( KSConvP || CGConvP || zeroFoundP );
272  }
273 
274  if ( convP ) {
275  n_count = 0;
276  END_CODE();
277  return;
278  }
279 
280 
281  Double s1, s2, s3, a, b ;
282  const Double one = Double(1);
283  const Double two = Double(2);
284  const Double half = Double(0.5);
285  Complex xp;
286  DComplex dxp;
287 
288  Double st, ct; // Sin theta, cos theta
289 
290  // FOR k FROM 1 TO MaxCG do
291  // MaxCG is an absolute max after which we bomb
292  for(int k = 1; k <= MaxCG; ++k)
293  {
294  // Ap = A * p */
295  A(Ap, p, PLUS);
296 
297  // Project to orthogonal subspace, if wanted
298  if( N_eig_minus_one > 0 ) {
299  if (ProjApsiP) {
300  GramSchmArray(Ap, psi_all, N_eig_minus_one, s);
301  }
302  }
303 
304  // d = < p | A p >
305  dd = Double(innerProductReal(p[0], Ap[0], s));
306  for(n=1; n < N5; n++) {
307  dd += Double(innerProductReal(p[n], Ap[n], s));
308  }
309 
310  // Minimise Ritz functional along circle.
311  // Work out cos theta and sin theta
312  // See internal report cited above for details
313  dd = dd / p2;
314  s1 = half * (mu+dd);
315  s2 = half * (mu-dd);
316  p2 = sqrt(p2);
317  p2 = one / p2;
318  s3 = g2 * p2;
319  a = fabs(s2);
320 
321  if( toBool (a >= s3) )
322  {
323  dd = s3 / s2;
324  dd = one + dd*dd;
325  dd = sqrt(dd);
326  a *= dd;
327  }
328  else
329  {
330  dd = s2 / s3;
331  dd = one + dd*dd;
332  dd = sqrt(dd);
333  a = s3 * dd;
334  }
335 
336  s2 /= a; // Now s2 is cos(delta)
337  s3 /= a; // Now s3 is sin(delta)
338 
339  if( toBool( s2 > 0) )
340  {
341  s2 = half * (one+s2);
342  dd = -sqrt(s2); // Now d is sin(theta)
343  s2 = -half * s3 / dd; // Now s2 is cos(theta)
344  }
345  else
346  {
347  s2 = half * (one-s2);
348  s2 = sqrt(s2); // Now s2 is cos(theta)
349  dd = -half * s3 / s2; // Now d is sin(theta)
350  }
351 
352  // mu[k] = mu[k-1] - 2 a d^2
353  mu -= two * a * dd * dd;
354  lambda = Real(mu);
355 
356  // del_lamb is the change in lambda
357  // used in an old stopping criterion, which
358  // we may have to revisit
359  // del_lam = Real(s1);
360 
361  st = dd*p2; // Now st is sin(theta)/|p|
362  ct = s2; // Now ct is cos(theta)
363 
364  // Psi[k] = ct Psi[k-1] + st p[k-1]
365  // Apsi[k] = ct Apsi[k-1] + st Ap
366  for(n=0; n < N5; n++)
367  {
368  psi[n][s] *= Real(ct);
369  psi[n][s] += p[n] * Real(st);
370  Apsi[n][s] *= Real(ct);
371  Apsi[n][s] += Ap[n] * Real(st);
372  }
373 
374  // Ap = g[k] = Apsi[k] - mu[k] Psi[k]
375  for(n=0; n < N5; n++) {
376  Ap[n][s] = Apsi[n] - psi[n]*lambda;
377  }
378 
379  // g2 = |g[k]|**2 = |Ap|**2
380  s1 = g2; // Now s1 is |g[k-1]|^2
381  g2_p = g2; // g2_p is g2 "previous"
382  g2 = norm2(Ap,s);
383 
384  // Convergence test
385  // Check for min_KS / max_KS iters done
386  minItersDoneP = ( k >= n_min );
387  maxItersDoneP = ( k >= n_max );
388 
389  // Conservative CG test
390  rsd_a_sq = Rsd_a*Rsd_a;
391  rsd_r_sq = Rsd_r*Rsd_r*mu*mu;
392 
393  // Converged if g2 < Max( absolute_target, relative-target)
394  // This is necessary for low lying non-zero modes, where
395  // the relative error can reach below machine precision
396  // (ie g2 never gets smaller than it )
397  CGConvP = toBool( g2 < rsd_a_sq ) || toBool( g2 < rsd_r_sq);
398 
399  // Zero Ev-s can reach the cutoff value quickly, also
400  // the absolute error doesn't apply to them.
401  // I could try and use the absolute error as a zero cutoff...
402  // But lets allow this flexibility
403  zeroFoundP = toBool( fabs(mu) < zero_cutoff );
404 
405  if( Kalk_Sim == false ) {
406 
407  // Non Kalk Sim criteria. We have done the minimum
408  // Number of iterations, and we have either done the maximum
409  // number too or we have converged
410  convP = minItersDoneP && ( maxItersDoneP || CGConvP || zeroFoundP );
411  }
412  else {
413  // Kalk-Sim stopping criterion
414  // The iteration terminates if
415  //
416  // i) The minimum no of iters is done
417  // AND either the following is true
418  // i) KS_max iters is also done
419  // ii) The delta cycle bound is reached (*)
420  // iii) If the normal CG criterion is satisfied
421  // vi) If mu has reached the zero cutoff
422  //
423  // (*) KS delta cycle bount is not in use at this time.
424 
425  /* The following commented lines were a stab at the delta_cycle bound
426 
427  // work out decrease in || g^2 ||.
428  Double g_decr_factor = g2 / g2_p;
429 
430  // "Extrapolate the delta_cycle error with the decrease in g"
431  delta_cycle_err *= fabs(g_decr_factor);
432 
433  deltaCycleConvP = toBool( delta_cycle_err < rsd );
434  */
435 
436  deltaCycleConvP = false;
437  Double g2_g0_ratio = g2 / g2_0;
438  KSConvP = deltaCycleConvP || toBool( g2_g0_ratio <= Double(gamma_factor)) ;
439  convP = minItersDoneP && ( maxItersDoneP || CGConvP || KSConvP || zeroFoundP );
440 
441  }
442 
443 
444  if( convP )
445  {
446  n_count = k;
447 
448  // Project onto orthog subspace
449  if( N_eig_minus_one > 0 ) {
450  GramSchmArray(psi, psi_all, N_eig_minus_one, s);
451  }
452 
453  // Renormalise
454  dd = sqrt(norm2(psi,s));
455 
456  for(n=0; n < N5; n++) {
457  psi[n][s] /= Real(dd);
458  }
459 
460  dd -= one;
461 
462 
463  // Print out info about convergence
464 #if 0
465  QDPIO::cout << "Converged at iter=" << k << ", lambda = " << lambda
466  << ", rsd | mu | = " << rsd << ", || g || = "
467  << sqrt(g2) << " || x || - 1 = " << d << std::endl;
468 
469  if(Kalk_Sim) {
470  // Extra info for KalkSimma Mode
471  QDPIO::cout << "KS: gamma = "<< gamma_factor << ", || g ||^2/|| g_0 ||^2="
472  << g2/g2_0
473  << ", delta_cycle_err=" << delta_cycle_err << std::endl;
474  QDPIO::cout << "KS: CGConvP = " << CGConvP << ", KSConvP = " << KSConvP << " deltaCycleConvP = " << deltaCycleConvP << std::endl;
475  }
476 #endif
477 
478  QDPIO::cout << "ritz: some convergence" << std::endl;
479 
480  // Recompute lambda
481  // Apsi = A psi
482  A( Apsi, psi, PLUS);
483  s1 = mu;
484  mu = innerProductReal(psi[0], Apsi[0], s);
485  for(n=1; n < N5; n++) {
486  mu += innerProductReal(psi[n], Apsi[n], s);
487  }
488 
489  lambda = Real(mu);
490 #if 1
491  QDPIO::cout << "Mu-s at convergence: old " << s1 << " vs " << mu << std::endl;
492 
493 #endif
494  // Copy std::vector back into psi array.
495  for(n=0; n < N5; n++) {
496  psi_all[N_eig_index][n][s] = psi[n];
497  }
498 
499  // Work out final gradient
500  for(n=0; n < N5; n++) {
501  Ap[n][s] = Apsi[n] - psi[n]*lambda;
502  }
503 
504  dd = sqrt(norm2(Ap,s));
505  final_grad = Real(dd);
506 
507  END_CODE();
508  return;
509 
510  }
511 
512 
513  // Work out new beta
514  /* b = beta[k] = cos(theta) |g[k]|^2 / |g[k-1]|^2 */
515  b = ct * g2/g2_p;
516 
517  ct *= 0.05 * b;
518  dd = sqrt(g2);
519  ct /= p2*dd;
520 
521  // If beta gets very big,
522  if( toBool( ct > Double(1)) ) {
523 
524  /* Restart: p[k] = g[k] = Ap */
525  QDPIO::cout << "Restart at iter " << k << " since beta = " << b << std::endl;
526  for(n=0; n < N5; n++) {
527  p[n][s] = Ap[n];
528  }
529  }
530  else {
531  /* xp = < Psi[k] | p[k-1] > */
532  dxp = innerProduct(psi[0], p[0], s);
533  for(n=1; n < N5; n++) {
534  dxp += innerProduct(psi[n], p[n], s);
535  }
536 
537  xp = cmplx(Real(real(dxp)), Real(imag(dxp)));
538 
539  /* p[k] = g[k] + b (p[k-1] - xp psi[k]) */
540  for(n=0; n < N5; n++) {
541  p[n][s] -= psi[n] * xp;
542  p[n][s] *= Real(b);
543  p[n][s] += Ap[n];
544  }
545  }
546 
547 // QDPIO::cout << "ritz: before renorm" << std::endl;
548 
549  if( k % n_renorm == 0 ) {
550  /* Renormalize, and re-orthogonalize */
551  /* Project to orthogonal subspace */
552  if( N_eig_minus_one > 0 ) {
553  GramSchmArray(psi, psi_all, N_eig_minus_one, s);
554  }
555 
556  /* Normalize */
557  dd = sqrt(norm2(psi,s));
558  ct = Double(1)/dd;
559  for(n=0; n < N5; n++) {
560  psi[n][s] /= Real(dd);
561  }
562  dd -= one;
563 
564  // Apsi := A . Psi
565  A(Apsi, psi, PLUS);
566 
567  // Project to orthogonal subspace, if wanted
568  // Should not be necessary, following Kalkreuter-Simma
569  if (ProjApsiP) {
570  GramSchmArray(Apsi, psi_all, N_eig_index, s);
571  }
572 
573  // mu := < Psi | A Psi >
574  mu = innerProductReal(psi[0], Apsi[0], s);
575  for(n=1; n < N5; n++) {
576  mu += innerProductReal(psi[n], Apsi[n], s);
577  }
578 
579  /* g[k] = Ap = ( A - mu ) Psi */
580  lambda = Real(mu);
581  for(n=0; n < N5; n++) {
582  Ap[n][s] = Apsi[n];
583  Ap[n][s] -= psi[n] * lambda;
584  }
585 
586  /* g2 = |g[k]|**2 = |Ap|**2 */
587  g2 = norm2(Ap, s);
588 
589  /* Project p[k] to orthogonal subspace */
590  if( N_eig_minus_one > 0 ) {
591  GramSchmArray(p, psi_all, N_eig_minus_one, s);
592  }
593 
594  /* Make p[k] orthogonal to Psi[k] */
595  GramSchmArray(p, psi, s);
596 
597  /* Make < g[k] | p[k] > = |g[k]|**2: p[k] = p_old[k] + xp g[k],
598  xp = (g2 - < g | p_old >) / g2; g[k] = Ap */
599  p2 = 0;
600  ct = Double(1) / g2;
601 
602  dxp = innerProduct(Ap[0], p[0], s);
603  for(n=1; n < N5; n++) {
604  dxp += innerProduct(Ap[n], p[n], s);
605  }
606 
607  dxp = ct*(cmplx(g2, Double(0)) - dxp);
608  xp = cmplx(Real(real(dxp)), Real(imag(dxp)));
609 
610  for(n=0; n < N5; n++) {
611  p[n][s] += Ap[n] * xp;
612  }
613  }
614  else if (ProjApsiP && N_eig_minus_one > 0)
615  {
616  /* Project psi and p to orthogonal subspace */
617  if( N_eig_minus_one > 0 )
618  {
619  GramSchmArray(psi, psi_all, N_eig_minus_one, s);
620  GramSchmArray(p, psi_all, N_eig_minus_one, s);
621  }
622  }
623 
624  /* p2 = |p[k]|**2 */
625  p2 = norm2(p,s);
626  }
627 
628  /* Copy psi back into psi_all(N_eig-1) */
629  for(n=0; n < N5; n++) {
630  psi_all[N_eig_index][n][s] = psi[n];
631  }
632 
633  n_count = MaxCG;
634  final_grad = sqrt(g2);
635  QDPIO::cerr << "too many CG/Ritz iterations: n_count=" << n_count
636  << ", rsd_r =" << sqrt(rsd_r_sq) <<" rsd_a=" << Rsd_a << ", ||g||=" << sqrt(g2) << ", p2=" << p2
637  << ", lambda" << lambda << std::endl;
638  QDP_abort(1);
639  END_CODE();
640 }
641 
642 
643 
644 
645 void Ritz(const LinearOperatorArray<LatticeFermion>& A, // Herm Pos Def
646  Real& lambda, // Current E-value
647  multi2d<LatticeFermion>& psi_all, // E-std::vector array
648  int N_eig, // Current evec index
649  const Real& Rsd_r, // Target relative residue
650  const Real& Rsd_a, // Absolute target residue
651  const Real& zero_cutoff, // If ev-slips below this we consider it
652  // to be zero
653  int n_renorm, // Renormalise frequency
654  int n_min, int n_max, // minimum / maximum no of iters to do
655  int MaxCG, // Max no of iters after which we bomb
656  bool ProjApsiP, // Project A (?) -- user option
657  int& n_count, // No of iters actually taken
658  Real& final_grad, // Final gradient at the end.
659  bool Kalk_Sim, // Are we in Kalk Simma mode?
660  const Real& delta_cycle, // Initial error estimate (KS mode)
661  const Real& gamma_factor) // Convergence factor Gamma
662 {
663  RitzArray_t(A, lambda, psi_all, N_eig, Rsd_r, Rsd_a, zero_cutoff,
664  n_renorm, n_min, n_max, MaxCG,
665  ProjApsiP, n_count, final_grad,
666  Kalk_Sim, delta_cycle, gamma_factor);
667 }
668 
669 } // end namespace Chroma
Primary include file for CHROMA library code.
Linear Operator to arrays.
Definition: linearop.h:61
int mu
Definition: cool.cc:24
Gramm-Schmidt orthogonolization.
void GramSchmArray(multi2d< LatticeFermion > &psi, const int Npsi, const multi2d< LatticeFermion > &vec, const int Nvec, const Subset &sub)
Gramm-Schmidt orthogonolization.
void RitzArray_t(const LinearOperatorArray< T > &A, Real &lambda, multi2d< T > &psi_all, int N_eig, const Real &Rsd_r, const Real &Rsd_a, const Real &zero_cutoff, int n_renorm, int n_min, int n_max, int MaxCG, bool ProjApsiP, int &n_count, Real &final_grad, bool Kalk_Sim, const Real &delta_cycle, const Real &gamma_factor)
Minimizes the Ritz functional with a CG based algorithm.
Definition: ritz_array.cc:103
unsigned n
Definition: ldumul_w.cc:36
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Double two
Definition: pbg5p_w.cc:53
int n_count
Definition: invbicg.cc:78
Double one
Definition: invbicg.cc:105
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > int MaxCG
Definition: pbg5p_w.cc:32
@ PLUS
Definition: chromabase.h:45
void Ritz(const LinearOperator< LatticeFermion > &A, Real &lambda, multi1d< LatticeFermion > &psi_all, int N_eig, const Real &Rsd_r, const Real &Rsd_a, const Real &zero_cutoff, int n_renorm, int n_min, int n_max, int MaxCG, bool ProjApsiP, int &n_count, Real &final_grad, bool Kalk_Sim, const Real &delta_cycle, const Real &gamma_factor)
Definition: ritz.cc:559
Complex a
Definition: invbicg.cc:95
LatticeFermion psi
Definition: mespbg5p_w.cc:35
DComplex d
Definition: invbicg.cc:99
START_CODE()
A(A, psi, r, Ncb, PLUS)
Complex b
Definition: invbicg.cc:96
int k
Definition: invbicg.cc:119
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Definition: gtest.h:7351