NumCpp
2.1.0
A C++ implementation of the Python Numpy library
diag.hpp
Go to the documentation of this file.
1
#pragma once
30
31
#include "
NumCpp/Core/Types.hpp
"
32
#include "
NumCpp/Functions/diagflat.hpp
"
33
#include "
NumCpp/Functions/diagonal.hpp
"
34
#include "
NumCpp/NdArray.hpp
"
35
36
namespace
nc
37
{
38
//============================================================================
39
// Method Description:
51
template
<
typename
dtype>
52
NdArray<dtype>
diag
(
const
NdArray<dtype>
& inArray,
int32
k = 0)
53
{
54
if
(inArray.
isflat
())
55
{
56
return
diagflat
(inArray, k);
57
}
58
59
return
diagonal
(inArray, k,
Axis::ROW
);
60
}
61
}
// namespace nc
nc::diag
NdArray< dtype > diag(const NdArray< dtype > &inArray, int32 k=0)
Definition:
diag.hpp:52
nc::int32
std::int32_t int32
Definition:
Types.hpp:37
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:49
nc::NdArray::isflat
bool isflat() const noexcept
Definition:
NdArrayCore.hpp:2881
diagonal.hpp
nc::diagflat
NdArray< dtype > diagflat(const NdArray< dtype > &inArray, int32 k=0)
Definition:
diagflat.hpp:52
nc
Definition:
Coordinate.hpp:45
Types.hpp
diagflat.hpp
include
NumCpp
Functions
diag.hpp
Generated by
1.8.17