16#ifndef dealii_solver_gmres_h
17#define dealii_solver_gmres_h
50 template <
typename,
typename>
66 namespace SolverGMRESImplementation
76 template <
typename VectorType>
124 std::vector<typename VectorMemory<VectorType>::Pointer>
data;
193template <
class VectorType = Vector<
double>>
284 template <
typename MatrixType,
typename PreconditionerType>
288 const VectorType & b,
289 const PreconditionerType &preconditioner);
297 boost::signals2::connection
299 const bool every_iteration =
false);
307 boost::signals2::connection
309 const std::function<
void(
const std::vector<std::complex<double>> &)> &slot,
310 const bool every_iteration =
false);
319 boost::signals2::connection
322 const bool every_iteration =
true);
330 boost::signals2::connection
341 boost::signals2::connection
347 <<
"The number of temporary vectors you gave (" << arg1
348 <<
") is too small. It should be at least 10 for "
349 <<
"any results, and much more for reasonable ones.");
373 boost::signals2::signal<void(
const std::vector<std::complex<double>> &)>
380 boost::signals2::signal<void(
const std::vector<std::complex<double>> &)>
400 boost::signals2::signal<void(
443 const unsigned int dim,
444 const boost::signals2::signal<
448 const boost::signals2::signal<
void(
double)> &cond_signal);
498template <
class VectorType = Vector<
double>>
547 template <
typename MatrixType,
typename PreconditionerType>
551 const VectorType & b,
552 const PreconditionerType &preconditioner);
578 namespace SolverGMRESImplementation
580 template <
class VectorType>
589 template <
class VectorType>
601 template <
class VectorType>
604 const VectorType & temp)
607 if (data[i] ==
nullptr)
610 data[i]->reinit(temp,
true);
617 template <
class VectorType>
621 return (data.size() > 0 ? data.size() - 1 : 0);
628 complex_less_pred(
const std::complex<double> &x,
629 const std::complex<double> &y)
631 return x.real() < y.real() ||
632 (x.real() == y.real() && x.imag() < y.imag());
638 solve_triangular(
const unsigned int dim,
643 for (
int i = dim - 1; i >= 0; --i)
646 for (
unsigned int j = i + 1; j < dim; ++j)
647 s -= solution(j) * H(i, j);
648 solution(i) = s / H(i, i);
657template <
class VectorType>
659 const unsigned int max_n_tmp_vectors,
660 const bool right_preconditioning,
661 const bool use_default_residual,
662 const bool force_re_orthogonalization,
663 const bool batched_mode,
665 : max_n_tmp_vectors(max_n_tmp_vectors)
666 , right_preconditioning(right_preconditioning)
667 , use_default_residual(use_default_residual)
668 , force_re_orthogonalization(force_re_orthogonalization)
669 , batched_mode(batched_mode)
670 , orthogonalization_strategy(orthogonalization_strategy)
672 Assert(3 <= max_n_tmp_vectors,
673 ExcMessage(
"SolverGMRES needs at least three "
674 "temporary vectors."));
679template <
class VectorType>
682 const AdditionalData & data)
684 , additional_data(data)
690template <
class VectorType>
692 const AdditionalData &data)
694 , additional_data(data)
700template <
class VectorType>
708 for (
int i = 0; i < col; ++i)
710 const double s = si(i);
711 const double c = ci(i);
712 const double dummy = h(i);
713 h(i) = c * dummy + s * h(i + 1);
714 h(i + 1) = -s * dummy + c * h(i + 1);
717 const double r = 1. /
std::sqrt(h(col) * h(col) + h(col + 1) * h(col + 1));
718 si(col) = h(col + 1) * r;
719 ci(col) = h(col) * r;
720 h(col) = ci(col) * h(col) + si(col) * h(col + 1);
721 b(col + 1) = -si(col) *
b(col);
729 namespace SolverGMRESImplementation
731 template <
typename VectorType,
typename Enable =
void>
732 struct is_dealii_compatible_distributed_vector;
734 template <
typename VectorType>
735 struct is_dealii_compatible_distributed_vector<
737 typename
std::enable_if<!internal::is_block_vector<VectorType>>::type>
739 static constexpr bool value = std::is_same<
747 template <
typename VectorType>
748 struct is_dealii_compatible_distributed_vector<
750 typename
std::enable_if<internal::is_block_vector<VectorType>>::type>
752 static constexpr bool value = std::is_same<
753 typename VectorType::BlockType,
760 template <
typename VectorType,
761 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
771 template <
typename VectorType,
772 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
777 return vector.n_blocks();
782 template <
typename VectorType,
783 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
786 block(VectorType &vector,
const unsigned int b)
795 template <
typename VectorType,
796 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType>
799 block(
const VectorType &vector,
const unsigned int b)
808 template <
typename VectorType,
809 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
811 typename VectorType::BlockType &
812 block(VectorType &vector,
const unsigned int b)
814 return vector.block(b);
819 template <
typename VectorType,
820 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
822 const typename VectorType::BlockType &
823 block(
const VectorType &vector,
const unsigned int b)
825 return vector.block(b);
830 template <
class VectorType,
832 !is_dealii_compatible_distributed_vector<VectorType>::value,
833 VectorType> * =
nullptr>
835 Tvmult_add(
const unsigned int dim,
836 const VectorType & vv,
838 & orthogonal_vectors,
841 for (
unsigned int i = 0; i < dim; ++i)
842 h[i] += vv * orthogonal_vectors[i];
847 template <
class VectorType,
849 is_dealii_compatible_distributed_vector<VectorType>::value,
850 VectorType> * =
nullptr>
852 Tvmult_add(
const unsigned int dim,
853 const VectorType & vv,
855 & orthogonal_vectors,
858 for (
unsigned int b = 0;
b <
n_blocks(vv); ++
b)
865 static constexpr unsigned int n_lanes =
869 for (
unsigned int d = 0;
d < dim; ++
d)
874 for (; c < block(vv, b).locally_owned_size() / n_lanes / 4;
875 ++c, j += n_lanes * 4)
876 for (
unsigned int i = 0; i < dim; ++i)
879 for (
unsigned int k = 0; k < 4; ++k)
880 vvec[k].load(block(vv, b).begin() + j + k * n_lanes);
882 for (
unsigned int k = 0; k < 4; ++k)
885 temp.
load(block(orthogonal_vectors[i], b).begin() + j +
887 hs[i] += temp * vvec[k];
892 for (; c < block(vv, b).locally_owned_size() / n_lanes;
894 for (
unsigned int i = 0; i < dim; ++i)
897 vvec.
load(block(vv, b).begin() + j);
898 temp.
load(block(orthogonal_vectors[i], b).begin() + j);
899 hs[i] += temp * vvec;
902 for (
unsigned int i = 0; i < dim; ++i)
903 for (
unsigned int v = 0; v < n_lanes; ++v)
909 for (; j < block(vv, b).locally_owned_size(); ++j)
910 for (
unsigned int i = 0; i < dim; ++i)
911 h(i) += block(orthogonal_vectors[i], b).local_element(j) *
912 block(vv, b).local_element(j);
920 template <
class VectorType,
922 !is_dealii_compatible_distributed_vector<VectorType>::value,
923 VectorType> * =
nullptr>
926 const unsigned int dim,
928 & orthogonal_vectors,
934 for (
unsigned int i = 0; i < dim; ++i)
935 vv.add(-h(i), orthogonal_vectors[i]);
937 return std::sqrt(vv.add_and_dot(-h(dim), orthogonal_vectors[dim], vv));
942 template <
class VectorType,
944 is_dealii_compatible_distributed_vector<VectorType>::value,
945 VectorType> * =
nullptr>
948 const unsigned int dim,
950 & orthogonal_vectors,
956 double norm_vv_temp = 0.0;
958 for (
unsigned int b = 0;
b <
n_blocks(vv); ++
b)
964 for (; c < block(vv, b).locally_owned_size() / n_lanes / 4;
965 ++c, j += n_lanes * 4)
969 for (
unsigned int k = 0; k < 4; ++k)
970 temp[k].load(block(vv, b).begin() + j + k * n_lanes);
972 for (
unsigned int i = 0; i < dim; ++i)
974 const double factor = h(i);
975 for (
unsigned int k = 0; k < 4; ++k)
978 vec.
load(block(orthogonal_vectors[i], b).
begin() + j +
980 temp[k] -= factor * vec;
984 for (
unsigned int k = 0; k < 4; ++k)
985 temp[k].store(block(vv, b).
begin() + j + k * n_lanes);
987 norm_vv_temp_vectorized +=
988 (temp[0] * temp[0] + temp[1] * temp[1]) +
989 (temp[2] * temp[2] + temp[3] * temp[3]);
993 for (; c < block(vv, b).locally_owned_size() / n_lanes;
997 temp.
load(block(vv, b).begin() + j);
999 for (
unsigned int i = 0; i < dim; ++i)
1002 vec.
load(block(orthogonal_vectors[i], b).begin() + j);
1008 norm_vv_temp_vectorized += temp * temp;
1011 for (
unsigned int v = 0; v < n_lanes; ++v)
1012 norm_vv_temp += norm_vv_temp_vectorized[v];
1014 for (; j < block(vv, b).locally_owned_size(); ++j)
1016 double temp = block(vv, b).local_element(j);
1017 for (
unsigned int i = 0; i < dim; ++i)
1018 temp -= h(i) * block(orthogonal_vectors[i], b).local_element(j);
1019 block(vv, b).local_element(j) = temp;
1021 norm_vv_temp += temp * temp;
1030 template <
class VectorType,
1032 !is_dealii_compatible_distributed_vector<VectorType>::value,
1033 VectorType> * =
nullptr>
1035 sadd_and_norm(VectorType & v,
1036 const double factor_a,
1037 const VectorType &b,
1038 const double factor_b)
1040 v.sadd(factor_a, factor_b, b);
1045 template <
class VectorType,
1047 is_dealii_compatible_distributed_vector<VectorType>::value,
1048 VectorType> * =
nullptr>
1050 sadd_and_norm(VectorType & v,
1051 const double factor_a,
1052 const VectorType &w,
1053 const double factor_b)
1057 for (
unsigned int b = 0;
b <
n_blocks(v); ++
b)
1058 for (
unsigned int j = 0; j < block(v, b).locally_owned_size(); ++j)
1060 const double temp = block(v, b).local_element(j) * factor_a +
1061 block(w, b).local_element(j) * factor_b;
1063 block(v, b).local_element(j) = temp;
1065 norm += temp * temp;
1074 template <
class VectorType,
1076 !is_dealii_compatible_distributed_vector<VectorType>::value,
1077 VectorType> * =
nullptr>
1080 const unsigned int dim,
1084 const bool zero_out)
1087 p.equ(h(0), tmp_vectors[0]);
1089 p.add(h(0), tmp_vectors[0]);
1091 for (
unsigned int i = 1; i < dim; ++i)
1092 p.add(h(i), tmp_vectors[i]);
1097 template <
class VectorType,
1099 is_dealii_compatible_distributed_vector<VectorType>::value,
1100 VectorType> * =
nullptr>
1103 const unsigned int dim,
1107 const bool zero_out)
1109 for (
unsigned int b = 0;
b <
n_blocks(p); ++
b)
1110 for (
unsigned int j = 0; j < block(p, b).locally_owned_size(); ++j)
1112 double temp = zero_out ? 0 : block(p, b).local_element(j);
1113 for (
unsigned int i = 0; i < dim; ++i)
1114 temp += block(tmp_vectors[i], b).local_element(j) * h(i);
1115 block(p, b).local_element(j) = temp;
1132 template <
class VectorType>
1134 iterated_gram_schmidt(
1137 & orthogonal_vectors,
1138 const unsigned int dim,
1139 const unsigned int accumulated_iterations,
1142 bool & reorthogonalize,
1143 const boost::signals2::signal<
void(
int)> &reorthogonalize_signal =
1144 boost::signals2::signal<
void(
int)>())
1147 const unsigned int inner_iteration = dim - 1;
1150 double norm_vv_start = 0;
1151 const bool consider_reorthogonalize =
1152 (reorthogonalize ==
false) && (inner_iteration % 5 == 4);
1153 if (consider_reorthogonalize)
1154 norm_vv_start = vv.l2_norm();
1156 for (
unsigned int i = 0; i < dim; ++i)
1159 for (
unsigned int c = 0; c < 2;
1163 double norm_vv = 0.0;
1165 if (orthogonalization_strategy ==
1168 double htmp = vv * orthogonal_vectors[0];
1170 for (
unsigned int i = 1; i < dim; ++i)
1173 orthogonal_vectors[i - 1],
1174 orthogonal_vectors[i]);
1179 vv.add_and_dot(-htmp, orthogonal_vectors[dim - 1], vv));
1181 else if (orthogonalization_strategy ==
1185 Tvmult_add(dim, vv, orthogonal_vectors, h);
1186 norm_vv = subtract_and_norm(dim, orthogonal_vectors, h, vv);
1204 if (consider_reorthogonalize)
1207 10. * norm_vv_start *
1209 typename VectorType::value_type>::epsilon()))
1214 reorthogonalize =
true;
1215 if (!reorthogonalize_signal.empty())
1216 reorthogonalize_signal(accumulated_iterations);
1220 if (reorthogonalize ==
false)
1233template <
class VectorType>
1237 const unsigned int dim,
1238 const boost::signals2::signal<
void(
const std::vector<std::complex<double>> &)>
1239 &eigenvalues_signal,
1241 & hessenberg_signal,
1242 const boost::signals2::signal<
void(
double)> &cond_signal)
1245 if ((!eigenvalues_signal.empty() || !hessenberg_signal.empty() ||
1246 !cond_signal.empty()) &&
1250 for (
unsigned int i = 0; i < dim; ++i)
1251 for (
unsigned int j = 0; j < dim; ++j)
1252 mat(i, j) = H_orig(i, j);
1253 hessenberg_signal(H_orig);
1255 if (!eigenvalues_signal.empty())
1261 mat_eig.compute_eigenvalues();
1262 std::vector<std::complex<double>>
eigenvalues(dim);
1263 for (
unsigned int i = 0; i < mat_eig.n(); ++i)
1268 internal::SolverGMRESImplementation::complex_less_pred);
1273 if (!cond_signal.empty() && (mat.n() > 1))
1276 double condition_number =
1277 mat.singular_value(0) / mat.singular_value(mat.n() - 1);
1278 cond_signal(condition_number);
1285template <
class VectorType>
1286template <
typename MatrixType,
typename PreconditionerType>
1290 const VectorType & b,
1291 const PreconditionerType &preconditioner)
1297 std::unique_ptr<LogStream::Prefix> prefix;
1299 prefix = std::make_unique<LogStream::Prefix>(
"GMRES");
1303 const unsigned int n_tmp_vectors =
1308 n_tmp_vectors, this->memory);
1313 unsigned int accumulated_iterations = 0;
1315 const bool do_eigenvalues =
1317 (!condition_number_signal.empty() ||
1318 !all_condition_numbers_signal.empty() || !eigenvalues_signal.empty() ||
1319 !all_eigenvalues_signal.empty() || !hessenberg_signal.empty() ||
1320 !all_hessenberg_signal.empty());
1325 H_orig.reinit(n_tmp_vectors, n_tmp_vectors - 1);
1328 H.reinit(n_tmp_vectors, n_tmp_vectors - 1,
true);
1331 gamma.reinit(n_tmp_vectors);
1332 ci.
reinit(n_tmp_vectors - 1);
1333 si.
reinit(n_tmp_vectors - 1);
1334 h.
reinit(n_tmp_vectors - 1);
1336 unsigned int dim = 0;
1339 double last_res = std::numeric_limits<double>::lowest();
1351 VectorType &v = tmp_vectors(0, x);
1352 VectorType &p = tmp_vectors(n_tmp_vectors - 1, x);
1358 std::unique_ptr<::Vector<double>> gamma_;
1359 if (!use_default_residual)
1366 gamma_ = std::make_unique<::Vector<double>>(
gamma.size());
1378 h.
reinit(n_tmp_vectors - 1);
1382 if (left_precondition)
1386 preconditioner.vmult(v, p);
1392 rho = ::internal::SolverGMRESImplementation::sadd_and_norm(v,
1401 if (use_default_residual)
1405 iteration_state = solver_control.
check(accumulated_iterations, rho);
1408 this->iteration_status(accumulated_iterations, rho, x);
1415 deallog <<
"default_res=" << rho << std::endl;
1417 if (left_precondition)
1420 r->sadd(-1., 1., b);
1423 preconditioner.vmult(*r, v);
1425 double res = r->l2_norm();
1428 iteration_state = solver_control.
check(accumulated_iterations, rho);
1431 this->iteration_status(accumulated_iterations, res, x);
1444 for (
unsigned int inner_iteration = 0;
1445 ((inner_iteration < n_tmp_vectors - 2) &&
1449 ++accumulated_iterations;
1451 VectorType &vv = tmp_vectors(inner_iteration + 1, x);
1453 if (left_precondition)
1455 A.vmult(p, tmp_vectors[inner_iteration]);
1456 preconditioner.vmult(vv, p);
1460 preconditioner.vmult(p, tmp_vectors[inner_iteration]);
1464 dim = inner_iteration + 1;
1467 internal::SolverGMRESImplementation::iterated_gram_schmidt(
1471 accumulated_iterations,
1475 re_orthogonalize_signal);
1476 h(inner_iteration + 1) = s;
1486 for (
unsigned int i = 0; i < dim + 1; ++i)
1487 H_orig(i, inner_iteration) = h(i);
1493 for (
unsigned int i = 0; i < dim; ++i)
1494 H(i, inner_iteration) = h(i);
1497 rho = std::fabs(
gamma(dim));
1499 if (use_default_residual)
1504 solver_control.
check(accumulated_iterations, rho);
1507 this->iteration_status(accumulated_iterations, rho, x);
1512 deallog <<
"default_res=" << rho << std::endl;
1516 internal::SolverGMRESImplementation::solve_triangular(dim,
1521 if (left_precondition)
1522 for (
unsigned int i = 0; i < dim; ++i)
1523 x_->add(h(i), tmp_vectors[i]);
1527 for (
unsigned int i = 0; i < dim; ++i)
1528 p.add(h(i), tmp_vectors[i]);
1529 preconditioner.vmult(*r, p);
1533 r->sadd(-1., 1., b);
1535 if (left_precondition)
1537 const double res = r->l2_norm();
1541 this->iteration_status(accumulated_iterations, res, x);
1545 preconditioner.vmult(*x_, *r);
1546 const double preconditioned_res = x_->l2_norm();
1547 last_res = preconditioned_res;
1551 solver_control.
check(accumulated_iterations, rho);
1554 this->iteration_status(accumulated_iterations,
1563 internal::SolverGMRESImplementation::solve_triangular(dim, H, gamma, h);
1566 compute_eigs_and_cond(H_orig,
1568 all_eigenvalues_signal,
1569 all_hessenberg_signal,
1570 condition_number_signal);
1572 if (left_precondition)
1573 ::internal::SolverGMRESImplementation::add(
1574 x, dim, h, tmp_vectors,
false);
1577 ::internal::SolverGMRESImplementation::add(
1578 p, dim, h, tmp_vectors,
true);
1579 preconditioner.vmult(v, p);
1588 compute_eigs_and_cond(H_orig,
1592 condition_number_signal);
1594 if (!additional_data.
batched_mode && !krylov_space_signal.empty())
1595 krylov_space_signal(tmp_vectors);
1604template <
class VectorType>
1605boost::signals2::connection
1607 const std::function<
void(
double)> &slot,
1608 const bool every_iteration)
1610 if (every_iteration)
1612 return all_condition_numbers_signal.connect(slot);
1616 return condition_number_signal.connect(slot);
1622template <
class VectorType>
1623boost::signals2::connection
1625 const std::function<
void(
const std::vector<std::complex<double>> &)> &slot,
1626 const bool every_iteration)
1628 if (every_iteration)
1630 return all_eigenvalues_signal.connect(slot);
1634 return eigenvalues_signal.connect(slot);
1640template <
class VectorType>
1641boost::signals2::connection
1644 const bool every_iteration)
1646 if (every_iteration)
1648 return all_hessenberg_signal.connect(slot);
1652 return hessenberg_signal.connect(slot);
1658template <
class VectorType>
1659boost::signals2::connection
1661 const std::function<
void(
1664 return krylov_space_signal.connect(slot);
1669template <
class VectorType>
1670boost::signals2::connection
1672 const std::function<
void(
int)> &slot)
1674 return re_orthogonalize_signal.connect(slot);
1679template <
class VectorType>
1692template <
class VectorType>
1695 const AdditionalData & data)
1697 , additional_data(data)
1702template <
class VectorType>
1704 const AdditionalData &data)
1706 , additional_data(data)
1711template <
class VectorType>
1712template <
typename MatrixType,
typename PreconditionerType>
1716 const VectorType & b,
1717 const PreconditionerType &preconditioner)
1723 const unsigned int basis_size = additional_data.max_basis_size;
1727 basis_size, this->memory);
1729 basis_size, this->memory);
1733 unsigned int accumulated_iterations = 0;
1736 H.reinit(basis_size + 1, basis_size);
1745 double res = std::numeric_limits<double>::lowest();
1752 aux->sadd(-1., 1., b);
1754 double beta = aux->l2_norm();
1756 iteration_state = this->iteration_status(accumulated_iterations, res, x);
1760 H.reinit(basis_size + 1, basis_size);
1763 for (
unsigned int j = 0; j < basis_size; ++j)
1766 v(j, x).equ(1. / a, *aux);
1771 preconditioner.vmult(z(j, x), v[j]);
1772 A.vmult(*aux, z[j]);
1775 bool re_orthogonalize =
false;
1777 internal::SolverGMRESImplementation::iterated_gram_schmidt<
1785 for (
unsigned int i = 0; i <= j; ++i)
1787 H(j + 1, j) = a = s;
1793 H1.reinit(j + 1, j);
1794 projected_rhs.
reinit(j + 1);
1796 projected_rhs(0) = beta;
1804 res = house.least_squares(y, projected_rhs);
1806 this->iteration_status(++accumulated_iterations, res, x);
1813 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
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
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)
SolverGMRES(SolverControl &cn, const AdditionalData &data=AdditionalData())
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::connection connect_eigenvalues_slot(const std::function< void(const std::vector< std::complex< double > > &)> &slot, const bool every_iteration=false)
boost::signals2::signal< void(int)> re_orthogonalize_signal
Number add_and_dot(const Number a, const Vector< Number > &V, const Vector< Number > &W)
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
TmpVectors(const unsigned int max_size, VectorMemory< VectorType > &vmem)
unsigned int size() const
VectorType & operator[](const unsigned int i) const
VectorType & operator()(const unsigned int i, const VectorType &temp)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcTooFewTmpVectors(int arg1)
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertIsFinite(number)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
OrthogonalizationStrategy
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 > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
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 > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
unsigned int max_basis_size
AdditionalData(const unsigned int max_basis_size=30, const LinearAlgebra::OrthogonalizationStrategy orthogonalization_strategy=LinearAlgebra::OrthogonalizationStrategy::modified_gram_schmidt)
LinearAlgebra::OrthogonalizationStrategy orthogonalization_strategy
bool right_preconditioning
bool force_re_orthogonalization
LinearAlgebra::OrthogonalizationStrategy orthogonalization_strategy
bool use_default_residual
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 LinearAlgebra::OrthogonalizationStrategy orthogonalization_strategy=LinearAlgebra::OrthogonalizationStrategy::modified_gram_schmidt)
unsigned int max_n_tmp_vectors
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)