MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
projection.hpp File Reference
#include <cmath>
#include <cstddef>
#include <limits>
#include <type_traits>
#include <utility>
#include <mtl/concepts/scalar.hpp>
#include <mtl/vec/dense_vector.hpp>
#include <mtl/mat/dense2D.hpp>

Classes

struct  mtl::detail::sat_traits< T >
 The integer types saturating_cast clamps: the integral types, and __int128 / unsigned __int128 where the compiler has them. More...
struct  mtl::detail::sat_unsigned< T >

Namespaces

namespace  mtl
namespace  mtl::detail
 mat*vec multiply into pre-allocated y: y = A * x.

Concepts

concept  mtl::ProjectableOnto
 ProjectableOnto: Target has fewer (or equal) significant digits than Source.
concept  mtl::EmbeddableInto
 EmbeddableInto: Target has more (or equal) significant digits than Source.

Functions

template<typename A, typename B>
constexpr bool mtl::detail::int_less (A a, B b) noexcept
 a < b by value, for integral types of any signedness and width.
template<typename Target, typename Value>
Target mtl::detail::saturating_cast (Value v)
 Convert a value to Target, clamping to [min, max] for integer types to prevent undefined behavior from signed integer overflow.
template<Scalar Target, Scalar Source>
requires ProjectableOnto<Target, Source>
vec::dense_vector< Target > mtl::project_onto (const vec::dense_vector< Source > &src)
 Project a dense vector onto a narrower element type.
template<Scalar Target, Scalar Source, Scalar ScaleType>
requires ProjectableOnto<Target, Source>
vec::dense_vector< Target > mtl::project_onto (const vec::dense_vector< Source > &src, ScaleType scale)
 Scaled projection of a dense vector with saturating conversion.
template<Scalar Target, Scalar Source>
requires ProjectableOnto<Target, Source>
mat::dense2D< Target > mtl::project_onto (const mat::dense2D< Source > &src)
 Project a dense 2D matrix onto a narrower element type; integer targets saturate (see the vector overload).
template<Scalar Target, Scalar Source, Scalar ScaleType>
requires ProjectableOnto<Target, Source>
mat::dense2D< Target > mtl::project_onto (const mat::dense2D< Source > &src, ScaleType scale)
 Scaled projection of a dense 2D matrix with saturating conversion.
template<Scalar Target, Scalar Source>
requires EmbeddableInto<Target, Source>
vec::dense_vector< Target > mtl::embed_into (const vec::dense_vector< Source > &src)
 Embed a dense vector into a wider element type.
template<Scalar Target, Scalar Source, Scalar ScaleType>
requires EmbeddableInto<Target, Source>
vec::dense_vector< Target > mtl::embed_into (const vec::dense_vector< Source > &src, ScaleType scale)
 Scaled embedding of a dense vector with saturating conversion.
template<Scalar Target, Scalar Source>
requires EmbeddableInto<Target, Source>
mat::dense2D< Target > mtl::embed_into (const mat::dense2D< Source > &src)
 Embed a dense 2D matrix into a wider element type.
template<Scalar Target, Scalar Source, Scalar ScaleType>
requires EmbeddableInto<Target, Source>
mat::dense2D< Target > mtl::embed_into (const mat::dense2D< Source > &src, ScaleType scale)
 Scaled embedding of a dense 2D matrix with saturating conversion.

Variables

template<typename T>
constexpr bool mtl::detail::is_sat_int_v = sat_traits<T>::is_int
template<typename T>
constexpr bool mtl::detail::sat_signed_v = sat_traits<T>::is_signed