10 if (
a.size() != n - 1 || c.
size() != n - 1 ||
d.size() != n || x.
size() != n)
11 throw std::invalid_argument(
"Dimension mismatch in Thomas solver");
14#ifdef NUMERICS_HAS_CUDA
31 for (
idx i = 1;
i < n; ++
i) {
38 for (
idx i = n - 1;
i > 0; --
i)
constexpr idx size() const noexcept
void thomas_batched(const real *a, const real *b, const real *c, const real *d, real *x, idx n, idx batch_size)
Batched Thomas algorithm for tridiagonal systems.
Backend
Selects which backend handles a linalg operation.
@ gpu
CUDA – custom kernels or cuBLAS.
constexpr T ipow(T x) noexcept
Compute x^N at compile time via repeated squaring.
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
void thomas(const Vector &a, const Vector &b, const Vector &c, const Vector &d, Vector &x, Backend backend=Backend::seq)
Thomas algorithm (LU for tridiagonal systems), O(n).
SolverResult cg(const Matrix &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
Conjugate gradient solver for Ax = b.
Thomas algorithm – direct O(n) tridiagonal solver.