16 #ifndef dealii_solver_gmres_h
17 #define dealii_solver_gmres_h
49 template <
typename,
typename>
65 namespace SolverGMRESImplementation
75 template <
typename VectorType>
123 std::vector<typename VectorMemory<VectorType>::Pointer>
data;
192 template <
class VectorType = Vector<
double>>
297 template <
typename MatrixType,
typename PreconditionerType>
301 const VectorType &
b,
302 const PreconditionerType &preconditioner);
310 boost::signals2::connection
312 const bool every_iteration =
false);
320 boost::signals2::connection
322 const std::function<
void(
const std::vector<std::complex<double>> &)> &slot,
323 const bool every_iteration =
false);
332 boost::signals2::connection
335 const bool every_iteration =
true);
343 boost::signals2::connection
354 boost::signals2::connection
360 <<
"The number of temporary vectors you gave (" << arg1
361 <<
") is too small. It should be at least 10 for "
362 <<
"any results, and much more for reasonable ones.");
386 boost::signals2::signal<void(
const std::vector<std::complex<double>> &)>
393 boost::signals2::signal<void(
const std::vector<std::complex<double>> &)>
413 boost::signals2::signal<void(
456 const unsigned int dim,
457 const boost::signals2::signal<
461 const boost::signals2::signal<
void(
double)> &cond_signal);
511 template <
class VectorType = Vector<
double>>
550 template <
typename MatrixType,
typename PreconditionerType>
554 const VectorType &
b,
555 const PreconditionerType &preconditioner);
581 namespace SolverGMRESImplementation
583 template <
class VectorType>
592 template <
class VectorType>
604 template <
class VectorType>
607 const VectorType & temp)
610 if (data[i] ==
nullptr)
613 data[i]->reinit(temp,
true);
620 template <
class VectorType>
624 return (data.size() > 0 ? data.size() - 1 : 0);
631 complex_less_pred(
const std::complex<double> &x,
632 const std::complex<double> &y)
634 return x.real() < y.real() ||
635 (x.real() == y.real() && x.imag() < y.imag());
641 solve_triangular(
const unsigned int dim,
646 for (
int i = dim - 1; i >= 0; --i)
649 for (
unsigned int j = i + 1; j < dim; ++j)
650 s -= solution(j) * H(i, j);
651 solution(i) = s / H(i, i);
660 template <
class VectorType>
662 const unsigned int max_n_tmp_vectors,
663 const bool right_preconditioning,
664 const bool use_default_residual,
665 const bool force_re_orthogonalization,
666 const bool batched_mode,
667 const OrthogonalizationStrategy orthogonalization_strategy)
668 : max_n_tmp_vectors(max_n_tmp_vectors)
669 , right_preconditioning(right_preconditioning)
670 , use_default_residual(use_default_residual)
671 , force_re_orthogonalization(force_re_orthogonalization)
672 , batched_mode(batched_mode)
673 , orthogonalization_strategy(orthogonalization_strategy)
675 Assert(3 <= max_n_tmp_vectors,
676 ExcMessage(
"SolverGMRES needs at least three "
677 "temporary vectors."));
682 template <
class VectorType>
685 const AdditionalData & data)
687 , additional_data(data)
693 template <
class VectorType>
695 const AdditionalData &data)
697 , additional_data(data)
703 template <
class VectorType>
711 for (
int i = 0; i < col; ++i)
713 const double s = si(i);
714 const double c = ci(i);
715 const double dummy = h(i);
716 h(i) = c * dummy + s * h(i + 1);
717 h(i + 1) = -s * dummy + c * h(i + 1);
720 const double r = 1. /
std::sqrt(h(col) * h(col) + h(col + 1) * h(col + 1));
721 si(col) = h(col + 1) * r;
722 ci(col) = h(col) * r;
723 h(col) = ci(col) * h(col) + si(col) * h(col + 1);
724 b(col + 1) = -si(col) *
b(col);
732 namespace SolverGMRESImplementation
734 template <
typename VectorType,
typename Enable =
void>
735 struct is_dealii_compatible_distributed_vector;
737 template <
typename VectorType>
738 struct is_dealii_compatible_distributed_vector<
740 typename std::enable_if<!internal::is_block_vector<VectorType>>::type>
742 static constexpr
bool value = std::is_same<
750 template <
typename VectorType>
751 struct is_dealii_compatible_distributed_vector<
753 typename std::enable_if<internal::is_block_vector<VectorType>>::type>
755 static constexpr
bool value = std::is_same<
756 typename VectorType::BlockType,
763 template <
typename VectorType,
764 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
774 template <
typename VectorType,
775 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
780 return vector.n_blocks();
785 template <
typename VectorType,
786 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
789 block(VectorType &vector,
const unsigned int b)
798 template <
typename VectorType,
799 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
802 block(
const VectorType &vector,
const unsigned int b)
811 template <
typename VectorType,
812 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
814 typename VectorType::BlockType &
815 block(VectorType &vector,
const unsigned int b)
817 return vector.block(
b);
822 template <
typename VectorType,
823 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
825 const typename VectorType::BlockType &
826 block(
const VectorType &vector,
const unsigned int b)
828 return vector.block(
b);
833 template <
class VectorType,
835 !is_dealii_compatible_distributed_vector<VectorType>::value,
836 VectorType> * =
nullptr>
838 Tvmult_add(
const unsigned int dim,
839 const VectorType & vv,
841 & orthogonal_vectors,
844 for (
unsigned int i = 0; i < dim; ++i)
845 h[i] += vv * orthogonal_vectors[i];
850 template <
class VectorType,
852 is_dealii_compatible_distributed_vector<VectorType>::value,
853 VectorType> * =
nullptr>
855 Tvmult_add(
const unsigned int dim,
856 const VectorType & vv,
858 & orthogonal_vectors,
868 static constexpr
unsigned int n_lanes =
872 for (
unsigned int d = 0;
d < dim; ++
d)
877 for (; c < block(vv,
b).locally_owned_size() / n_lanes / 4;
878 ++c, j += n_lanes * 4)
879 for (
unsigned int i = 0; i < dim; ++i)
882 for (
unsigned int k = 0; k < 4; ++k)
883 vvec[k].load(block(vv,
b).begin() + j + k * n_lanes);
885 for (
unsigned int k = 0; k < 4; ++k)
888 temp.
load(block(orthogonal_vectors[i],
b).begin() + j +
890 hs[i] += temp * vvec[k];
895 for (; c < block(vv,
b).locally_owned_size() / n_lanes;
897 for (
unsigned int i = 0; i < dim; ++i)
900 vvec.
load(block(vv,
b).begin() + j);
901 temp.
load(block(orthogonal_vectors[i],
b).begin() + j);
902 hs[i] += temp * vvec;
905 for (
unsigned int i = 0; i < dim; ++i)
906 for (
unsigned int v = 0; v < n_lanes; ++v)
912 for (; j < block(vv,
b).locally_owned_size(); ++j)
913 for (
unsigned int i = 0; i < dim; ++i)
914 h(i) += block(orthogonal_vectors[i],
b).local_element(j) *
915 block(vv,
b).local_element(j);
923 template <
class VectorType,
925 !is_dealii_compatible_distributed_vector<VectorType>::value,
926 VectorType> * =
nullptr>
929 const unsigned int dim,
931 & orthogonal_vectors,
937 for (
unsigned int i = 0; i < dim; ++i)
938 vv.add(-h(i), orthogonal_vectors[i]);
940 return std::sqrt(vv.add_and_dot(-h(dim), orthogonal_vectors[dim], vv));
945 template <
class VectorType,
947 is_dealii_compatible_distributed_vector<VectorType>::value,
948 VectorType> * =
nullptr>
951 const unsigned int dim,
953 & orthogonal_vectors,
959 double norm_vv_temp = 0.0;
967 for (; c < block(vv,
b).locally_owned_size() / n_lanes / 4;
968 ++c, j += n_lanes * 4)
972 for (
unsigned int k = 0; k < 4; ++k)
973 temp[k].load(block(vv,
b).begin() + j + k * n_lanes);
975 for (
unsigned int i = 0; i < dim; ++i)
977 const double factor = h(i);
978 for (
unsigned int k = 0; k < 4; ++k)
981 vec.
load(block(orthogonal_vectors[i],
b).
begin() + j +
983 temp[k] -= factor * vec;
987 for (
unsigned int k = 0; k < 4; ++k)
988 temp[k].store(block(vv,
b).
begin() + j + k * n_lanes);
990 norm_vv_temp_vectorized +=
991 (temp[0] * temp[0] + temp[1] * temp[1]) +
992 (temp[2] * temp[2] + temp[3] * temp[3]);
996 for (; c < block(vv,
b).locally_owned_size() / n_lanes;
1000 temp.
load(block(vv,
b).begin() + j);
1002 for (
unsigned int i = 0; i < dim; ++i)
1005 vec.
load(block(orthogonal_vectors[i],
b).begin() + j);
1011 norm_vv_temp_vectorized += temp * temp;
1014 for (
unsigned int v = 0; v < n_lanes; ++v)
1015 norm_vv_temp += norm_vv_temp_vectorized[v];
1017 for (; j < block(vv,
b).locally_owned_size(); ++j)
1019 double temp = block(vv,
b).local_element(j);
1020 for (
unsigned int i = 0; i < dim; ++i)
1021 temp -= h(i) * block(orthogonal_vectors[i],
b).local_element(j);
1022 block(vv,
b).local_element(j) = temp;
1024 norm_vv_temp += temp * temp;
1032 template <
class VectorType,
1034 !is_dealii_compatible_distributed_vector<VectorType>::value,
1035 VectorType> * =
nullptr>
1037 sadd_and_norm(VectorType & v,
1038 const double factor_a,
1039 const VectorType &
b,
1040 const double factor_b)
1042 v.sadd(factor_a, factor_b,
b);
1047 template <
class VectorType,
1049 is_dealii_compatible_distributed_vector<VectorType>::value,
1050 VectorType> * =
nullptr>
1052 sadd_and_norm(VectorType & v,
1053 const double factor_a,
1054 const VectorType &
w,
1055 const double factor_b)
1060 for (
unsigned int j = 0; j < block(v,
b).locally_owned_size(); ++j)
1062 const double temp = block(v,
b).local_element(j) * factor_a +
1063 block(
w,
b).local_element(j) * factor_b;
1065 block(v,
b).local_element(j) = temp;
1067 norm += temp * temp;
1075 template <
class VectorType,
1077 !is_dealii_compatible_distributed_vector<VectorType>::value,
1078 VectorType> * =
nullptr>
1081 const unsigned int dim,
1085 const bool zero_out)
1088 p.equ(h(0), tmp_vectors[0]);
1090 p.add(h(0), tmp_vectors[0]);
1092 for (
unsigned int i = 1; i < dim; ++i)
1093 p.add(h(i), tmp_vectors[i]);
1098 template <
class VectorType,
1100 is_dealii_compatible_distributed_vector<VectorType>::value,
1101 VectorType> * =
nullptr>
1104 const unsigned int dim,
1108 const bool zero_out)
1111 for (
unsigned int j = 0; j < block(p,
b).locally_owned_size(); ++j)
1113 double temp = zero_out ? 0 : block(p,
b).local_element(j);
1114 for (
unsigned int i = 0; i < dim; ++i)
1115 temp += block(tmp_vectors[i],
b).local_element(j) * h(i);
1116 block(p,
b).local_element(j) = temp;
1133 template <
class VectorType>
1135 iterated_gram_schmidt(
1137 OrthogonalizationStrategy orthogonalization_strategy,
1139 & orthogonal_vectors,
1140 const unsigned int dim,
1141 const unsigned int accumulated_iterations,
1144 bool & reorthogonalize,
1145 const boost::signals2::signal<
void(
int)> &reorthogonalize_signal =
1146 boost::signals2::signal<
void(
int)>())
1149 const unsigned int inner_iteration = dim - 1;
1152 double norm_vv_start = 0;
1153 const bool consider_reorthogonalize =
1154 (reorthogonalize ==
false) && (inner_iteration % 5 == 4);
1155 if (consider_reorthogonalize)
1156 norm_vv_start = vv.l2_norm();
1158 for (
unsigned int i = 0; i < dim; ++i)
1161 for (
unsigned int c = 0; c < 2;
1165 double norm_vv = 0.0;
1167 if (orthogonalization_strategy ==
1169 OrthogonalizationStrategy::modified_gram_schmidt)
1171 double htmp = vv * orthogonal_vectors[0];
1173 for (
unsigned int i = 1; i < dim; ++i)
1175 htmp = vv.add_and_dot(-htmp,
1176 orthogonal_vectors[i - 1],
1177 orthogonal_vectors[i]);
1182 vv.add_and_dot(-htmp, orthogonal_vectors[dim - 1], vv));
1184 else if (orthogonalization_strategy ==
1186 OrthogonalizationStrategy::classical_gram_schmidt)
1188 Tvmult_add(dim, vv, orthogonal_vectors, h);
1189 norm_vv = substract_and_norm(dim, orthogonal_vectors, h, vv);
1207 if (consider_reorthogonalize)
1210 10. * norm_vv_start *
1211 std::sqrt(std::numeric_limits<
1212 typename VectorType::value_type>::
epsilon()))
1217 reorthogonalize =
true;
1218 if (!reorthogonalize_signal.empty())
1219 reorthogonalize_signal(accumulated_iterations);
1223 if (reorthogonalize ==
false)
1236 template <
class VectorType>
1240 const unsigned int dim,
1241 const boost::signals2::signal<
void(
const std::vector<std::complex<double>> &)>
1242 &eigenvalues_signal,
1244 & hessenberg_signal,
1245 const boost::signals2::signal<
void(
double)> &cond_signal)
1248 if ((!eigenvalues_signal.empty() || !hessenberg_signal.empty() ||
1249 !cond_signal.empty()) &&
1253 for (
unsigned int i = 0; i < dim; ++i)
1254 for (
unsigned int j = 0; j < dim; ++j)
1255 mat(i, j) = H_orig(i, j);
1256 hessenberg_signal(H_orig);
1258 if (!eigenvalues_signal.empty())
1264 mat_eig.compute_eigenvalues();
1265 std::vector<std::complex<double>>
eigenvalues(dim);
1266 for (
unsigned int i = 0; i < mat_eig.n(); ++i)
1271 internal::SolverGMRESImplementation::complex_less_pred);
1276 if (!cond_signal.empty() && (mat.n() > 1))
1279 double condition_number =
1280 mat.singular_value(0) / mat.singular_value(mat.n() - 1);
1281 cond_signal(condition_number);
1288 template <
class VectorType>
1289 template <
typename MatrixType,
typename PreconditionerType>
1293 const VectorType &
b,
1294 const PreconditionerType &preconditioner)
1300 std::unique_ptr<LogStream::Prefix> prefix;
1302 prefix = std::make_unique<LogStream::Prefix>(
"GMRES");
1306 const unsigned int n_tmp_vectors =
1311 n_tmp_vectors, this->memory);
1316 unsigned int accumulated_iterations = 0;
1318 const bool do_eigenvalues =
1320 (!condition_number_signal.empty() ||
1321 !all_condition_numbers_signal.empty() || !eigenvalues_signal.empty() ||
1322 !all_eigenvalues_signal.empty() || !hessenberg_signal.empty() ||
1323 !all_hessenberg_signal.empty());
1328 H_orig.reinit(n_tmp_vectors, n_tmp_vectors - 1);
1331 H.reinit(n_tmp_vectors, n_tmp_vectors - 1,
true);
1334 gamma.reinit(n_tmp_vectors);
1335 ci.
reinit(n_tmp_vectors - 1);
1336 si.
reinit(n_tmp_vectors - 1);
1337 h.
reinit(n_tmp_vectors - 1);
1339 unsigned int dim = 0;
1342 double last_res = std::numeric_limits<double>::lowest();
1354 VectorType &v = tmp_vectors(0, x);
1355 VectorType &p = tmp_vectors(n_tmp_vectors - 1, x);
1361 std::unique_ptr<::Vector<double>> gamma_;
1362 if (!use_default_residual)
1369 gamma_ = std::make_unique<::Vector<double>>(
gamma.size());
1381 h.
reinit(n_tmp_vectors - 1);
1385 if (left_precondition)
1389 preconditioner.vmult(v, p);
1395 rho = ::internal::SolverGMRESImplementation::sadd_and_norm(v,
1404 if (use_default_residual)
1408 iteration_state = solver_control.
check(accumulated_iterations, rho);
1411 this->iteration_status(accumulated_iterations, rho, x);
1418 deallog <<
"default_res=" << rho << std::endl;
1420 if (left_precondition)
1423 r->sadd(-1., 1.,
b);
1426 preconditioner.vmult(*r, v);
1428 double res = r->l2_norm();
1431 iteration_state = solver_control.
check(accumulated_iterations, rho);
1434 this->iteration_status(accumulated_iterations, res, x);
1447 for (
unsigned int inner_iteration = 0;
1448 ((inner_iteration < n_tmp_vectors - 2) &&
1452 ++accumulated_iterations;
1454 VectorType &vv = tmp_vectors(inner_iteration + 1, x);
1456 if (left_precondition)
1458 A.vmult(p, tmp_vectors[inner_iteration]);
1459 preconditioner.vmult(vv, p);
1463 preconditioner.vmult(p, tmp_vectors[inner_iteration]);
1467 dim = inner_iteration + 1;
1470 internal::SolverGMRESImplementation::iterated_gram_schmidt(
1474 accumulated_iterations,
1478 re_orthogonalize_signal);
1479 h(inner_iteration + 1) = s;
1489 for (
unsigned int i = 0; i < dim + 1; ++i)
1490 H_orig(i, inner_iteration) = h(i);
1496 for (
unsigned int i = 0; i < dim; ++i)
1497 H(i, inner_iteration) = h(i);
1502 if (use_default_residual)
1507 solver_control.
check(accumulated_iterations, rho);
1510 this->iteration_status(accumulated_iterations, rho, x);
1515 deallog <<
"default_res=" << rho << std::endl;
1519 internal::SolverGMRESImplementation::solve_triangular(dim,
1524 if (left_precondition)
1525 for (
unsigned int i = 0; i < dim; ++i)
1526 x_->add(h(i), tmp_vectors[i]);
1530 for (
unsigned int i = 0; i < dim; ++i)
1531 p.add(h(i), tmp_vectors[i]);
1532 preconditioner.vmult(*r, p);
1536 r->sadd(-1., 1.,
b);
1538 if (left_precondition)
1540 const double res = r->l2_norm();
1544 this->iteration_status(accumulated_iterations, res, x);
1548 preconditioner.vmult(*x_, *r);
1549 const double preconditioned_res = x_->l2_norm();
1550 last_res = preconditioned_res;
1554 solver_control.
check(accumulated_iterations, rho);
1557 this->iteration_status(accumulated_iterations,
1566 internal::SolverGMRESImplementation::solve_triangular(dim, H,
gamma, h);
1569 compute_eigs_and_cond(H_orig,
1571 all_eigenvalues_signal,
1572 all_hessenberg_signal,
1573 condition_number_signal);
1575 if (left_precondition)
1576 ::internal::SolverGMRESImplementation::add(
1577 x, dim, h, tmp_vectors,
false);
1580 ::internal::SolverGMRESImplementation::add(
1581 p, dim, h, tmp_vectors,
true);
1582 preconditioner.vmult(v, p);
1591 compute_eigs_and_cond(H_orig,
1595 condition_number_signal);
1597 if (!additional_data.
batched_mode && !krylov_space_signal.empty())
1598 krylov_space_signal(tmp_vectors);
1607 template <
class VectorType>
1608 boost::signals2::connection
1610 const std::function<
void(
double)> &slot,
1611 const bool every_iteration)
1613 if (every_iteration)
1615 return all_condition_numbers_signal.connect(slot);
1619 return condition_number_signal.connect(slot);
1625 template <
class VectorType>
1626 boost::signals2::connection
1628 const std::function<
void(
const std::vector<std::complex<double>> &)> &slot,
1629 const bool every_iteration)
1631 if (every_iteration)
1633 return all_eigenvalues_signal.connect(slot);
1637 return eigenvalues_signal.connect(slot);
1643 template <
class VectorType>
1644 boost::signals2::connection
1647 const bool every_iteration)
1649 if (every_iteration)
1651 return all_hessenberg_signal.connect(slot);
1655 return hessenberg_signal.connect(slot);
1661 template <
class VectorType>
1662 boost::signals2::connection
1664 const std::function<
void(
1667 return krylov_space_signal.connect(slot);
1672 template <
class VectorType>
1673 boost::signals2::connection
1675 const std::function<
void(
int)> &slot)
1677 return re_orthogonalize_signal.connect(slot);
1682 template <
class VectorType>
1695 template <
class VectorType>
1698 const AdditionalData & data)
1700 , additional_data(data)
1705 template <
class VectorType>
1707 const AdditionalData &data)
1709 , additional_data(data)
1714 template <
class VectorType>
1715 template <
typename MatrixType,
typename PreconditionerType>
1719 const VectorType &
b,
1720 const PreconditionerType &preconditioner)
1726 const unsigned int basis_size = additional_data.max_basis_size;
1730 basis_size, this->memory);
1732 basis_size, this->memory);
1736 unsigned int accumulated_iterations = 0;
1739 H.reinit(basis_size + 1, basis_size);
1746 double res = std::numeric_limits<double>::lowest();
1753 aux->sadd(-1., 1.,
b);
1755 double beta = aux->l2_norm();
1757 iteration_state = this->iteration_status(accumulated_iterations, res, x);
1761 H.reinit(basis_size + 1, basis_size);
1764 for (
unsigned int j = 0; j < basis_size; ++j)
1767 v(j, x).equ(1. / a, *aux);
1772 preconditioner.vmult(z(j, x), v[j]);
1773 A.vmult(*aux, z[j]);
1776 H(0, j) = *aux * v[0];
1777 for (
unsigned int i = 1; i <= j; ++i)
1778 H(i, j) = aux->add_and_dot(-H(i - 1, j), v[i - 1], v[i]);
1779 H(j + 1, j) = a =
std::sqrt(aux->add_and_dot(-H(j, j), v[j], *aux));
1785 H1.reinit(j + 1, j);
1786 projected_rhs.
reinit(j + 1);
1788 projected_rhs(0) = beta;
1796 res = house.least_squares(y, projected_rhs);
1798 this->iteration_status(++accumulated_iterations, res, x);
1805 for (
unsigned int j = 0; j < y.
size(); ++j)
virtual State check(const unsigned int step, const double check_value)
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
SolverFGMRES(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
SolverFGMRES(SolverControl &cn, const AdditionalData &data=AdditionalData())
AdditionalData additional_data
boost::signals2::signal< void(const FullMatrix< double > &)> hessenberg_signal
AdditionalData additional_data
boost::signals2::signal< void(double)> condition_number_signal
SolverGMRES(const SolverGMRES< VectorType > &)=delete
boost::signals2::signal< void(const std::vector< std::complex< double >> &)> eigenvalues_signal
boost::signals2::connection connect_condition_number_slot(const std::function< void(double)> &slot, const bool every_iteration=false)
boost::signals2::connection connect_krylov_space_slot(const std::function< void(const internal::SolverGMRESImplementation::TmpVectors< VectorType > &)> &slot)
boost::signals2::signal< void(const internal::SolverGMRESImplementation::TmpVectors< VectorType > &)> krylov_space_signal
boost::signals2::signal< void(const FullMatrix< double > &)> all_hessenberg_signal
static void compute_eigs_and_cond(const FullMatrix< double > &H_orig, const unsigned int dim, const boost::signals2::signal< void(const std::vector< std::complex< double >> &)> &eigenvalues_signal, const boost::signals2::signal< void(const FullMatrix< double > &)> &hessenberg_signal, const boost::signals2::signal< void(double)> &cond_signal)
boost::signals2::connection connect_re_orthogonalization_slot(const std::function< void(int)> &slot)
SolverControl & solver_control
SolverGMRES(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
void givens_rotation(Vector< double > &h, Vector< double > &b, Vector< double > &ci, Vector< double > &si, int col) const
boost::signals2::connection connect_hessenberg_slot(const std::function< void(const FullMatrix< double > &)> &slot, const bool every_iteration=true)
boost::signals2::signal< void(const std::vector< std::complex< double >> &)> all_eigenvalues_signal
SolverGMRES(SolverControl &cn, const AdditionalData &data=AdditionalData())
boost::signals2::connection connect_eigenvalues_slot(const std::function< void(const std::vector< std::complex< double >> &)> &slot, const bool every_iteration=false)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
virtual double criterion()
boost::signals2::signal< void(double)> all_condition_numbers_signal
boost::signals2::signal< void(int)> re_orthogonalize_signal
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
static constexpr std::size_t size()
void store(OtherNumber *ptr) const
void load(const OtherNumber *ptr)
VectorMemory< VectorType > & mem
std::vector< typename VectorMemory< VectorType >::Pointer > data
VectorType & operator()(const unsigned int i, const VectorType &temp)
TmpVectors(const unsigned int max_size, VectorMemory< VectorType > &vmem)
unsigned int size() const
VectorType & operator[](const unsigned int i) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertIsFinite(number)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcTooFewTmpVectors(int arg1)
#define AssertIndexRange(index, range)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Expression fabs(const Expression &x)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim >>> &Du)
std::enable_if_t< IsBlockVector< VectorType >::value, unsigned int > n_blocks(const VectorType &vector)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > epsilon(const Tensor< 2, dim, Number > &Grad_u)
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
VectorType::value_type * begin(VectorType &V)
std::array< NumberType, 3 > givens_rotation(const NumberType &x, const NumberType &y)
T sum(const T &t, const MPI_Comm &mpi_communicator)
long double gamma(const unsigned int n)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
AdditionalData(const unsigned int max_basis_size=30)
unsigned int max_basis_size
bool right_preconditioning
OrthogonalizationStrategy
bool force_re_orthogonalization
OrthogonalizationStrategy orthogonalization_strategy
AdditionalData(const unsigned int max_n_tmp_vectors=30, const bool right_preconditioning=false, const bool use_default_residual=true, const bool force_re_orthogonalization=false, const bool batched_mode=false, const OrthogonalizationStrategy orthogonalization_strategy=OrthogonalizationStrategy::modified_gram_schmidt)
bool use_default_residual
unsigned int max_n_tmp_vectors