numerics 0.1.0
Loading...
Searching...
No Matches
dense.hpp
Go to the documentation of this file.
1/// @file operator/dense.hpp
2/// @brief Dense Matrix adapter for the operator protocol.
3#pragma once
4
5#include "core/matrix.hpp"
6#include "core/policy.hpp"
8
9namespace num::operators {
10
11/// @brief Adapt a dense Matrix to the operator protocol.
12struct DenseOp final {
13 explicit DenseOp(const Matrix& A, Backend b = default_backend)
14 : A_(A),
15 b_(b) {}
16
17 void apply(const Vector& x, Vector& y) const;
18 [[nodiscard]] idx rows() const noexcept { return A_.rows(); }
19 [[nodiscard]] idx cols() const noexcept { return A_.cols(); }
20
21 private:
22 const Matrix& A_;
23 Backend b_;
24};
25
26static_assert(LinearOperator<DenseOp>);
27
28} // namespace num::operators
constexpr idx rows() const noexcept
Definition matrix.hpp:87
constexpr idx cols() const noexcept
Definition matrix.hpp:88
Backend enum and default backend selection.
Dense row-major matrix templated over scalar type T.
Backend
Definition policy.hpp:7
std::size_t idx
Definition types.hpp:11
constexpr Backend default_backend
Definition policy.hpp:53
Concepts for operator-oriented numerical algorithms.
Adapt a dense Matrix to the operator protocol.
Definition dense.hpp:12
void apply(const Vector &x, Vector &y) const
Definition operator.cpp:8
idx rows() const noexcept
Definition dense.hpp:18
DenseOp(const Matrix &A, Backend b=default_backend)
Definition dense.hpp:13
idx cols() const noexcept
Definition dense.hpp:19