From 85a943b7ef8003328325c8f327a2d3d5f8cd2116 Mon Sep 17 00:00:00 2001 From: shivshank Date: Wed, 9 Jan 2019 21:48:03 -0500 Subject: [PATCH] Rewrite to_homogenous for vectors to use push --- src/base/matrix.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 172e293f..38f7241f 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -832,14 +832,7 @@ impl, S: Storage> Vector { #[inline] pub fn to_homogeneous(&self) -> VectorN> where DefaultAllocator: Allocator> { - let len = self.len(); - let hnrows = DimSum::::from_usize(len + 1); - let mut res = unsafe { VectorN::::new_uninitialized_generic(hnrows, U1) }; - res.generic_slice_mut((0, 0), self.data.shape()) - .copy_from(self); - res[(len, 0)] = N::zero(); - - res + self.push(N::zero()) } /// Constructs a vector from coordinates in projective space, i.e., removes a `0` at the end of