MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
operations.hpp File Reference
#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <mtl/array/ndarray.hpp>
#include <mtl/detail/exceptions.hpp>
#include <mtl/math/identity.hpp>

Namespaces

namespace  mtl
namespace  mtl::array
namespace  mtl::array::detail_ops

Functions

void mtl::array::detail_ops::empty_reduction (const char *what)
template<typename V, std::size_t N, typename O>
std::remove_cv_t< V > mtl::array::sum (const ndarray< V, N, O > &a)
 Sum all elements; zero for an empty array.
template<typename V, std::size_t N, typename O>
std::remove_cv_t< V > mtl::array::prod (const ndarray< V, N, O > &a)
 Product of all elements; one for an empty array.
template<typename V, std::size_t N, typename O>
requires std::totally_ordered<std::remove_cv_t<V>>
std::remove_cv_t< V > mtl::array::min (const ndarray< V, N, O > &a)
 Minimum element, seeded from the first one. Throws on an empty array.
template<typename V, std::size_t N, typename O>
requires std::totally_ordered<std::remove_cv_t<V>>
std::remove_cv_t< V > mtl::array::max (const ndarray< V, N, O > &a)
 Maximum element, seeded from the first one. Throws on an empty array.
template<typename V, std::size_t N, typename O>
std::remove_cv_t< V > mtl::array::mean (const ndarray< V, N, O > &a)
 Mean of all elements. Throws on an empty array.
template<typename V, std::size_t N, typename O>
requires (N > 1)
ndarray< std::remove_cv_t< V >, N - 1, O > mtl::array::sum_axis (const ndarray< V, N, O > &a, std::size_t axis)
 Sum along a specified axis, producing an ndarray of rank N-1.
template<typename V, std::size_t N, typename O>
requires (N > 1)
ndarray< std::remove_cv_t< V >, N - 1, O > mtl::array::mean_axis (const ndarray< V, N, O > &a, std::size_t axis)
 Mean along a specified axis.