Function smartnoise_runtime::components::reshape::reshape[][src]

pub fn reshape<T: Clone>(
    data: &ArrayD<T>,
    symmetric: bool,
    layout: &Layout,
    shape: &[u32]
) -> Result<Vec<ArrayD<T>>>

Reshape an upper triangular matrix or dense matrix represented in one row, to a square matrix. One matrix is returned per row.

Arguments

Return

A vector of reshaped matrices, one matrix per row.

Example

use ndarray::{ArrayD, arr1, arr2};
use smartnoise_runtime::components::reshape::{reshape, Layout};
let data = arr2(&[ [false, false, true] ]).into_dyn();
let n = reshape(&data, true, &Layout::Row, &vec![2, 2]).unwrap();
assert_eq!(n[0], arr2(&[ [false, false], [false, true] ]).into_dyn());