numerics 0.1.0
Loading...
Searching...
No Matches
operator.cpp
Go to the documentation of this file.
1#include "operator/dense.hpp"
2
3#include <stdexcept>
4
5namespace num::operators {
6
7void DenseOp::apply(const Vector& x, Vector& y) const {
8 if (x.size() != A_.cols()) {
9 throw std::invalid_argument("DenseOp::apply: input dimension mismatch");
10 }
11 if (y.size() != A_.rows()) {
12 y = Vector(A_.rows());
13 }
14 matvec(A_, x, y, b_);
15}
16
17} // namespace num::operators
constexpr idx rows() const noexcept
Definition matrix.hpp:87
constexpr idx cols() const noexcept
Definition matrix.hpp:88
constexpr idx size() const noexcept
Definition vector.hpp:83
void matvec(const Matrix &A, const Vector &x, Vector &y, Backend b=default_backend)
y = A * x
Definition matrix.cpp:45
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
Definition vector.hpp:129
Dense Matrix adapter for the operator protocol.
void apply(const Vector &x, Vector &y) const
Definition operator.cpp:7