NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
diag.hpp
Go to the documentation of this file.
1
#pragma once
29
30
#include "
NumCpp/Core/Types.hpp
"
31
#include "
NumCpp/Functions/diagflat.hpp
"
32
#include "
NumCpp/Functions/diagonal.hpp
"
33
#include "
NumCpp/NdArray.hpp
"
34
35
namespace
nc
36
{
37
//============================================================================
38
// Method Description:
50
template
<
typename
dtype>
51
NdArray<dtype>
diag
(
const
NdArray<dtype>
& inArray,
int32
k = 0)
52
{
53
if
(inArray.
isflat
())
54
{
55
return
diagflat
(inArray, k);
56
}
57
58
return
diagonal
(inArray, k,
Axis::ROW
);
59
}
60
}
// namespace nc
nc::diag
NdArray< dtype > diag(const NdArray< dtype > &inArray, int32 k=0)
Definition:
diag.hpp:51
nc::int32
std::int32_t int32
Definition:
Types.hpp:36
nc::Axis::ROW
@ ROW
nc::NdArray< dtype >
NdArray.hpp
nc::diagonal
NdArray< dtype > diagonal(const NdArray< dtype > &inArray, int32 inOffset=0, Axis inAxis=Axis::ROW)
Definition:
diagonal.hpp:48
nc::NdArray::isflat
bool isflat() const noexcept
Definition:
NdArrayCore.hpp:2898
diagonal.hpp
nc::diagflat
NdArray< dtype > diagflat(const NdArray< dtype > &inArray, int32 k=0)
Definition:
diagflat.hpp:51
nc
Definition:
Coordinate.hpp:44
Types.hpp
diagflat.hpp
include
NumCpp
Functions
diag.hpp
Generated by
1.8.17