Merge pull request #2 from jhasse/patch-vec

Use new std::vec functions
This commit is contained in:
Sébastien Crozet 2013-12-16 07:52:36 -08:00
commit a69e25c453
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ impl<N> DMat<N> {
#[inline] #[inline]
pub unsafe fn new_uninitialized(nrows: uint, ncols: uint) -> DMat<N> { pub unsafe fn new_uninitialized(nrows: uint, ncols: uint) -> DMat<N> {
let mut vec = vec::with_capacity(nrows * ncols); let mut vec = vec::with_capacity(nrows * ncols);
vec::raw::set_len(&mut vec, nrows * ncols); vec.set_len(nrows * ncols);
DMat { DMat {
nrows: nrows, nrows: nrows,
@ -244,7 +244,7 @@ impl<N: Clone> DMat<N> {
/// Just like `at` without bounds checking. /// Just like `at` without bounds checking.
#[inline] #[inline]
pub unsafe fn at_fast(&self, row: uint, col: uint) -> N { pub unsafe fn at_fast(&self, row: uint, col: uint) -> N {
vec::raw::get(self.mij, self.offset(row, col)) (*self.mij.unsafe_ref(self.offset(row, col))).clone()
} }
} }

View File

@ -52,7 +52,7 @@ impl<N: Zero + Clone> DVec<N> {
impl<N: Clone> DVec<N> { impl<N: Clone> DVec<N> {
/// Indexing without bounds checking. /// Indexing without bounds checking.
pub unsafe fn at_fast(&self, i: uint) -> N { pub unsafe fn at_fast(&self, i: uint) -> N {
vec::raw::get(self.at, i) (*self.at.unsafe_ref(i)).clone()
} }
} }
@ -80,7 +80,7 @@ impl<N> DVec<N> {
#[inline] #[inline]
pub unsafe fn new_uninitialized(dim: uint) -> DVec<N> { pub unsafe fn new_uninitialized(dim: uint) -> DVec<N> {
let mut vec = vec::with_capacity(dim); let mut vec = vec::with_capacity(dim);
vec::raw::set_len(&mut vec, dim); vec.set_len(dim);
DVec { DVec {
at: vec at: vec