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]
pub unsafe fn new_uninitialized(nrows: uint, ncols: uint) -> DMat<N> {
let mut vec = vec::with_capacity(nrows * ncols);
vec::raw::set_len(&mut vec, nrows * ncols);
vec.set_len(nrows * ncols);
DMat {
nrows: nrows,
@ -244,7 +244,7 @@ impl<N: Clone> DMat<N> {
/// Just like `at` without bounds checking.
#[inline]
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> {
/// Indexing without bounds checking.
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]
pub unsafe fn new_uninitialized(dim: uint) -> DVec<N> {
let mut vec = vec::with_capacity(dim);
vec::raw::set_len(&mut vec, dim);
vec.set_len(dim);
DVec {
at: vec