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