7#include <stratax/core/dtypes/Concepts.hpp>
8#include <stratax/core/Shape.hpp>
9#include <stratax/exceptions/Exceptions.hpp>
10#include <stratax/containers/Tensor.hpp>
11#include <stratax/containers/Vector.hpp>
13namespace stratax::manipulation {
34stratax::container::Tensor<typename A::value_type>
35reshape(
const A& arr,
const stratax::core::Shape& shape)
39 throw Exceptions::ShapeError(
40 "Reshape size must match original array size.");
43 stratax::container::Tensor<typename A::value_type> result(shape);
44 std::copy(arr.begin(), arr.end(), result.begin());
63stratax::container::Vector<typename A::value_type>
66 stratax::container::Vector<typename A::value_type> result(arr.size());
67 std::copy(arr.begin(), arr.end(), result.begin());
size_type elements() const
Computes the total number of elements described by the shape.