NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
flip.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/Core/Types.hpp"
32#include "NumCpp/NdArray.hpp"
33
34namespace nc
35{
36 //============================================================================
37 // Method Description:
46 template<typename dtype>
48 {
49 switch (inAxis)
50 {
51 case Axis::NONE:
52 {
55 return returnArray;
56 }
57 case Axis::COL:
58 {
60 for (uint32 row = 0; row < inArray.shape().rows; ++row)
61 {
63 }
64 return returnArray;
65 }
66 case Axis::ROW:
67 {
68 return flip(inArray.transpose(), Axis::COL).transpose();
69 }
70 default:
71 {
72 THROW_INVALID_ARGUMENT_ERROR("Unimplemented axis type.");
73 return {}; // get rid of compiler warning
74 }
75 }
76 }
77} // namespace nc
#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
void reverse(BidirIt first, BidirIt last) noexcept
Definition StlAlgorithms.hpp:488
Definition Cartesian.hpp:40
Axis
Enum To describe an axis.
Definition Enums.hpp:36
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
NdArray< dtype > flip(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition flip.hpp:47
std::uint32_t uint32
Definition Types.hpp:40