Function jamml::initializers::fn_mat

source ·
pub fn fn_mat<T: NumAssign + Copy, F: Fn() -> T>(
    m: usize,
    n: usize,
    f: F
) -> Mat<T>
Expand description

Creates a m by n matrix of by using function f to determine each element.

f shound be a function that takes no arguments and return T

let x = fn_mat(4, 2, ||{2*4});
let y = vec![vec![8, 8],
             vec![8, 8],
             vec![8, 8],
             vec![8, 8]];
assert_eq!(x, y);