6#include <batmat/linalg/copy.hpp>
7#include <batmat/linalg/gemm.hpp>
8#include <batmat/linalg/simdify.hpp>
9#include <batmat/linalg/syomv.hpp>
10#include <batmat/linalg/trsm.hpp>
12namespace CYQLONE_NS(cyqlone) {
14using namespace linalg;
15using namespace batmat::linalg;
22template <index_t VL,
class T, StorageOrder DefaultOrder,
class Ctx>
34template <index_t VL,
class T, StorageOrder DefaultOrder,
class Ctx>
53template <index_t VL,
class T, StorageOrder DefaultOrder,
class Ctx>
58 auto M =
pcr_L.batch(0), K =
cr_Y.batch(0);
67 const auto ε2 =
params.pcg_tolerance *
params.pcg_tolerance;
68 for (index_t it = 0; it <
params.pcg_max_iter; ++it) {
75 if (
params.pcg_print_resid)
76 std::println(
"{:>4}) pcg resid = {:15.6e}", it, std::sqrt(r2));
The main header for the Cyqlone and Tricyqle linear solvers.
@ StairPCG
Preconditioned Conjugate Gradient with staircase preconditioner (iterative).
void syomv(Structured< VA, SA > A, VB &&B, VD &&D)
void trsm(Structured< VA, SA > A, VB &&B, VD &&D, with_rotate_B_t< RotB >={})
void axpy(Vy &&y, const std::array< simdified_value_t< Vy >, sizeof...(Vx)> &alphas, Vx &&...x)
Add scaled vector y = ∑ᵢ αᵢxᵢ + βy.
void trmm(Structured< VA, SA > A, Structured< VB, SB > B, Structured< VD, SD > D, Opts... opts)
void axpby(Ta alpha, Vx &&x, Tb beta, Vy &&y, Vz &&z)
Add scaled vector z = αx + βy.
void copy(VA &&A, VB &&B, Opts... opts)
simdified_value_t< Vx > dot(Vx &&x, Vy &&y)
Compute the dot product of two vectors.
void syomv_neg(Structured< VA, SA > A, VB &&B, VD &&D)
void fill(simdified_value_t< VB > a, VB &&B)
constexpr auto triu(M &&m)
constexpr auto tril(M &&m)
#define GUANAQO_TRACE(name, instance,...)
value_type mul_precond(batch_view<> r, mut_batch_view<> z, mut_batch_view<> w, batch_view< default_order > L, batch_view< default_order > K) const
Multiply a vector by the preconditioner for the final block tridiagonal system of size v.
batmat::matrix::View< value_type, index_t, vl_t, vl_t, layer_stride, O > mut_batch_view
Non-owning mutable view type for a single batch of v matrices.
matrix< default_order > pcr_L
Diagonal blocks of the PCR Cholesky factorizations.
matrix< default_order > cr_Y
Subdiagonal blocks Y of the Cholesky factor of the Schur complement (used during CR).
batmat::matrix::View< const value_type, index_t, vl_t, vl_t, layer_stride, O > batch_view
Non-owning immutable view type for a single batch of v matrices.
void solve_pcg(mut_batch_view<> λ, mut_batch_view<> work_pcg) const
Solve a linear system with the final block tridiagonal system of size v using the preconditioned conj...
matrix< column_major > work_pcg
Temporary workspace for CG vectors.
Params params
Solver parameters for Tricyqle-specific settings.
const index_t p
Number of processors/threads.
value_type mul_Mv(batch_view<> p, mut_batch_view<> Mp, batch_view< default_order > L, batch_view< default_order > K) const
Multiply a vector by the final block tridiagonal matrix of size v.