16namespace stratax::manipulation {
41 const auto target_size = shape.
elements();
42 if (arr.size() != target_size)
45 "Reshape must preserve the number of elements.");
49 std::copy(arr.begin(), arr.end(), result.
begin());
72 std::copy(arr.begin(), arr.end(), result.
begin());
Dtype and array interface concepts.
Stratax exception types derived from std::runtime_error.
stratax::container::Tensor< typename A::value_type > reshape(const A &arr, const stratax::core::Shape &shape)
Copies a Stratax array or view into a tensor with a new shape.
stratax::container::Vector< typename A::value_type > flatten(const A &arr)
Copies a Stratax array or view into a rank-one vector.
Immutable dimension metadata and checked row-major strides.
Arbitrary-rank owning arrays; rank zero is empty.
Shape incompatible with the requested operation or container.
Arbitrary-rank owning array of supported dtype values.
One-dimensional owning array of supported dtype values.
iterator begin() noexcept
Returns a mutable iterator to the first element.
Stores the dimensions of a multidimensional array.
size_type elements() const
Computes the total number of elements described by the shape.