NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
identity.hpp
Go to the documentation of this file.
1
#pragma once
29
30
#include "
NumCpp/NdArray.hpp
"
31
32
namespace
nc
33
{
34
//============================================================================
35
// Method Description:
48
template
<
typename
dtype>
49
NdArray<dtype>
identity
(
uint32
inSquareSize)
50
{
51
NdArray<dtype>
returnArray(inSquareSize);
52
returnArray.
zeros
();
53
for
(
uint32
i = 0; i < inSquareSize; ++i)
54
{
55
returnArray(i, i) = dtype{ 1 };
56
}
57
58
return
returnArray;
59
}
60
}
// namespace nc
nc::identity
NdArray< dtype > identity(uint32 inSquareSize)
Definition:
identity.hpp:49
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition:
Types.hpp:40
NdArray.hpp
nc::NdArray::zeros
NdArray< dtype > & zeros() noexcept
Definition:
NdArrayCore.hpp:4670
nc
Definition:
Coordinate.hpp:44
include
NumCpp
Functions
identity.hpp
Generated by
1.8.17