akreon-linalg
Fixed-size linear algebra and numerical methods in C++26.
Loading...
Searching...
No Matches
scalar_concepts.hpp
Go to the documentation of this file.
1/*
2 * Copyright © 2025-2026 Akreon LLC
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#pragma once
7
8#include <concepts>
9
10#include "scalar_traits.hpp"
11
12namespace linalg {
13
22template <typename T>
23concept Scalar = requires {
24 typename scalar_traits_t<T>::scalar_type;
25 typename scalar_traits_t<T>::real_type;
26};
27
38template <typename T>
39concept Field = Scalar<T> && requires(const remove_cvref_t<T>& a,
40 const remove_cvref_t<T>& b) {
41 { a + b } -> std::convertible_to<remove_cvref_t<T>>;
42 { a - b } -> std::convertible_to<remove_cvref_t<T>>;
43 { a * b } -> std::convertible_to<remove_cvref_t<T>>;
44 { a / b } -> std::convertible_to<remove_cvref_t<T>>;
45};
46
48template <typename T>
50
52template <typename T>
54
55} // namespace linalg
Field classified by scalar_traits as complex.
Registered scalar supporting the Akreon Linalg's field arithmetic interface.
Field classified by scalar_traits as real.
Type registered with the Akreon Linalg scalar trait system.
constexpr std::size_t mat_rows_v
Registered compile-time row count after cv/ref normalization.