use na::{Scalar, DefaultAllocator}; use traits::{Alloc, Dimension}; use aliases::{Vec, Mat}; /// The `index`-th column of the matrix `m`. pub fn column(m: &Mat, index: usize) -> Vec where DefaultAllocator: Alloc { m.column(index).into_owned() } /// Sets to `x` the `index`-th column of the matrix `m`. pub fn set_column(m: &Mat, index: usize, x: &Vec) -> Mat where DefaultAllocator: Alloc { let mut res = m.clone(); res.set_column(index, x); res } /// The `index`-th row of the matrix `m`. pub fn row(m: &Mat, index: usize) -> Vec where DefaultAllocator: Alloc { m.row(index).into_owned().transpose() } /// Sets to `x` the `index`-th row of the matrix `m`. pub fn set_row(m: &Mat, index: usize, x: &Vec) -> Mat where DefaultAllocator: Alloc { let mut res = m.clone(); res.set_row(index, &x.transpose()); res }