26 requires operators::LinearOperator<Op, Vector, Vector>
28 const idx n = A.rows();
29 if (A.cols() != n || v.
size() != n) {
30 throw std::invalid_argument(
"expv: dimension mismatch");
38 std::vector<Vector> V;
42 for (
idx i = 0; i < n; i++) {
45 V.push_back(std::move(v0));
47 Matrix H(m_max + 1, m_max, 0.0);
49 std::vector<real> h_col(m_max + 1, 0.0);
51 for (
int j = 0; j < m_max; j++) {
56 for (
int i = 0; i <= j; i++) {
67 V.push_back(std::move(w));
70 Matrix Hm(m_actual, m_actual, 0.0);
71 for (
int i = 0; i < m_actual; i++) {
72 for (
int j = 0; j < m_actual; j++) {
73 Hm(i, j) = t * H(i, j);
80 for (
int j = 0; j < m_actual; j++) {
88 const SparseMatrix& A,
constexpr idx size() const noexcept
Compressed Sparse Row (CSR) matrix and operations.
Dense row-major matrix templated over scalar type T.
Matrix dense_expm_pade6(const Matrix &A)
real mgs_orthogonalize(const std::vector< Vector > &basis, Vector &v, std::vector< real > &h, idx k)
Modified Gram-Schmidt against basis[0..k-1].
real beta(real a, real b)
B(a, b) – beta function.
void scale(Vector &v, real alpha, Backend b=default_backend)
Compute .
BasicMatrix< real > Matrix
Double-precision dense matrix with full backend dispatch (CPU + GPU).
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
real norm(const Vector &x, Backend b=default_backend)
Compute .
Vector expv(real t, const Op &A, const Vector &v, int m_max=30, real tol=1e-8)
Compute for any adapter.
void axpy(real alpha, const Vector &x, Vector &y, Backend b=default_backend)
Compute .
Umbrella include for operator concepts and adapters.
Subspace construction and orthogonalization kernels.
Dense vector storage and operations.