NumCpp  2.1.0
A C++ implementation of the Python Numpy library
stack.hpp
Go to the documentation of this file.
1 #pragma once
30 
32 #include "NumCpp/Core/Types.hpp"
35 #include "NumCpp/NdArray.hpp"
36 
37 #include <initializer_list>
38 #include <string>
39 
40 namespace nc
41 {
42  //============================================================================
43  // Method Description:
53  template<typename dtype>
54  NdArray<dtype> stack(const std::initializer_list<NdArray<dtype> >& inArrayList, Axis inAxis = Axis::NONE)
55  {
56  switch (inAxis)
57  {
58  case Axis::ROW:
59  {
60  return row_stack(inArrayList);
61  }
62  case Axis::COL:
63  {
64  return column_stack(inArrayList);
65  }
66  default:
67  {
68  THROW_INVALID_ARGUMENT_ERROR("inAxis must be either ROW or COL.");
69  return {}; // getting rid of compiler warning
70  }
71  }
72  }
73 } // namespace nc
nc::Axis::NONE
@ NONE
Error.hpp
nc::Axis::ROW
@ ROW
column_stack.hpp
row_stack.hpp
nc::NdArray< dtype >
nc::column_stack
NdArray< dtype > column_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition: column_stack.hpp:52
NdArray.hpp
nc::Axis
Axis
Enum To describe an axis.
Definition: Types.hpp:47
nc::row_stack
NdArray< dtype > row_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition: row_stack.hpp:52
nc
Definition: Coordinate.hpp:45
THROW_INVALID_ARGUMENT_ERROR
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
nc::stack
NdArray< dtype > stack(const std::initializer_list< NdArray< dtype > > &inArrayList, Axis inAxis=Axis::NONE)
Definition: stack.hpp:54
Types.hpp
nc::Axis::COL
@ COL