use na::Scalar; use crate::aliases::{TMat, TVec}; /// The `index`-th column of the matrix `m`. /// /// # See also: /// /// * [`row()`] /// * [`set_column()`] /// * [`set_row()`] pub fn column( m: &TMat, index: usize, ) -> TVec { m.column(index).into_owned() } /// Sets to `x` the `index`-th column of the matrix `m`. /// /// # See also: /// /// * [`column()`] /// * [`row()`] /// * [`set_row()`] pub fn set_column( m: &TMat, index: usize, x: &TVec, ) -> TMat { let mut res = m.clone(); res.set_column(index, x); res } /// The `index`-th row of the matrix `m`. /// /// # See also: /// /// * [`column()`] /// * [`set_column()`] /// * [`set_row()`] pub fn row( m: &TMat, index: usize, ) -> TVec { m.row(index).into_owned().transpose() } /// Sets to `x` the `index`-th row of the matrix `m`. /// /// # See also: /// /// * [`column()`] /// * [`row()`] /// * [`set_column()`] pub fn set_row( m: &TMat, index: usize, x: &TVec, ) -> TMat { let mut res = m.clone(); res.set_row(index, &x.transpose()); res }