49 template<
typename dtype>
62 rowStart = inOffset * -1;
67 for (
uint32 row = rowStart; row < inN; ++row)
69 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
76 returnArray(row, col) = dtype{ 1 };
96 template<
typename dtype>
107 else if (inOffset < 0)
109 rowStart = inOffset * -1;
114 for (
uint32 row = rowStart; row < inN; ++row)
116 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
123 returnArray(row, col) = dtype{ 1 };
131 template<
typename dtype>
150 template<
typename dtype>
156 auto outArray = inArray.
copy();
157 outArray.
putMask(triu<bool>(inShape.
rows, inShape.
cols, inOffset + 1), 0);
174 template<
typename dtype>
188 else if (inOffset < 0)
190 rowStart = inOffset * -1;
195 for (
uint32 row = rowStart; row < inN; ++row)
197 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
204 returnArray(row, col) = dtype{ 0 };
223 template<
typename dtype>
228 return tril<dtype>(inN, -inOffset).transpose();
247 template<
typename dtype>
253 auto outArray = inArray.
copy();
254 outArray.
putMask(tril<bool>(inShape.
rows, inShape.
cols, inOffset - 1), 0);
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
self_type & zeros() noexcept
Definition: NdArrayCore.hpp:4900
self_type & ones() noexcept
Definition: NdArrayCore.hpp:3487
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
self_type copy() const
Definition: NdArrayCore.hpp:2486
self_type & putMask(const NdArray< bool > &inMask, const value_type &inValue)
Definition: NdArrayCore.hpp:4135
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: Cartesian.hpp:40
NdArray< dtype > triu(uint32 inN, uint32 inM, int32 inOffset=0)
Definition: tri.hpp:175
NdArray< dtype > tril(uint32 inN, int32 inOffset=0)
Definition: tri.hpp:50
std::int32_t int32
Definition: Types.hpp:36
std::uint32_t uint32
Definition: Types.hpp:40