15#ifndef dealii_solver_bicgstab_h
16#define dealii_solver_bicgstab_h
78template <
typename VectorType = Vector<
double>>
103 const bool exact_residual =
true,
104 const double breakdown =
105 std::numeric_limits<typename VectorType::value_type>::min())
106 : exact_residual(exact_residual)
107 , breakdown(breakdown)
141 template <
typename MatrixType,
typename PreconditionerType>
148 const PreconditionerType &preconditioner);
167 print_vectors(
const unsigned int step,
191 const unsigned int last_step,
192 const double last_residual);
199 template <
typename MatrixType,
typename PreconditionerType>
204 const PreconditionerType &preconditioner,
205 const unsigned int step);
215template <
typename VectorType>
218 const bool breakdown,
220 const unsigned int last_step,
221 const double last_residual)
222 : breakdown(breakdown)
224 , last_step(last_step)
225 , last_residual(last_residual)
230template <
typename VectorType>
234 const AdditionalData &
data)
236 , additional_data(
data)
241template <
typename VectorType>
244 const AdditionalData &
data)
246 , additional_data(
data)
251template <
typename VectorType>
253template <
typename MatrixType>
260 return std::sqrt(t.add_and_dot(-1.0, b, t));
265template <
typename VectorType>
270 const VectorType &)
const
275template <
typename VectorType>
277template <
typename MatrixType,
typename PreconditionerType>
282 const PreconditionerType &preconditioner,
283 const unsigned int last_step)
304 rbar.reinit(
x,
true);
311 using value_type =
typename VectorType::value_type;
318 unsigned int step = last_step;
322 return IterationResult(
false, state, step,
res);
336 if (std::fabs(
rhobar) < additional_data.breakdown)
338 return IterationResult(
true, state, step,
res);
343 if (step == last_step + 1)
350 p.add(-
beta * omega, v);
353 preconditioner.vmult(
y, p);
356 if (std::fabs(
rbar_dot_v) < additional_data.breakdown)
358 return IterationResult(
true, state, step,
res);
374 print_vectors(step,
x,
r,
y);
378 preconditioner.vmult(z,
r);
382 if (
t_squared < additional_data.breakdown)
384 return IterationResult(
true, state, step,
res);
389 if (additional_data.exact_residual)
392 res = criterion(A,
x, b, t);
397 state = this->iteration_status(step,
res,
x);
398 print_vectors(step,
x,
r,
y);
402 return IterationResult(
false, state, step,
res);
407template <
typename VectorType>
409template <
typename MatrixType,
typename PreconditionerType>
416 const PreconditionerType &preconditioner)
423 state = iterate(A,
x, b, preconditioner, state.last_step);
430 state.last_residual));
double criterion(const MatrixType &A, const VectorType &x, const VectorType &b, VectorType &t)
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
virtual ~SolverBicgstab() override=default
SolverBicgstab(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
SolverBicgstab(SolverControl &cn, const AdditionalData &data=AdditionalData())
IterationResult iterate(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner, const unsigned int step)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
@ failure
Stop iteration, goal not reached.
std::conditional_t< rank_==1, Number, Tensor< rank_ - 1, dim, Number > > value_type
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define AssertThrow(cond, exc)
std::vector< index_type > data
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
AdditionalData(const bool exact_residual=true, const double breakdown=std::numeric_limits< typename VectorType::value_type >::min())
SolverControl::State state
IterationResult(const bool breakdown, const SolverControl::State state, const unsigned int last_step, const double last_residual)