Use new std::vec functions

This commit is contained in:
Jan Niklas Hasse 2013-12-16 12:04:02 +01:00
parent e25bac3565
commit 396d394ab9
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