NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
stack.hpp
Go to the documentation of this file.
1 #pragma once
29 
31 #include "NumCpp/Core/Types.hpp"
34 #include "NumCpp/NdArray.hpp"
35 
36 #include <initializer_list>
37 #include <string>
38 
39 namespace nc
40 {
41  //============================================================================
42  // Method Description:
51  template<typename dtype>
52  NdArray<dtype> stack(std::initializer_list<NdArray<dtype> > inArrayList, Axis inAxis = Axis::NONE)
53  {
54  switch (inAxis)
55  {
56  case Axis::ROW:
57  {
58  return row_stack(inArrayList);
59  }
60  case Axis::COL:
61  {
62  return column_stack(inArrayList);
63  }
64  default:
65  {
66  THROW_INVALID_ARGUMENT_ERROR("inAxis must be either ROW or COL.");
67  return {}; // getting rid of compiler warning
68  }
69  }
70  }
71 } // namespace nc
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
Definition: Coordinate.hpp:45
NdArray< dtype > row_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition: row_stack.hpp:49
NdArray< dtype > stack(std::initializer_list< NdArray< dtype > > inArrayList, Axis inAxis=Axis::NONE)
Definition: stack.hpp:52
Axis
Enum To describe an axis.
Definition: Types.hpp:46
NdArray< dtype > column_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition: column_stack.hpp:49