NumCpp
2.17.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/Shape.hpp
"
31
#include "
NumCpp/Core/Types.hpp
"
32
#include "
NumCpp/NdArray.hpp
"
33
34
namespace
nc
35
{
36
//============================================================================
37
// Method Description:
45
template
<
typename
dtype>
46
void
fillDiagonal
(
NdArray<dtype>
& inArray, dtype inValue)
noexcept
47
{
48
const
auto
inShape = inArray.shape();
49
for
(
uint32
row = 0; row < inShape.rows; ++row)
50
{
51
if
(row < inShape.cols)
52
{
53
inArray(row, row) = inValue;
54
}
55
}
56
}
57
}
// namespace nc
Shape.hpp
NdArray.hpp
Types.hpp
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition
NdArrayCore.hpp:139
nc
Definition
Cartesian.hpp:40
nc::fillDiagonal
void fillDiagonal(NdArray< dtype > &inArray, dtype inValue) noexcept
Definition
fillDiagnol.hpp:46
nc::uint32
std::uint32_t uint32
Definition
Types.hpp:40
include
NumCpp
Functions
fillDiagnol.hpp
Generated by
1.15.0