|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Read-only, row-major view of a rows x cols matrix stored as blocks of the scheme S, cols / S::block_size blocks per row. More...
#include <block_matrix_view.hpp>
Public Types | |
| using | scheme_type = S |
| using | value_type = float |
| using | size_type = std::size_t |
| using | const_reference = float |
| using | reference = float |
Public Member Functions | |
| block_matrix_view (size_type rows, size_type cols, std::span< const std::byte > bytes) | |
| View bytes as a rows x cols matrix. | |
| size_type | num_rows () const noexcept |
| size_type | num_cols () const noexcept |
| size_type | size () const noexcept |
| size_type | blocks_per_row () const noexcept |
| std::span< const std::byte > | bytes () const noexcept |
| The encoded bytes of the whole matrix, row after row. | |
| float | operator() (size_type r, size_type c) const |
| Element (r, c), decoded. | |
| std::span< const std::byte > | block (size_type r, size_type b) const |
| The encoded bytes of block b of row r. | |
| std::span< const std::byte > | row (size_type r) const |
| The encoded bytes of row r: blocks_per_row() consecutive blocks. | |
| void | decode_row (size_type r, float *dst) const |
| Decode row r into cols floats at dst. | |
Static Public Attributes | |
| static constexpr size_type | block_size = S::block_size |
| static constexpr size_type | block_bytes = S::block_bytes |
Read-only, row-major view of a rows x cols matrix stored as blocks of the scheme S, cols / S::block_size blocks per row.
| using mtl::mat::block_matrix_view< S >::const_reference = float |
| using mtl::mat::block_matrix_view< S >::reference = float |
| using mtl::mat::block_matrix_view< S >::scheme_type = S |
| using mtl::mat::block_matrix_view< S >::size_type = std::size_t |
| using mtl::mat::block_matrix_view< S >::value_type = float |
|
inline |
View bytes as a rows x cols matrix.
Throws std::invalid_argument unless cols is a multiple of the block size and bytes holds exactly rows * (cols / block_size) blocks.
The byte count is computed with overflow checks. The shape usually comes from a file header, and a product that wrapped would let a huge rows validate against a small span and every later access read past it. A shape whose byte or element count does not fit in size_t is rejected.
|
inline |
The encoded bytes of block b of row r.
|
inlinenoexcept |
|
inlinenoexcept |
The encoded bytes of the whole matrix, row after row.
What the aliasing guards compare a y against (detail::storage_overlaps, #855).
|
inline |
Decode row r into cols floats at dst.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Element (r, c), decoded.
One element if the scheme can do that, the enclosing block otherwise.
|
inline |
The encoded bytes of row r: blocks_per_row() consecutive blocks.
|
inlinenoexcept |
|
staticconstexpr |
|
staticconstexpr |