|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Public Member Functions | |
| strided_layout (const strided_layout &other) noexcept | |
| strided_layout (strided_layout &&other) noexcept | |
| strided_layout & | operator= (const strided_layout &other) noexcept |
| strided_layout & | operator= (strided_layout &&other) noexcept |
| std::size_t | hash () const noexcept |
| Obtain a hash of the layout. | |
| std::size_t | get_rank () const noexcept |
| Get the number of axis in the layout. | |
| void | get_extents (std::vector< std::size_t > &extents) const |
| Get the extents of the layout. | |
| void | get_strides (std::vector< std::ptrdiff_t > &strides) const |
| Get the strides of the layout. | |
| std::ptrdiff_t | get_offset () const noexcept |
| Get the offset of the data. | |
| std::size_t | compute_storage_requirement () const noexcept |
| Computes the minimum storage size (in elements) for this layout. | |
| std::size_t | compute_element_count () const noexcept |
| Computes the number of elements referenced by the layout. | |
| bool | extents_equal (span< const std::size_t > extents) const noexcept |
| Check if this layout has a specific shape. | |
| REXLIB_NODISCARD strided_layout | apply_subscripts (span< const dynamic_subscript > subscripts) const |
| Apply a set of dynamic subscripts to this layout. | |
| REXLIB_NODISCARD strided_layout | transpose () const |
| Reverse the order of the axes. | |
| REXLIB_NODISCARD strided_layout | permute (span< const std::size_t > order) const |
| Permute the order of the axes. | |
| REXLIB_NODISCARD strided_layout | matrix_transpose (std::ptrdiff_t axis1=-1, std::ptrdiff_t axis2=-2) const |
| Swap two axes in the layout. | |
| REXLIB_NODISCARD strided_layout | matrix_diagonal (std::ptrdiff_t axis1=-1, std::ptrdiff_t axis2=-2) const |
| Obtains a layout view to the matrix diagonal defined by two axes. | |
| REXLIB_NODISCARD strided_layout | squeeze () const |
| Remove insignificant axes of the layout. | |
| REXLIB_NODISCARD strided_layout | broadcast_to (span< const std::size_t > extents) const |
| Perform a broadcast of the layout to match the provided extents. | |
| const strided_layout_implementation & | get_implementation () const noexcept |
| Get the implementation of this layout. | |
Static Public Member Functions | |
| static strided_layout | make_contiguous_layout (span< const std::size_t > extents) |
| Create a contiguous layout from the provided extents. | |
| static strided_layout | make_custom_layout (span< const std::size_t > extents, span< const std::ptrdiff_t > strides, std::ptrdiff_t offset=0) |
Friends | |
| bool | operator== (const strided_layout &lhs, const strided_layout &rhs) noexcept |
| bool | operator!= (const strided_layout &lhs, const strided_layout &rhs) noexcept |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::apply_subscripts | ( | span< const dynamic_subscript > | subscripts | ) | const |
Apply a set of dynamic subscripts to this layout.
| subscripts | The subscripts. |
| std::invalid_argument | If not all subscripts are processed. Or subscript is out of bounds |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::broadcast_to | ( | span< const std::size_t > | extents | ) | const |
Perform a broadcast of the layout to match the provided extents.
This function modifies the layout to match the provided extents by adding phantom axes or adjusting existing axes.
| extents | Extents to broadcast to. untouched. Must be greater or equal to rank. Defaults to zero. |
| std::invalid_argument | If the layout has more axes than extents. |
| std::invalid_argument | If the axes cannot be broadcasted to the provided extents. |
|
noexcept |
Computes the number of elements referenced by the layout.
|
noexcept |
Computes the minimum storage size (in elements) for this layout.
Check if this layout has a specific shape.
| extents | The extents to be compared. |
| void rexlib::strided_layout::get_extents | ( | std::vector< std::size_t > & | extents | ) | const |
Get the extents of the layout.
| extents | Output parameter where the extents are written. |
|
noexcept |
Get the implementation of this layout.
|
noexcept |
Get the offset of the data.
|
noexcept |
Get the number of axis in the layout.
| void rexlib::strided_layout::get_strides | ( | std::vector< std::ptrdiff_t > & | strides | ) | const |
Get the strides of the layout.
| strides | Output parameter where the strides are written. |
|
noexcept |
Obtain a hash of the layout.
|
static |
Create a contiguous layout from the provided extents.
| extents | Extents of the layout. |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::matrix_diagonal | ( | std::ptrdiff_t | axis1 = -1, |
| std::ptrdiff_t | axis2 = -2 |
||
| ) | const |
Obtains a layout view to the matrix diagonal defined by two axes.
| axis1 | First axis of the diagonal. Must be in [-rank, rank). |
| axis2 | Second axis of the diagonal. Must be in [-rank, rank). Cannot be equal to axis1. |
| std::out_of_range | If either axis1 or axis2 exceeds bounds. |
| std::invalid_argument | If axis1 and axis2 are equal. |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::matrix_transpose | ( | std::ptrdiff_t | axis1 = -1, |
| std::ptrdiff_t | axis2 = -2 |
||
| ) | const |
Swap two axes in the layout.
| axis1 | Index of the first axis. Must be in [-rank, rank). |
| axis2 | Index of the second axis. Must be in [-rank, rank). |
| std::out_of_range | If either axis1 or axis2 exceeds bounds. |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::permute | ( | span< const std::size_t > | order | ) | const |
Permute the order of the axes.
| order | Order acquired by the new layout. Must have the same size as the amount of dimensions and it must feature strictly one instance of each number in [0, rank). |
| std::invalid_argument | If the permutation order is invalid. |
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::squeeze | ( | ) | const |
Remove insignificant axes of the layout.
| REXLIB_NODISCARD strided_layout rexlib::strided_layout::transpose | ( | ) | const |
Reverse the order of the axes.