Function russell_lab::copy_matrix[][src]

pub fn copy_matrix(b: &mut Matrix, a: &Matrix) -> Result<(), &'static str>
Expand description

Copies matrix

b := a

Example

use russell_lab::*;
let a = Matrix::from(&[
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
]);
let mut b = Matrix::from(&[
    [-1.0, -2.0, -3.0],
    [-4.0, -5.0, -6.0],
]);
copy_matrix(&mut b, &a)?;
let correct = "┌       ┐\n\
               │ 1 2 3 │\n\
               │ 4 5 6 │\n\
               └       ┘";
assert_eq!(format!("{}", b), correct);