50 template<
typename dtype>
63 rowStart = inOffset * -1;
68 for (
uint32 row = rowStart; row < inN; ++row)
70 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
77 returnArray(row, col) = dtype{ 1 };
98 template<
typename dtype>
109 else if (inOffset < 0)
111 rowStart = inOffset * -1;
116 for (
uint32 row = rowStart; row < inN; ++row)
118 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
125 returnArray(row, col) = dtype{ 1 };
133 template<
typename dtype>
153 template<
typename dtype>
159 auto outArray = inArray.
copy();
160 outArray.putMask(triu<bool>(inShape.
rows, inShape.
cols, inOffset + 1), 0);
178 template<
typename dtype>
192 else if (inOffset < 0)
194 rowStart = inOffset * -1;
199 for (
uint32 row = rowStart; row < inN; ++row)
201 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
208 returnArray(row, col) = dtype{ 0 };
228 template<
typename dtype>
233 return tril<dtype>(inN, -inOffset).transpose();
253 template<
typename dtype>
259 auto outArray = inArray.
copy();
260 outArray.putMask(tril<bool>(inShape.
rows, inShape.
cols, inOffset - 1), 0);
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:50
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
NdArray< dtype > copy() const
Definition: NdArrayCore.hpp:2541
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4483
NdArray< dtype > & ones() noexcept
Definition: NdArrayCore.hpp:3625
NdArray< dtype > & zeros() noexcept
Definition: NdArrayCore.hpp:4859
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
uint32 cols
Definition: Core/Shape.hpp:45
Definition: Coordinate.hpp:45
NdArray< dtype > triu(uint32 inN, uint32 inM, int32 inOffset=0)
Definition: tri.hpp:179
std::int32_t int32
Definition: Types.hpp:36
NdArray< dtype > tril(uint32 inN, int32 inOffset=0)
Definition: tri.hpp:51
std::uint32_t uint32
Definition: Types.hpp:40