NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
fillDiagnol.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include "NumCpp/Core/Types.hpp"
31#include "NumCpp/NdArray.hpp"
32
33namespace nc
34{
35 //============================================================================
36 // Method Description:
44 template<typename dtype>
45 void fillDiagonal(NdArray<dtype>& inArray, dtype inValue) noexcept
46 {
47 const auto inShape = inArray.shape();
48 for (uint32 row = 0; row < inShape.rows; ++row)
49 {
50 if (row < inShape.cols)
51 {
52 inArray(row, row) = inValue;
53 }
54 }
55 }
56} // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
Definition Cartesian.hpp:39
void fillDiagonal(NdArray< dtype > &inArray, dtype inValue) noexcept
Definition fillDiagnol.hpp:45
std::uint32_t uint32
Definition Types.hpp:40