11#include "backends/seq/impl.hpp"
12#include "backends/lapack/impl.hpp"
24 if (a.
size() != n - 1 || c.
size() != n - 1 || d.
size() != n
26 throw std::invalid_argument(
"Dimension mismatch in Thomas solver");
33#ifdef NUMERICS_HAS_CUDA
constexpr idx size() const noexcept
void thomas(const Vector &a, const Vector &b, const Vector &c, const Vector &d, Vector &x)
void thomas(const Vector &a, const Vector &b, const Vector &c, const Vector &d, Vector &x)
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.
@ lapack
LAPACKE – industry-standard factorizations, SVD, eigen.
void thomas(const Vector &a, const Vector &b, const Vector &c, const Vector &d, Vector &x, Backend backend=lapack_backend)
Thomas algorithm (LU for tridiagonal systems), O(n).
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
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.