Function russell_lab::update_matrix[][src]

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

Updates matrix based on another matrix (axpy)

b += α⋅a

Example

use russell_lab::*;
let a = Matrix::from(&[
    [10.0, 20.0, 30.0],
    [40.0, 50.0, 60.0],
]);
let mut b = Matrix::from(&[
    [10.0, 20.0, 30.0],
    [40.0, 50.0, 60.0],
]);
update_matrix(&mut b, 0.1, &a)?;
let correct = "┌          ┐\n\
               │ 11 22 33 │\n\
               │ 44 55 66 │\n\
               └          ┘";
assert_eq!(format!("{}", b), correct);