cheatah
Source

stdlib/linalg/enums.hpp

1// Copyright (c) 2026 BigBrain LLC. MIT-licensed (see LICENSE).
2// Original work; see ACKNOWLEDGMENTS.md for the open-source ideas we build upon.
3#pragma once
5/**
6 * @file enums.hpp
7 * @brief cheatah `linalg` — operation-variant enums used as non-type template parameters.
8 *
9 * Where two or more routines differ only by a compile-time choice, that choice is an `enum`
10 * NTTP `if constexpr`-branched inside ONE templated body — so the variants share a single
11 * definition and the compiler emits only the selected branch (zero runtime cost, no dead
12 * loads). This keeps the maintained surface small while staying the fastest possible per
13 * instantiation.
14 */
16namespace cheatah::linalg {
18/// Whether a reduction conjugates its first operand. `dot`/`inner` are bilinear (`Conj::None`,
19/// Σ aᵢbᵢ); `vdot` is the conjugate-linear Hermitian inner product (`Conj::Conjugate`,
20/// Σ conj(aᵢ)·bᵢ). For a REAL element the conjugate is the identity, so both fold to the same
21/// code via `if constexpr (is_complex_v<T> && mode == Conj::Conjugate)`.
22enum class Conj { None, Conjugate };
24} // namespace cheatah::linalg