eye

Construct a new slice with ones along a diagonal and zeroes elsewhere of element type E.

The diagonal is set through the interaction of dimension and k. k determines the offset of the diagonal and dimension controls the dimension of that this offset proceeds in. For instance, if dimension = 1 and k = 1, then the diagonal after the first column is what is filled with ones.

  1. auto eye(size_t m, size_t n, size_t k)
    template eye(E = double, size_t dimension = 1)
    pure
    eye
    (
    size_t m
    ,
    size_t n = 0
    ,
    size_t k = 0
    )
  2. auto eye(size_t m, size_t n, size_t k)

Members

Functions

eye
auto eye(size_t m, size_t n, size_t k)
Undocumented in source. Be warned that the author may not have intended to support it.

Parameters

dimension

axis to apply k offset

m

number of rows of output

n

number of columns of output (default = 0, sets n = m)

k

offset for start of diagonal (default = 0)

Return Value

new eye slice

Meta