numir.core.creation

Various slice creation (e.g., zeros, ones, zeros_like, diag)

Members

Functions

arange
auto arange(size_t size)

Returns a 1-dimensional slice whose elements are equal to its indices.

arange
auto arange(E start, E end, E step)

Returns a 1-dimensional slice whose elements are equal to its indices.

diag
auto diag(S s)

Create a diagonal 2-dimensional slice from a 1-dimensional slice.

empty
auto empty(size_t[N] length)

Construct new uninitialized slice of element type E and shape(length ...).

empty_like
auto empty_like(S slice)

Construct new empty slice having the same element type and shape to given slice.

eye
auto eye(size_t m, size_t n, size_t k)

Returns a double eye slice.

identity
auto identity(size_t n)

Returns a square slice of element type E with ones on the main diagonal and zeros elsewhere.

like
auto like(S slice)

Construct new slice having the same element type and shape to given slice.

linspace
auto linspace(E start, E stop, size_t num)

Returns a slice with evenly spaced numbers over an interval.

logspace
auto logspace(E start, E stop, size_t num, E base)

Returns a slice with numbers evenly spaced over a log scale.

ones
auto ones(size_t[N] lengths)

Construct a new slice, filled with ones, of element type E and shape(lengths ...).

ones_like
auto ones_like(S slice)

Construct new ones slice having the same element type and shape to given slice.

steppedIota
auto steppedIota(size_t num, E step, E start)

An alternate, 1-dimensional version of iota (and different API).

zeros
auto zeros(size_t[N] lengths)

Construct a new slice, filled with zeroes, of element type E and shape(lengths ...).

zeros_like
auto zeros_like(S slice)

Construct new zeroes slice having the same element type and shape to given slice.

Templates

diag
template diag(size_t dimension = 1)

Extract the diagonal of a 2-dimensional slice.

eye
template eye(E = double, size_t dimension = 1)

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

Meta