NumCpp  1.0
A C++ implementation of the Python Numpy library
identity.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
32 
33 namespace nc
34 {
35  //============================================================================
36  // Method Description:
49  template<typename dtype>
51  {
52  NdArray<dtype> returnArray(inSquareSize);
53  returnArray.zeros();
54  for (uint32 i = 0; i < inSquareSize; ++i)
55  {
56  returnArray(i, i) = dtype{ 1 };
57  }
58 
59  return returnArray;
60  }
61 }
nc::identity
NdArray< dtype > identity(uint32 inSquareSize)
Definition: identity.hpp:50
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
NdArray.hpp
nc::NdArray::zeros
NdArray< dtype > & zeros() noexcept
Definition: NdArrayCore.hpp:4609
nc
Definition: Coordinate.hpp:45