 |
NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
|
Go to the documentation of this file.
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);
NdArray< dtype > tril(uint32 inN, int32 inOffset=0)
Definition: tri.hpp:51
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4356
std::int32_t int32
Definition: Types.hpp:36
NdArray< dtype > copy() const
Definition: NdArrayCore.hpp:2414
NdArray< dtype > triu(uint32 inN, uint32 inM, int32 inOffset=0)
Definition: tri.hpp:179
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:50
NdArray< dtype > & putMask(const NdArray< bool > &inMask, value_type inValue)
Definition: NdArrayCore.hpp:4008
std::uint32_t uint32
Definition: Types.hpp:40
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:40
uint32 cols
Definition: Core/Shape.hpp:45
NdArray< dtype > & zeros() noexcept
Definition: NdArrayCore.hpp:4670
NdArray< dtype > & ones() noexcept
Definition: NdArrayCore.hpp:3498
Definition: Coordinate.hpp:44
uint32 rows
Definition: Core/Shape.hpp:44