pub fn triangular_mask_into_uninit<T: Copy + MaybeSendSync>(
output: &mut [MaybeUninit<T>],
input: &[T],
shape: &[usize],
k: i64,
upper: bool,
fill: T,
) -> Result<()>Expand description
Copy dense column-major matrices, replacing the masked triangle with fill.
The first two dimensions are rows and columns; remaining dimensions are
batches. upper=true keeps row <= column-k, otherwise the lower triangle.
Every output element is initialized on success; old output is never read.
§Examples
use core::mem::MaybeUninit;
let mut out = [MaybeUninit::uninit(); 4];
strided_basic::triangular_mask_into_uninit(
&mut out, &[1, 2, 3, 4], &[2, 2], 0, false, 0).unwrap();
// SAFETY: successful full-overwrite kernel initialized every element.
assert_eq!(out.map(|v| unsafe { v.assume_init() }), [1, 2, 0, 4]);§Errors
Returns RankMismatch, ShapeMismatch, or OffsetOverflow for invalid
shape/buffer lengths, before writing output.