From 043d7ab108fe07bb9397e3040d0746d2ddb24b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Kal=C3=B8r?= Date: Thu, 27 Aug 2015 16:55:20 +0200 Subject: [PATCH] Fix wrong allocated vector length in RowSlice The length of the returned DVec should correspond to the the number of elements in the slice and not the number of rows in the matrix. --- src/structs/dmat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index d2c86acd..3a176398 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -559,7 +559,7 @@ impl RowSlice> for DMat { assert!(col_start < col_end); assert!(col_end <= self.ncols); let mut slice : DVec = unsafe { - DVec::new_uninitialized(self.nrows) + DVec::new_uninitialized(col_end - col_start) }; let mut slice_idx = 0; for col_id in col_start..col_end {