ones_like

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

pure
ones_like
(
S
)
()

Parameters

slice S

n-dimensional slice to refer shape and element type

Return Value

Type: auto

new ones slice

Examples

import mir.ndslice.topology : iota;

//  -------
// | 0 1 2 |
// | 3 4 5 |
//  -------
auto e = iota(2, 3);

assert(e.ones_like == ones(2, 3));

Meta