NumCpp  1.0
A C++ implementation of the Python Numpy library
rot90.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/Core/Types.hpp"
35 #include "NumCpp/NdArray.hpp"
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
51  template<typename dtype>
52  NdArray<dtype> rot90(const NdArray<dtype>& inArray, uint8 inK = 1)
53  {
54  inK %= 4;
55  switch (inK)
56  {
57  case 0:
58  {
59  return inArray;
60  }
61  case 1:
62  {
63  return flipud(inArray.transpose());
64  }
65  case 2:
66  {
67  return flip(inArray, Axis::NONE);
68  }
69  case 3:
70  {
71  return fliplr(inArray.transpose());
72  }
73  default:
74  {
75  // this isn't actually possible, just putting this here to get rid
76  // of the compiler warning.
77  return NdArray<dtype>(0);
78  }
79  }
80  }
81 }
nc::Axis::NONE
@ NONE
flip.hpp
nc::uint8
std::uint8_t uint8
Definition: Types.hpp:43
fliplr.hpp
nc::NdArray::transpose
NdArray< dtype > transpose() const
Definition: NdArrayCore.hpp:4591
nc::NdArray< dtype >
NdArray.hpp
nc::flip
NdArray< dtype > flip(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: flip.hpp:49
nc
Definition: Coordinate.hpp:45
nc::flipud
NdArray< dtype > flipud(const NdArray< dtype > &inArray)
Definition: flipud.hpp:49
flipud.hpp
nc::rot90
NdArray< dtype > rot90(const NdArray< dtype > &inArray, uint8 inK=1)
Definition: rot90.hpp:52
Types.hpp
nc::fliplr
NdArray< dtype > fliplr(const NdArray< dtype > &inArray)
Definition: fliplr.hpp:49