|
Eye
A static function. Constructs a matrix having a specified size with ones on the main diagonal and zeros elsewhere. Returns a matrix with ones on the diagonal and zeros elsewhere.
static matrix matrix::Eye(
|
Parameters
rows
[in] Number of rows in the output.
cols
[in] Number of columns in the output.
ndiag=0
[in] Index of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal.
Return Value
A matrix where all elements are equal to zero, except for the k-th diagonal, whose values are equal to one.
MQL5 example:
matrix eye=matrix::Eye(3, 3);
|
Python example:
np.eye(3, dtype=int)
|