MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
same_object.hpp File Reference
#include <concepts>
#include <cstddef>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>

Namespaces

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

Concepts

concept  mtl::detail::contiguous_storage
 A collection whose elements are laid out from a host address: dense vectors and matrices, strided references, and views over a caller's buffer.
concept  mtl::detail::minor_array_storage
 A compressed matrix's index arrays (compressed2D's ref_minor() and ref_major()): a writable output over them would corrupt the indices the kernel is still reading.
concept  mtl::detail::major_array_storage
concept  mtl::detail::value_array_storage
 A sparse matrix whose values are one array (compressed2D's and ell_matrix's ref_data()).
concept  mtl::detail::entry_array_storage
 A matrix whose entries are one array of (row, col, value) triplets (coordinate2D's ref_entries()).
concept  mtl::detail::block_list_storage
 A matrix made of separately stored blocks (block_diagonal2D): its storage is every block's.
concept  mtl::detail::encoded_byte_storage
 A matrix over encoded bytes (block_matrix_view's bytes()).
concept  mtl::detail::view_of_storage
 A view over another collection (transposed_view, the triangular and banded views, ...): its storage is its base's.

Functions

template<typename T, typename U>
constexpr bool mtl::detail::same_object (const T &a, const U &b) noexcept
 True when a and b are the same object (#696).
template<typename T>
auto mtl::detail::first_element_address (const T &t)
 The host address of a collection's first element: data() where that is the elements' address, and otherwise begin(), for a container in a host-accessible space whose handle is not an element pointer (#1017).
template<contiguous_storage T>
std::pair< const unsigned char *, const unsigned char * > mtl::detail::storage_bytes (const T &t)
 The bytes from t's first element to its last.
template<typename A>
std::pair< const unsigned char *, const unsigned char * > mtl::detail::array_bytes (const A &v)
 The bytes of a std::vector-like array's elements; empty when it is.
template<typename T, typename F>
void mtl::detail::for_each_storage_range (const T &t, F &&f)
 Calls f(lo, hi) for each byte range a collection's elements live in, looking through views: a contiguous collection's elements; a compressed or ELL matrix's value array; a coordinate matrix's triplets; each block of a block-diagonal matrix; a block matrix view's encoded bytes; a view's base.
template<typename T, typename U>
bool mtl::detail::storage_overlaps (const T &a, const U &b) noexcept
 Whether a and b may share storage (#840, #855): the same object, or element storage whose byte ranges overlap – a vector over part of another's buffer, as zero-copy views make easy; a vector over a sparse matrix's values or triplets, a block's elements or a block view's bytes; the matrix behind a transposed view.

Variables

template<typename T>
constexpr bool mtl::detail::data_is_element_address
 Whether t.data() is the address of t's elements.