| 85 | |
| 86 | |
| 87 | void Preconditioner :: Test () const |
| 88 | { |
| 89 | cout << IM(1) << "Compute eigenvalues" << endl; |
| 90 | const BaseMatrix & amat = GetAMatrix(); |
| 91 | const BaseMatrix & pre = GetMatrix(); |
| 92 | int eigenretval; |
| 93 | |
| 94 | if ( !this->uselapack ) |
| 95 | { |
| 96 | EigenSystem eigen (amat, pre); |
| 97 | eigen.SetPrecision(1e-30); |
| 98 | eigen.SetMaxSteps(1000); |
| 99 | |
| 100 | eigen.SetPrecision(1e-15); |
| 101 | eigenretval = eigen.Calc(); |
| 102 | eigen.PrintEigenValues (*testout); |
| 103 | cout << IM(1) << " Min Eigenvalue : " << eigen.EigenValue(1) << endl; |
| 104 | cout << IM(1) << " Max Eigenvalue : " << eigen.MaxEigenValue() << endl; |
| 105 | cout << IM(1) << " Condition " << eigen.MaxEigenValue()/eigen.EigenValue(1) << endl; |
| 106 | (*testout) << " Min Eigenvalue : " << eigen.EigenValue(1) << endl; |
| 107 | (*testout) << " Max Eigenvalue : " << eigen.MaxEigenValue() << endl; |
| 108 | |
| 109 | if(testresult_ok) *testresult_ok = eigenretval; |
| 110 | if(testresult_min) *testresult_min = eigen.EigenValue(1); |
| 111 | if(testresult_max) *testresult_max = eigen.MaxEigenValue(); |
| 112 | |
| 113 | |
| 114 | // (*testout) << " Condition " << eigen.MaxEigenValue()/eigen.EigenValue(1) << endl; |
| 115 | // for (int i = 1; i < min2 (10, eigen.NumEigenValues()); i++) |
| 116 | // cout << "cond(i) = " << eigen.MaxEigenValue() / eigen.EigenValue(i) << endl; |
| 117 | (*testout) << " Condition " << eigen.MaxEigenValue()/eigen.EigenValue(1) << endl; |
| 118 | |
| 119 | } |
| 120 | |
| 121 | else |
| 122 | { |
| 123 | #ifdef LAPACK |
| 124 | int n = amat.Height(); |
| 125 | int n_elim = 0; |
| 126 | BitArray internaldofs (n); |
| 127 | internaldofs.Clear(); |
| 128 | |
| 129 | for ( int i = 0; i < n; i++ ) |
| 130 | { |
| 131 | FlatArray rowindices = |
| 132 | dynamic_cast<const BaseSparseMatrix&>(amat).GetRowIndices(i); |
| 133 | if ( rowindices.Size() <= 1 ) |
| 134 | internaldofs.SetBit(i); |
| 135 | else |
| 136 | n_elim++; |
| 137 | } |
| 138 | |
| 139 | Matrix<Complex> mat(n_elim), mat2(n_elim), ev(n_elim); |
| 140 | BaseVector & v1 = *amat.CreateColVector(); |
| 141 | BaseVector & v2 = *amat.CreateColVector(); |
| 142 | FlatVector<Complex> fv1 = v1.FVComplex(); |
| 143 | // FlatVector<Complex> fv2 = v2.FVComplex(); |
| 144 |
nothing calls this directly
no test coverage detected