Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AnasaziSVQBOrthoManager.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Anasazi: Block Eigensolvers Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 
35 #ifndef ANASAZI_SVQB_ORTHOMANAGER_HPP
36 #define ANASAZI_SVQB_ORTHOMANAGER_HPP
37 
47 #include "AnasaziConfigDefs.hpp"
51 #include "Teuchos_LAPACK.hpp"
52 
53 namespace Anasazi {
54 
55  template<class ScalarType, class MV, class OP>
56  class SVQBOrthoManager : public MatOrthoManager<ScalarType,MV,OP> {
57 
58  private:
59  typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
65  std::string dbgstr;
66 
67 
68  public:
69 
71 
72  SVQBOrthoManager( Teuchos::RCP<const OP> Op = Teuchos::null, bool debug = false );
74 
75 
79 
80 
81 
83 
84 
85 
124  void projectMat (
125  MV &X,
128  = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >(Teuchos::null)),
129  Teuchos::RCP<MV> MX = Teuchos::null,
130  Teuchos::Array<Teuchos::RCP<const MV> > MQ = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null))
131  ) const;
132 
133 
172  int normalizeMat (
173  MV &X,
175  Teuchos::RCP<MV> MX = Teuchos::null
176  ) const;
177 
178 
239  MV &X,
242  = Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >(Teuchos::null)),
244  Teuchos::RCP<MV> MX = Teuchos::null,
245  Teuchos::Array<Teuchos::RCP<const MV> > MQ = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null))
246  ) const;
247 
249 
251 
252 
258  orthonormErrorMat(const MV &X, Teuchos::RCP<const MV> MX = Teuchos::null) const;
259 
266  const MV &X,
267  const MV &Y,
268  Teuchos::RCP<const MV> MX = Teuchos::null,
269  Teuchos::RCP<const MV> MY = Teuchos::null
270  ) const;
271 
273 
274  private:
275 
276  MagnitudeType eps_;
277  bool debug_;
278 
279  // ! Routine to find an orthogonal/orthonormal basis
280  int findBasis(MV &X, Teuchos::RCP<MV> MX,
284  bool normalize_in ) const;
285  };
286 
287 
289  // Constructor
290  template<class ScalarType, class MV, class OP>
292  : MatOrthoManager<ScalarType,MV,OP>(Op), dbgstr(" *** "), debug_(debug) {
293 
295  eps_ = lapack.LAMCH('E');
296  if (debug_) {
297  std::cout << "eps_ == " << eps_ << std::endl;
298  }
299  }
300 
301 
303  // Compute the distance from orthonormality
304  template<class ScalarType, class MV, class OP>
307  const ScalarType ONE = SCT::one();
308  int rank = MVT::GetNumberVecs(X);
311  for (int i=0; i<rank; i++) {
312  xTx(i,i) -= ONE;
313  }
314  return xTx.normFrobenius();
315  }
316 
318  // Compute the distance from orthogonality
319  template<class ScalarType, class MV, class OP>
322  const MV &X,
323  const MV &Y,
326  ) const {
327  int r1 = MVT::GetNumberVecs(X);
328  int r2 = MVT::GetNumberVecs(Y);
331  return xTx.normFrobenius();
332  }
333 
334 
335 
337  template<class ScalarType, class MV, class OP>
339  MV &X,
342  Teuchos::RCP<MV> MX,
344  (void)MQ;
345  findBasis(X,MX,C,Teuchos::null,Q,false);
346  }
347 
348 
349 
351  // Find an Op-orthonormal basis for span(X), with rank numvectors(X)
352  template<class ScalarType, class MV, class OP>
354  MV &X,
356  Teuchos::RCP<MV> MX) const {
359  return findBasis(X,MX,C,B,Q,true);
360  }
361 
362 
363 
365  // Find an Op-orthonormal basis for span(X) - span(W)
366  template<class ScalarType, class MV, class OP>
368  MV &X,
372  Teuchos::RCP<MV> MX,
374  (void)MQ;
375  return findBasis(X,MX,C,B,Q,true);
376  }
377 
378 
379 
380 
382  // Find an Op-orthonormal basis for span(X), with the option of extending the subspace so that
383  // the rank is numvectors(X)
384  //
385  // Tracking the coefficients (C[i] and B) for this code is complicated by the fact that the loop
386  // structure looks like
387  // do
388  // project
389  // do
390  // ortho
391  // end
392  // end
393  // However, the recurrence for the coefficients is not complicated:
394  // B = I
395  // C = 0
396  // do
397  // project yields newC
398  // C = C + newC*B
399  // do
400  // ortho yields newR
401  // B = newR*B
402  // end
403  // end
404  // This holds for each individual C[i] (which correspond to the list of bases we are orthogonalizing
405  // against).
406  //
407  template<class ScalarType, class MV, class OP>
409  MV &X, Teuchos::RCP<MV> MX,
413  bool normalize_in) const {
414 
415  const ScalarType ONE = SCT::one();
416  const MagnitudeType MONE = SCTM::one();
417  const MagnitudeType ZERO = SCTM::zero();
418 
419  int numGS = 0,
420  numSVQB = 0,
421  numRand = 0;
422 
423  // get sizes of X,MX
424  int xc = MVT::GetNumberVecs(X);
425  ptrdiff_t xr = MVText::GetGlobalLength( X );
426 
427  // get sizes of Q[i]
428  int nq = Q.length();
429  ptrdiff_t qr = (nq == 0) ? 0 : MVText::GetGlobalLength(*Q[0]);
430  ptrdiff_t qsize = 0;
431  std::vector<int> qcs(nq);
432  for (int i=0; i<nq; i++) {
433  qcs[i] = MVT::GetNumberVecs(*Q[i]);
434  qsize += qcs[i];
435  }
436 
437  if (normalize_in == true && qsize + xc > xr) {
438  // not well-posed
439  TEUCHOS_TEST_FOR_EXCEPTION( true, std::invalid_argument,
440  "Anasazi::SVQBOrthoManager::findBasis(): Orthogonalization constraints not feasible" );
441  }
442 
443  // try to short-circuit as early as possible
444  if (normalize_in == false && (qsize == 0 || xc == 0)) {
445  // nothing to do
446  return 0;
447  }
448  else if (normalize_in == true && (xc == 0 || xr == 0)) {
449  // normalize requires X not empty
450  TEUCHOS_TEST_FOR_EXCEPTION( true, std::invalid_argument,
451  "Anasazi::SVQBOrthoManager::findBasis(): X must be non-empty" );
452  }
453 
454  // check that Q matches X
455  TEUCHOS_TEST_FOR_EXCEPTION( qsize != 0 && qr != xr , std::invalid_argument,
456  "Anasazi::SVQBOrthoManager::findBasis(): Size of X not consistant with size of Q" );
457 
458  /* If we don't have enough C, expanding it creates null references
459  * If we have too many, resizing just throws away the later ones
460  * If we have exactly as many as we have Q, this call has no effect
461  */
462  C.resize(nq);
464  // check the size of the C[i] against the Q[i] and consistency between Q[i]
465  for (int i=0; i<nq; i++) {
466  // check size of Q[i]
467  TEUCHOS_TEST_FOR_EXCEPTION( MVText::GetGlobalLength( *Q[i] ) != qr, std::invalid_argument,
468  "Anasazi::SVQBOrthoManager::findBasis(): Size of Q not mutually consistant" );
469  TEUCHOS_TEST_FOR_EXCEPTION( qr < qcs[i], std::invalid_argument,
470  "Anasazi::SVQBOrthoManager::findBasis(): Q has less rows than columns" );
471  // check size of C[i]
472  if ( C[i] == Teuchos::null ) {
474  }
475  else {
476  TEUCHOS_TEST_FOR_EXCEPTION( C[i]->numRows() != qcs[i] || C[i]->numCols() != xc, std::invalid_argument,
477  "Anasazi::SVQBOrthoManager::findBasis(): Size of Q not consistant with C" );
478  }
479  // clear C[i]
480  C[i]->putScalar(ZERO);
482  }
483 
484 
486  // Allocate necessary storage
487  // C were allocated above
488  // Allocate MX and B (if necessary)
489  // Set B = I
490  if (normalize_in == true) {
491  if ( B == Teuchos::null ) {
493  }
494  TEUCHOS_TEST_FOR_EXCEPTION( B->numRows() != xc || B->numCols() != xc, std::invalid_argument,
495  "Anasazi::SVQBOrthoManager::findBasis(): Size of B not consistant with X" );
496  // set B to I
497  B->putScalar(ZERO);
498  for (int i=0; i<xc; i++) {
499  (*B)(i,i) = MONE;
500  }
501  }
502  /******************************************
503  * If _hasOp == false, DO NOT MODIFY MX *
504  ******************************************
505  * if Op==null, MX == X (via pointer)
506  * Otherwise, either the user passed in MX or we will allocate and compute it
507  *
508  * workX will be a multivector of the same size as X, used to perform X*S when normalizing
509  */
510  Teuchos::RCP<MV> workX;
511  if (normalize_in) {
512  workX = MVT::Clone(X,xc);
513  }
514  if (this->_hasOp) {
515  if (MX == Teuchos::null) {
516  // we need to allocate space for MX
517  MX = MVT::Clone(X,xc);
518  OPT::Apply(*(this->_Op),X,*MX);
519  this->_OpCounter += MVT::GetNumberVecs(X);
520  }
521  }
522  else {
523  MX = Teuchos::rcpFromRef(X);
524  }
525  std::vector<ScalarType> normX(xc), invnormX(xc);
526  Teuchos::SerialDenseMatrix<int,ScalarType> XtMX(xc,xc), workU(1,1);
528  /**********************************************************************
529  * allocate storage for eigenvectors,eigenvalues of X^T Op X, and for
530  * the work space needed to compute this xc-by-xc eigendecomposition
531  **********************************************************************/
532  std::vector<ScalarType> work;
533  std::vector<MagnitudeType> lambda, lambdahi, rwork;
534  if (normalize_in) {
535  // get size of work from ILAENV
536  int lwork = lapack.ILAENV(1,"hetrd","VU",xc,-1,-1,-1);
537  // lwork >= (nb+1)*n for complex
538  // lwork >= (nb+2)*n for real
539  TEUCHOS_TEST_FOR_EXCEPTION( lwork < 0, OrthoError,
540  "Anasazi::SVQBOrthoManager::findBasis(): Error code from ILAENV" );
541 
542  lwork = (lwork+2)*xc;
543  work.resize(lwork);
544  // size of rwork is max(1,3*xc-2)
545  lwork = (3*xc-2 > 1) ? 3*xc - 2 : 1;
546  rwork.resize(lwork);
547  // size of lambda is xc
548  lambda.resize(xc);
549  lambdahi.resize(xc);
550  workU.reshape(xc,xc);
551  }
552 
553  // test sizes of X,MX
554  int mxc = (this->_hasOp) ? MVT::GetNumberVecs( *MX ) : xc;
555  ptrdiff_t mxr = (this->_hasOp) ? MVText::GetGlobalLength( *MX ) : xr;
556  TEUCHOS_TEST_FOR_EXCEPTION( xc != mxc || xr != mxr, std::invalid_argument,
557  "Anasazi::SVQBOrthoManager::findBasis(): Size of X not consistant with MX" );
558 
559  // sentinel to continue the outer loop (perform another projection step)
560  bool doGramSchmidt = true;
561  // variable for testing orthonorm/orthog
562  MagnitudeType tolerance = MONE/SCTM::squareroot(eps_);
563 
564  // outer loop
565  while (doGramSchmidt) {
566 
568  // perform projection
569  if (qsize > 0) {
570 
571  numGS++;
572 
573  // Compute the norms of the vectors
574  {
575  std::vector<MagnitudeType> normX_mag(xc);
577  for (int i=0; i<xc; ++i) {
578  normX[i] = normX_mag[i];
579  invnormX[i] = (normX_mag[i] == ZERO) ? ZERO : MONE/normX_mag[i];
580  }
581  }
582  // normalize the vectors
583  MVT::MvScale(X,invnormX);
584  if (this->_hasOp) {
585  MVT::MvScale(*MX,invnormX);
586  }
587  // check that vectors are normalized now
588  if (debug_) {
589  std::vector<MagnitudeType> nrm2(xc);
590  std::cout << dbgstr << "max post-scale norm: (with/without MX) : ";
591  MagnitudeType maxpsnw = ZERO, maxpsnwo = ZERO;
593  for (int i=0; i<xc; i++) {
594  maxpsnw = (nrm2[i] > maxpsnw ? nrm2[i] : maxpsnw);
595  }
596  this->norm(X,nrm2);
597  for (int i=0; i<xc; i++) {
598  maxpsnwo = (nrm2[i] > maxpsnwo ? nrm2[i] : maxpsnwo);
599  }
600  std::cout << "(" << maxpsnw << "," << maxpsnwo << ")" << std::endl;
601  }
602  // project the vectors onto the Qi
603  for (int i=0; i<nq; i++) {
604  MatOrthoManager<ScalarType,MV,OP>::innerProdMat(*Q[i],X,*newC[i],Teuchos::null,MX);
605  }
606  // remove the components in Qi from X
607  for (int i=0; i<nq; i++) {
608  MVT::MvTimesMatAddMv(-ONE,*Q[i],*newC[i],ONE,X);
609  }
610  // un-scale the vectors
611  MVT::MvScale(X,normX);
612  // Recompute the vectors in MX
613  if (this->_hasOp) {
614  OPT::Apply(*(this->_Op),X,*MX);
615  this->_OpCounter += MVT::GetNumberVecs(X);
616  }
617 
618  //
619  // Compute largest column norm of
620  // ( C[0] )
621  // C = ( .... )
622  // ( C[nq-1] )
623  MagnitudeType maxNorm = ZERO;
624  for (int j=0; j<xc; j++) {
625  MagnitudeType sum = ZERO;
626  for (int k=0; k<nq; k++) {
627  for (int i=0; i<qcs[k]; i++) {
628  sum += SCT::magnitude((*newC[k])(i,j))*SCT::magnitude((*newC[k])(i,j));
629  }
630  }
631  maxNorm = (sum > maxNorm) ? sum : maxNorm;
632  }
633 
634  // do we perform another GS?
635  if (maxNorm < 0.36) {
636  doGramSchmidt = false;
637  }
638 
639  // unscale newC to reflect the scaling of X
640  for (int k=0; k<nq; k++) {
641  for (int j=0; j<xc; j++) {
642  for (int i=0; i<qcs[k]; i++) {
643  (*newC[k])(i,j) *= normX[j];
644  }
645  }
646  }
647  // accumulate into C
648  if (normalize_in) {
649  // we are normalizing
650  int info;
651  for (int i=0; i<nq; i++) {
652  info = C[i]->multiply(Teuchos::NO_TRANS,Teuchos::NO_TRANS,ONE,*newC[i],*B,ONE);
653  TEUCHOS_TEST_FOR_EXCEPTION(info != 0, std::logic_error, "Anasazi::SVQBOrthoManager::findBasis(): Input error to SerialDenseMatrix::multiply.");
654  }
655  }
656  else {
657  // not normalizing
658  for (int i=0; i<nq; i++) {
659  (*C[i]) += *newC[i];
660  }
661  }
662  }
663  else { // qsize == 0... don't perform projection
664  // don't do any more outer loops; all we need is to call the normalize code below
665  doGramSchmidt = false;
666  }
667 
668 
670  // perform normalization
671  if (normalize_in) {
672 
673  MagnitudeType condT = tolerance;
674 
675  while (condT >= tolerance) {
676 
677  numSVQB++;
678 
679  // compute X^T Op X
681 
682  // compute scaling matrix for XtMX: D^{.5} and D^{-.5} (D-half and D-half-inv)
683  std::vector<MagnitudeType> Dh(xc), Dhi(xc);
684  for (int i=0; i<xc; i++) {
685  Dh[i] = SCT::magnitude(SCT::squareroot(XtMX(i,i)));
686  Dhi[i] = (Dh[i] == ZERO ? ZERO : MONE/Dh[i]);
687  }
688  // scale XtMX : S = D^{-.5} * XtMX * D^{-.5}
689  for (int i=0; i<xc; i++) {
690  for (int j=0; j<xc; j++) {
691  XtMX(i,j) *= Dhi[i]*Dhi[j];
692  }
693  }
694 
695  // compute the eigenvalue decomposition of S=U*Lambda*U^T (using upper part)
696  int info;
697  lapack.HEEV('V', 'U', xc, XtMX.values(), XtMX.stride(), &lambda[0], &work[0], work.size(), &rwork[0], &info);
698  std::stringstream os;
699  os << "Anasazi::SVQBOrthoManager::findBasis(): Error code " << info << " from HEEV";
700  TEUCHOS_TEST_FOR_EXCEPTION( info != 0, OrthoError,
701  os.str() );
702  if (debug_) {
703  std::cout << dbgstr << "eigenvalues of XtMX: (";
704  for (int i=0; i<xc-1; i++) {
705  std::cout << lambda[i] << ",";
706  }
707  std::cout << lambda[xc-1] << ")" << std::endl;
708  }
709 
710  // remember, HEEV orders the eigenvalues from smallest to largest
711  // examine condition number of Lambda, compute Lambda^{-.5}
712  MagnitudeType maxLambda = lambda[xc-1],
713  minLambda = lambda[0];
714  int iZeroMax = -1;
715  for (int i=0; i<xc; i++) {
716  if (lambda[i] <= 10*eps_*maxLambda) { // finish: this was eps_*eps_*maxLambda
717  iZeroMax = i;
718  lambda[i] = ZERO;
719  lambdahi[i] = ZERO;
720  }
721  /*
722  else if (lambda[i] < eps_*maxLambda) {
723  lambda[i] = SCTM::squareroot(eps_*maxLambda);
724  lambdahi[i] = MONE/lambda[i];
725  }
726  */
727  else {
728  lambda[i] = SCTM::squareroot(lambda[i]);
729  lambdahi[i] = MONE/lambda[i];
730  }
731  }
732 
733  // compute X * D^{-.5} * U * Lambda^{-.5} and new Op*X
734  //
735  // copy X into workX
736  std::vector<int> ind(xc);
737  for (int i=0; i<xc; i++) {ind[i] = i;}
738  MVT::SetBlock(X,ind,*workX);
739  //
740  // compute D^{-.5}*U*Lambda^{-.5} into workU
741  workU.assign(XtMX);
742  for (int j=0; j<xc; j++) {
743  for (int i=0; i<xc; i++) {
744  workU(i,j) *= Dhi[i]*lambdahi[j];
745  }
746  }
747  // compute workX * workU into X
748  MVT::MvTimesMatAddMv(ONE,*workX,workU,ZERO,X);
749  //
750  // note, it seems important to apply Op exactly for large condition numbers.
751  // for small condition numbers, we can update MX "implicitly"
752  // this trick reduces the number of applications of Op
753  if (this->_hasOp) {
754  if (maxLambda >= tolerance * minLambda) {
755  // explicit update of MX
756  OPT::Apply(*(this->_Op),X,*MX);
757  this->_OpCounter += MVT::GetNumberVecs(X);
758  }
759  else {
760  // implicit update of MX
761  // copy MX into workX
762  MVT::SetBlock(*MX,ind,*workX);
763  //
764  // compute workX * workU into MX
765  MVT::MvTimesMatAddMv(ONE,*workX,workU,ZERO,*MX);
766  }
767  }
768 
769  // accumulate new B into previous B
770  // B = Lh * U^H * Dh * B
771  for (int j=0; j<xc; j++) {
772  for (int i=0; i<xc; i++) {
773  workU(i,j) = Dh[i] * (*B)(i,j);
774  }
775  }
776  info = B->multiply(Teuchos::CONJ_TRANS,Teuchos::NO_TRANS,ONE,XtMX,workU,ZERO);
777  TEUCHOS_TEST_FOR_EXCEPTION(info != 0, std::logic_error, "Anasazi::SVQBOrthoManager::findBasis(): Input error to SerialDenseMatrix::multiply.");
778  for (int j=0; j<xc ;j++) {
779  for (int i=0; i<xc; i++) {
780  (*B)(i,j) *= lambda[i];
781  }
782  }
783 
784  // check iZeroMax (rank indicator)
785  if (iZeroMax >= 0) {
786  if (debug_) {
787  std::cout << dbgstr << "augmenting multivec with " << iZeroMax+1 << " random directions" << std::endl;
788  }
789 
790  numRand++;
791  // put random info in the first iZeroMax+1 vectors of X,MX
792  std::vector<int> ind2(iZeroMax+1);
793  for (int i=0; i<iZeroMax+1; i++) {
794  ind2[i] = i;
795  }
796  Teuchos::RCP<MV> Xnull,MXnull;
797  Xnull = MVT::CloneViewNonConst(X,ind2);
798  MVT::MvRandom(*Xnull);
799  if (this->_hasOp) {
800  MXnull = MVT::CloneViewNonConst(*MX,ind2);
801  OPT::Apply(*(this->_Op),*Xnull,*MXnull);
802  this->_OpCounter += MVT::GetNumberVecs(*Xnull);
803  MXnull = Teuchos::null;
804  }
805  Xnull = Teuchos::null;
806  condT = tolerance;
807  doGramSchmidt = true;
808  break; // break from while(condT > tolerance)
809  }
810 
811  condT = SCTM::magnitude(maxLambda / minLambda);
812  if (debug_) {
813  std::cout << dbgstr << "condT: " << condT << ", tolerance = " << tolerance << std::endl;
814  }
815 
816  // if multiple passes of SVQB are necessary, then pass through outer GS loop again
817  if ((doGramSchmidt == false) && (condT > SCTM::squareroot(tolerance))) {
818  doGramSchmidt = true;
819  }
820 
821  } // end while (condT >= tolerance)
822  }
823  // end if(normalize_in)
824 
825  } // end while (doGramSchmidt)
826 
827  if (debug_) {
828  std::cout << dbgstr << "(numGS,numSVQB,numRand) : "
829  << "(" << numGS
830  << "," << numSVQB
831  << "," << numRand
832  << ")" << std::endl;
833  }
834  return xc;
835  }
836 
837 
838 } // namespace Anasazi
839 
840 #endif // ANASAZI_SVQB_ORTHOMANAGER_HPP
841 
An extension of the MultiVecTraits class that adds a new vector length method.This traits class provi...
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
Declaration of basic traits for the multivector type.
int normalizeMat(MV &X, Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B=Teuchos::null, Teuchos::RCP< MV > MX=Teuchos::null) const
This method takes a multivector X and attempts to compute an orthonormal basis for ...
OrdinalType ILAENV(const OrdinalType ispec, const std::string &NAME, const std::string &OPTS, const OrdinalType N1=-1, const OrdinalType N2=-1, const OrdinalType N3=-1, const OrdinalType N4=-1) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Virtual base class which defines basic traits for the operator type.
void innerProdMat(const MV &X, const MV &Y, Teuchos::SerialDenseMatrix< int, ScalarType > &Z, Teuchos::RCP< const MV > MX=Teuchos::null, Teuchos::RCP< const MV > MY=Teuchos::null) const
Provides a matrix-based inner product.
ScalarType LAMCH(const char CMACH) const
An implementation of the Anasazi::MatOrthoManager that performs orthogonalization using the SVQB iter...
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
int projectAndNormalizeMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B=Teuchos::null, Teuchos::RCP< MV > MX=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MQ=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Given a set of bases Q[i] and a multivector X, this method computes an orthonormal basis for ...
Anasazi&#39;s templated virtual class for providing routines for orthogonalization and orthonormalization...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthogErrorMat(const MV &X, const MV &Y, Teuchos::RCP< const MV > MX=Teuchos::null, Teuchos::RCP< const MV > MY=Teuchos::null) const
This method computes the error in orthogonality of two multivectors, measured as the Frobenius norm o...
Traits class which defines basic operations on multivectors.
Virtual base class which defines basic traits for the operator type.
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
Teuchos::ScalarTraits< ScalarType >::magnitudeType orthonormErrorMat(const MV &X, Teuchos::RCP< const MV > MX=Teuchos::null) const
This method computes the error in orthonormality of a multivector, measured as the Frobenius norm of ...
void HEEV(const char JOBZ, const char UPLO, const OrdinalType n, ScalarType *A, const OrdinalType lda, MagnitudeType *W, ScalarType *WORK, const OrdinalType lwork, MagnitudeType *RWORK, OrdinalType *info) const
void projectMat(MV &X, Teuchos::Array< Teuchos::RCP< const MV > > Q, Teuchos::Array< Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > > C=Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)), Teuchos::RCP< MV > MX=Teuchos::null, Teuchos::Array< Teuchos::RCP< const MV > > MQ=Teuchos::tuple(Teuchos::RCP< const MV >(Teuchos::null))) const
Given a list of mutually orthogonal and internally orthonormal bases Q, this method projects a multiv...
SVQBOrthoManager(Teuchos::RCP< const OP > Op=Teuchos::null, bool debug=false)
Constructor specifying re-orthogonalization tolerance.
void normMat(const MV &X, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec, Teuchos::RCP< const MV > MX=Teuchos::null) const
Provides the norm induced by the matrix-based inner product.