akreon-linalg
Fixed-size linear algebra and numerical methods in C++26.
Loading...
Searching...
No Matches
inner_product.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 <complex>
9#include <concepts>
10#include <type_traits>
11
13
14namespace linalg {
15
33template <FieldVector Vec>
41
49 const domain_type& rhs) const {
51 for (std::size_t i = 0; i < vector_dim_v<domain_type>; ++i) {
52 if constexpr (Complex<scalar_type>) result += std::conj(lhs(i)) * rhs(i);
53 else result += lhs(i) * rhs(i);
54 }
55 return result;
56 }
57};
58
66template <class Product>
68
70template <FieldVector Vec>
76
78template <class Product>
80
82template <class Product>
85
87template <class Product>
90
92template <class Product>
95
104template <class Product>
108 { product(lhs, rhs) } -> std::same_as<inner_product_codomain_t<Product>>;
109};
110
122template <FieldVector Vec>
123constexpr auto inner_product(const Vec& lhs, const Vec& rhs) {
125}
126
127} // namespace linalg
Field classified by scalar_traits as complex.
Callable contract for a trait-registered inner-product operation.
constexpr auto inner_product(const Vec &lhs, const Vec &rhs)
Evaluate the canonical inner product for two field vectors.
std::remove_cvref_t< T > remove_cvref_t
Remove top-level const, volatile, and reference qualification.
typename vector_traits_t< Vec >::element_type vector_element_t
Registered vector coordinate type.
typename inner_product_traits_t< Product >::scalar_type inner_product_scalar_t
Registered scalar field associated with the product domain.
typename inner_product_traits_t< Product >::codomain_type inner_product_codomain_t
Registered result type of the inner product.
typename inner_product_traits_t< Product >::domain_type inner_product_domain_t
Registered vector domain after product cv/ref normalization.
constexpr std::size_t mat_rows_v
Registered compile-time row count after cv/ref normalization.
Canonical inner product on a fixed-size vector over a scalar field.
vector_element_t< domain_type > scalar_type
Real or complex scalar field of the vector domain.
constexpr codomain_type operator()(const domain_type &lhs, const domain_type &rhs) const
Pair two vectors from the same domain.
remove_cvref_t< Vec > domain_type
Unqualified vector type accepted by both arguments.
scalar_type codomain_type
Scalar result type; equal to scalar_type.
Customization point for inner-product associated types.