NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
identity.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include "NumCpp/NdArray.hpp"
31
32namespace nc
33{
34 //============================================================================
35 // Method Description:
46 template<typename dtype>
48 {
49 NdArray<dtype> returnArray(inSquareSize);
50 returnArray.zeros();
51 for (uint32 i = 0; i < inSquareSize; ++i)
52 {
53 returnArray(i, i) = dtype{ 1 };
54 }
55
56 return returnArray;
57 }
58} // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
self_type & zeros() noexcept
Definition: NdArrayCore.hpp:4900
Definition: Cartesian.hpp:40
NdArray< dtype > identity(uint32 inSquareSize)
Definition: identity.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40