NumCpp
2.4.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
30
#include "
NumCpp/Core/Internal/Error.hpp
"
31
#include "
NumCpp/Core/Types.hpp
"
32
#include "
NumCpp/Functions/column_stack.hpp
"
33
#include "
NumCpp/Functions/row_stack.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
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:51
NdArray.hpp
nc::Axis
Axis
Enum To describe an axis.
Definition:
Types.hpp:46
nc::row_stack
NdArray< dtype > row_stack(const std::initializer_list< NdArray< dtype > > &inArrayList)
Definition:
row_stack.hpp:51
nc
Definition:
Coordinate.hpp:44
THROW_INVALID_ARGUMENT_ERROR
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition:
Error.hpp:36
nc::stack
NdArray< dtype > stack(const std::initializer_list< NdArray< dtype > > &inArrayList, Axis inAxis=Axis::NONE)
Definition:
stack.hpp:53
Types.hpp
nc::Axis::COL
@ COL
include
NumCpp
Functions
stack.hpp
Generated by
1.8.17