NumCpp  1.0
A C++ implementation of the Python Numpy library
fillDiagnol.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/Core/Shape.hpp"
32 #include "NumCpp/Core/Types.hpp"
33 #include "NumCpp/NdArray.hpp"
34 
35 namespace nc
36 {
37  //============================================================================
38  // Method Description:
46  template<typename dtype>
47  void fillDiagonal(NdArray<dtype>& inArray, dtype inValue) noexcept
48  {
49  const auto inShape = inArray.shape();
50  for (uint32 row = 0; row < inShape.rows; ++row)
51  {
52  if (row < inShape.cols)
53  {
54  inArray(row, row) = inValue;
55  }
56  }
57  }
58 }
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
NdArray.hpp
nc::fillDiagonal
void fillDiagonal(NdArray< dtype > &inArray, dtype inValue) noexcept
Definition: fillDiagnol.hpp:47
Shape.hpp
nc
Definition: Coordinate.hpp:45
Types.hpp