From 9c93a58b5d648697806075dc2cc41cf33cf33464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Sun, 25 Oct 2020 11:25:38 +0100 Subject: [PATCH] Add Vector::ith_axis to build an unit vector with its i-th component set to 1. --- src/base/construction.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/base/construction.rs b/src/base/construction.rs index f810acdf..aa4cf956 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -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 { + 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