NumCpp  2.5.1
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:
52  template<typename dtype>
53  NdArray<dtype> stack(const std::initializer_list<NdArray<dtype> >& inArrayList, Axis inAxis = Axis::NONE)
54  {
55  switch (inAxis)
56  {
57  case Axis::ROW:
58  {
59  return row_stack(inArrayList);
60  }
61  case Axis::COL:
62  {
63  return column_stack(inArrayList);
64  }
65  default:
66  {
67  THROW_INVALID_ARGUMENT_ERROR("inAxis must be either ROW or COL.");
68  return {}; // getting rid of compiler warning
69  }
70  }
71  }
72 } // 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:51
Axis
Enum To describe an axis.
Definition: Types.hpp:46
NdArray< dtype > stack(const std::initializer_list< NdArray< dtype > > &inArrayList, Axis inAxis=Axis::NONE)
Definition: stack.hpp:53
NdArray< dtype > column_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition: column_stack.hpp:51