52 template<
typename dtype>
57 const auto indices = [
size]
59 std::vector<typename NdArray<dtype>::size_type> temp(
size);
60 std::iota(temp.begin(), temp.end(), 0);
67 [&func](
const auto idx) { return func(idx); });
84 template<
typename dtype>
90 const auto rows = [&
shape]
92 std::vector<typename NdArray<dtype>::size_type> temp(
shape.
rows);
93 std::iota(temp.begin(), temp.end(), 0);
96 const auto cols = [&
shape]
98 std::vector<typename NdArray<dtype>::size_type> temp(
shape.
cols);
99 std::iota(temp.begin(), temp.end(), 0);
105 [&cols, &result, &func](
const auto row)
107 stl_algorithms::transform(cols.begin(),
110 [&func, row](const auto col) { return func(row, col); });
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
uint32 size_type
Definition: NdArrayCore.hpp:156
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
uint32 cols
Definition: Core/Shape.hpp:45
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225
Definition: Cartesian.hpp:40
uint32 size(const NdArray< dtype > &inArray) noexcept
Definition: size.hpp:43
NdArray< dtype > fromfunction(const std::function< dtype(typename NdArray< dtype >::size_type)> func, typename NdArray< dtype >::size_type size)
Definition: fromfunction.hpp:53
Shape shape(const NdArray< dtype > &inArray) noexcept
Definition: Functions/Shape.hpp:42