Add Vector::ith_axis to build an unit vector with its i-th component set to 1.

This commit is contained in:
Crozet Sébastien 2020-10-25 11:25:38 +01:00
parent 55689c238a
commit 9c93a58b5d
1 changed files with 6 additions and 0 deletions

View File

@ -1019,6 +1019,12 @@ where
res
}
/// The column unit vector with `N::one()` as its i-th component.
#[inline]
pub fn ith_axis(i: usize) -> Unit<Self> {
Unit::new_unchecked(Self::ith(i, N::one()))
}
/// The column vector with a 1 as its first component, and zero elsewhere.
#[inline]
pub fn x() -> Self