 |
NumCpp
2.1.0
A C++ implementation of the Python Numpy library
|
Go to the documentation of this file.
51 template<
typename dtype>
64 rowStart = inOffset * -1;
69 for (
uint32 row = rowStart; row < inN; ++row)
71 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
78 returnArray(row, col) = dtype{ 1 };
99 template<
typename dtype>
110 else if (inOffset < 0)
112 rowStart = inOffset * -1;
117 for (
uint32 row = rowStart; row < inN; ++row)
119 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
126 returnArray(row, col) = dtype{ 1 };
134 template<
typename dtype>
154 template<
typename dtype>
160 auto outArray = inArray.
copy();
161 outArray.
putMask(triu<bool>(inShape.
rows, inShape.
cols, inOffset + 1), 0);
179 template<
typename dtype>
193 else if (inOffset < 0)
195 rowStart = inOffset * -1;
200 for (
uint32 row = rowStart; row < inN; ++row)
202 for (
uint32 col = 0; col < row + colStart + 1 - rowStart; ++col)
209 returnArray(row, col) = dtype{ 0 };
229 template<
typename dtype>
234 return tril<dtype>(inN, -inOffset).transpose();
254 template<
typename dtype>
260 auto outArray = inArray.
copy();
261 outArray.
putMask(tril<bool>(inShape.
rows, inShape.
cols, inOffset - 1), 0);
NdArray< dtype > tril(uint32 inN, int32 inOffset=0)
Definition: tri.hpp:52
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4312
std::int32_t int32
Definition: Types.hpp:37
NdArray< dtype > copy() const
Definition: NdArrayCore.hpp:2397
NdArray< dtype > triu(uint32 inN, uint32 inM, int32 inOffset=0)
Definition: tri.hpp:180
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:51
NdArray< dtype > & putMask(const NdArray< bool > &inMask, value_type inValue)
Definition: NdArrayCore.hpp:3964
std::uint32_t uint32
Definition: Types.hpp:41
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 cols
Definition: Core/Shape.hpp:46
NdArray< dtype > & zeros() noexcept
Definition: NdArrayCore.hpp:4626
NdArray< dtype > & ones() noexcept
Definition: NdArrayCore.hpp:3454
Definition: Coordinate.hpp:45
uint32 rows
Definition: Core/Shape.hpp:45