52 template<
typename dtype,
typename Indices, type_traits::ndarray_
int_concept<Indices> = 0>
55 if constexpr (type_traits::is_ndarray_signed_int_v<Indices>)
94 template<
typename dtype,
typename Indices, type_traits::ndarray_
int_concept<Indices> = 0>
98 if constexpr (type_traits::is_ndarray_signed_int_v<Indices>)
118 if constexpr (std::is_signed_v<decltype(value)>)
120 if (value >= 0 && value < arrayRows)
127 if (value < arrayRows)
134 const auto arrayCols =
static_cast<int32>(inArray.numCols());
135 NdArray<dtype> returnArray(arrayRows - indicesSize, arrayCols);
138 for (int32 row = 0; row < arrayRows; ++row)
140 if (std::binary_search(indices.begin(), indices.end(), row))
145 for (int32 col = 0; col < arrayCols; ++col)
147 returnArray(rowCounter, col) = inArray(row, col);
164 template<
typename dtype,
typename Indices, type_traits::ndarray_
int_concept<Indices> = 0>
167 const auto arrayCols =
static_cast<int32>(inArray.
numCols());
168 if constexpr (type_traits::is_ndarray_signed_int_v<Indices>)
170 stl_algorithms::for_each(inIndices.begin(),
172 [arrayCols](
auto& value)
181 auto indices =
unique(inIndices);
184 std::for_each(indices.begin(),
186 [arrayCols, &indicesSize](
const auto& value)
188 if constexpr (std::is_signed_v<decltype(value)>)
190 if (value >= 0 && value < arrayCols)
197 if (value < arrayCols)
204 const auto arrayRows =
static_cast<int32>(inArray.numRows());
205 NdArray<dtype> returnArray(arrayRows, arrayCols - indicesSize);
208 for (int32 col = 0; col < arrayCols; ++col)
210 if (std::binary_search(indices.begin(), indices.end(), col))
215 for (int32 row = 0; row < arrayRows; ++row)
217 returnArray(row, colCounter) = inArray(row, col);
236 template<
typename dtype,
typename Indices, type_traits::ndarray_
int_concept<Indices> = 0>
243 return detail::deleteFlatIndices(inArray, inIndices);
247 return detail::deleteRowIndices(inArray, inIndices);
251 return detail::deleteColumnIndices(inArray, inIndices);
270 template<
typename dtype>
292 std::vector<int32> indices;
293 for (
auto i = inIndicesSlice.
start; i < inIndicesSlice.
stop; i += inIndicesSlice.
step)
295 indices.push_back(i);
310 template<
typename dtype>
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
size_type size() const noexcept
Definition NdArrayCore.hpp:4600
size_type numCols() const noexcept
Definition NdArrayCore.hpp:3541
size_type numRows() const noexcept
Definition NdArrayCore.hpp:3553
A Class for slicing into NdArrays.
Definition Slice.hpp:45
int32 step
Definition Slice.hpp:50
int32 start
Definition Slice.hpp:48
void makePositiveAndValidate(uint32 inArraySize)
Definition Slice.hpp:142
int32 stop
Definition Slice.hpp:49
NdArray< dtype > deleteColumnIndices(const NdArray< dtype > &inArray, Indices inIndices)
Definition deleteIndices.hpp:165
NdArray< dtype > deleteRowIndices(const NdArray< dtype > &inArray, Indices inIndices)
Definition deleteIndices.hpp:95
NdArray< dtype > deleteFlatIndices(const NdArray< dtype > &inArray, Indices inIndices)
Definition deleteIndices.hpp:53
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition StlAlgorithms.hpp:225
Definition Cartesian.hpp:40
Axis
Enum To describe an axis.
Definition Enums.hpp:36
NdArray< dtype > unique(const NdArray< dtype > &inArray)
Definition unique.hpp:53
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::int32_t int32
Definition Types.hpp:36
NdArray< dtype > deleteIndices(const NdArray< dtype > &inArray, const Indices &inIndices, Axis inAxis=Axis::NONE)
Definition deleteIndices.hpp:237
std::uint32_t uint32
Definition Types.hpp:40