batmat 0.0.19
Batched linear algebra routines
Loading...
Searching...
No Matches
syomv.hpp
Go to the documentation of this file.
1#pragma once
2
7#include <batmat/loop.hpp>
9#include <guanaqo/trace.hpp>
10
11namespace batmat::linalg {
12
13namespace detail::syomv {
14template <class T, class Abi, micro_kernels::syomv::KernelConfig Conf = {}, StorageOrder OA,
17 // In practice: n² for matrix-vector products, n² for transposed matrix-vector products,
18 // n for subtracting the dot products for the transposed products at the end.
19 GUANAQO_TRACE_LINALG("syomv", (A.depth() - 1) * 2 * A.rows() * A.rows());
20 // Check dimensions
21 BATMAT_ASSERT(A.rows() == A.cols());
22 BATMAT_ASSERT(A.rows() == D.rows());
23 BATMAT_ASSERT(A.cols() == B.rows());
24 BATMAT_ASSERT(B.cols() == D.cols());
25 const index_t M = D.rows(), N = D.cols(), K = A.cols();
26
27 // Degenerate case
28 if (M == 0 || N == 0) [[unlikely]]
29 return;
30 if (K == 0) [[unlikely]]
31 return;
32
34}
35} // namespace detail::syomv
36
37/// @addtogroup topic-linalg
38/// @{
39
40/// @name Symmetric matrix-vector multiplication of a block tridiagonal matrix
41/// @{
42
43/// @todo Describe the operation in detail.
44template <MatrixStructure SA, simdifiable VA, simdifiable VB, simdifiable VD>
46void syomv(Structured<VA, SA> A, VB &&B, VD &&D) {
47 constexpr micro_kernels::syomv::KernelConfig conf{.negate = false, .struc_A = SA};
49 simdify(A.value).as_const(), simdify(B).as_const(), simdify(D));
50}
51
52/// @todo Describe the operation in detail.
53template <MatrixStructure SA, simdifiable VA, simdifiable VB, simdifiable VD>
55void syomv_neg(Structured<VA, SA> A, VB &&B, VD &&D) {
56 constexpr micro_kernels::syomv::KernelConfig conf{.negate = true, .struc_A = SA};
58 simdify(A.value).as_const(), simdify(B).as_const(), simdify(D));
59}
60
61/// @}
62
63/// @}
64
65} // namespace batmat::linalg
#define BATMAT_ASSERT(x)
Definition assume.hpp:14
void syomv(Structured< VA, SA > A, VB &&B, VD &&D)
Definition syomv.hpp:46
void syomv_neg(Structured< VA, SA > A, VB &&B, VD &&D)
Definition syomv.hpp:55
#define GUANAQO_TRACE_LINALG(name, gflops)
void syomv(view< const T, Abi, OA > A, view< const T, Abi, OB > B, view< T, Abi, OD > D)
Definition syomv.hpp:16
void syomv_register(view< const T, Abi, OA > A, view< const T, Abi, OB > B, view< T, Abi, OD > D) noexcept
Generalized matrix multiplication D = C ± A⁽ᵀ⁾ B⁽ᵀ⁾. Using register blocking.
Definition syomv.tpp:63
typename detail::simdified_abi< V >::type simdified_abi_t
Definition simdify.hpp:204
constexpr bool simdify_compatible
Definition simdify.hpp:207
constexpr auto simdify(simdifiable auto &&a) -> simdified_view_t< decltype(a)>
Definition simdify.hpp:214
simd_view_types< std::remove_const_t< T >, Abi >::template view< T, Order > view
Definition uview.hpp:70
Aligned allocation for matrix storage.
Light-weight wrapper class used for overload resolution of triangular and symmetric matrices.