|
Stratax 0.2.0
|
#include <stratax/core/containers/Matrix.hpp>#include <stratax/core/containers/Tensor.hpp>#include <stratax/core/containers/Vector.hpp>#include <stratax/core/Exceptions.hpp>#include <stratax/core/containers/Shape.hpp>#include <stratax/core/Slice.hpp>#include <stratax/core/containers/Strides.hpp>#include <stratax/core/validation/Validation.hpp>#include <array>#include <cstddef>#include <limits>#include <vector>#include <type_traits>#include <utility>Go to the source code of this file.
Classes | |
| struct | stratax::ops::detail::ResolvedSlice |
Namespaces | |
| namespace | stratax |
| namespace | stratax::ops |
| namespace | stratax::ops::detail |
Functions | |
| std::ptrdiff_t | stratax::ops::detail::clamp (std::ptrdiff_t value, std::ptrdiff_t lower, std::ptrdiff_t upper) |
| ResolvedSlice | stratax::ops::detail::normalize_slice (const stratax::core::Slice &slice, std::size_t extent, const char *message) |
| template<std::size_t N, std::size_t... Is> | |
| stratax::core::Shape | stratax::ops::detail::shape_from_slices_impl (const std::array< stratax::core::Slice, N > &ranges, std::index_sequence< Is... >) |
| Builds a shape from a compile-time slice array. | |
| template<std::size_t N> | |
| stratax::core::Shape | stratax::ops::detail::shape_from_slices (const std::array< stratax::core::Slice, N > &ranges) |
| Builds a shape from a slice array. | |
| template<typename T> | |
| stratax::container::Vector< T > | slice (const stratax::container::Vector< T > &vec, const stratax::core::Slice &slice) |
| Copies a half-open range from a vector. | |
| template<typename T> | |
| stratax::container::Matrix< T > | slice (const stratax::container::Matrix< T > &mat, const stratax::core::Slice &rows, const stratax::core::Slice &cols) |
| Copies a rectangular half-open region from a matrix. | |
| template<typename T, typename... Slices> | |
| stratax::container::Tensor< T > | slice (const stratax::container::Tensor< T > &tensor, Slices... slices) |
| Copies a multidimensional half-open region from a tensor. | |
| template<typename T> | |
| stratax::container::Tensor< T > | slice (const stratax::container::Tensor< T > &tensor, const std::vector< stratax::core::Slice > &slices) |
| Copies a multidimensional half-open region from a tensor using a vector of slices. | |
| stratax::container::Matrix< T > slice | ( | const stratax::container::Matrix< T > & | mat, |
| const stratax::core::Slice & | rows, | ||
| const stratax::core::Slice & | cols ) |
Copies a rectangular half-open region from a matrix.
Rows in [rows.start(), rows.stop()) and columns in [cols.start(), cols.stop()) are copied into a new row-major matrix, sampling each axis by its slice step.
| mat | Source matrix. |
| rows | Row slice. |
| cols | Column slice. |
| Exceptions::IndexError | If either slice exceeds the matrix bounds. |
| stratax::container::Tensor< T > slice | ( | const stratax::container::Tensor< T > & | tensor, |
| const std::vector< stratax::core::Slice > & | slices ) |
Copies a multidimensional half-open region from a tensor using a vector of slices.
One Slice must be provided for each tensor dimension via the vector. The result shape is formed from the size of each slice, and values are copied in row-major order honoring each slice step.
| tensor | Source tensor. |
| slices | Vector of slices, one per tensor dimension. |
| Exceptions::DimensionError | If the vector size does not match the tensor rank. |
| Exceptions::IndexError | If any slice exceeds the corresponding dimension. |
| stratax::container::Tensor< T > slice | ( | const stratax::container::Tensor< T > & | tensor, |
| Slices... | slices ) |
Copies a multidimensional half-open region from a tensor.
One Slice must be provided for each tensor dimension. The result shape is formed from the size of each slice, and values are copied in row-major order honoring each slice step.
| tensor | Source tensor. |
| slices | One slice per tensor dimension. |
| Exceptions::DimensionError | If the number of slices does not match the tensor rank. |
| Exceptions::IndexError | If any slice exceeds the corresponding dimension. |
| stratax::container::Vector< T > slice | ( | const stratax::container::Vector< T > & | vec, |
| const stratax::core::Slice & | slice ) |
Copies a half-open range from a vector.
The returned vector contains elements in [slice.start(), slice.stop()) sampled with slice.step() using the source vector's flat storage order.
| vec | Source vector. |
| slice | Half-open element range. |
| Exceptions::IndexError | If the slice stop is greater than vec.size(). |