forked from M-Labs/nalgebra
commit
1945cb09f2
@ -66,7 +66,7 @@ impl<N: Zero + Clone> DMat<N> {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
for mij in self.mij.mut_iter() {
|
for mij in self.mij.iter_mut() {
|
||||||
*mij = Zero::zero();
|
*mij = Zero::zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ impl<N: Clone> Indexable<(uint, uint), N> for DMat<N> {
|
|||||||
unsafe fn unsafe_set(&mut self, rowcol: (uint, uint), val: N) {
|
unsafe fn unsafe_set(&mut self, rowcol: (uint, uint), val: N) {
|
||||||
let (row, col) = rowcol;
|
let (row, col) = rowcol;
|
||||||
let offset = self.offset(row, col);
|
let offset = self.offset(row, col);
|
||||||
*self.mij.as_mut_slice().unsafe_mut_ref(offset) = val
|
*self.mij.as_mut_slice().unsafe_mut(offset) = val
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads the value of a component of the matrix.
|
/// Reads the value of a component of the matrix.
|
||||||
@ -369,7 +369,6 @@ Inv for DMat<N> {
|
|||||||
|
|
||||||
let dim = self.nrows;
|
let dim = self.nrows;
|
||||||
let mut res: DMat<N> = Eye::new_identity(dim);
|
let mut res: DMat<N> = Eye::new_identity(dim);
|
||||||
let _0T: N = Zero::zero();
|
|
||||||
|
|
||||||
// inversion using Gauss-Jordan elimination
|
// inversion using Gauss-Jordan elimination
|
||||||
for k in range(0u, dim) {
|
for k in range(0u, dim) {
|
||||||
@ -380,7 +379,7 @@ Inv for DMat<N> {
|
|||||||
let mut n0 = k; // index of a non-zero entry
|
let mut n0 = k; // index of a non-zero entry
|
||||||
|
|
||||||
while n0 != dim {
|
while n0 != dim {
|
||||||
if unsafe { self.unsafe_at((n0, k)) } != _0T {
|
if unsafe { self.unsafe_at((n0, k)) } != Zero::zero() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,6 @@ macro_rules! inv_impl(
|
|||||||
|
|
||||||
fn inv(&mut self) -> bool {
|
fn inv(&mut self) -> bool {
|
||||||
let mut res: $t<N> = One::one();
|
let mut res: $t<N> = One::one();
|
||||||
let _0N: N = Zero::zero();
|
|
||||||
|
|
||||||
// inversion using Gauss-Jordan elimination
|
// inversion using Gauss-Jordan elimination
|
||||||
for k in range(0u, $dim) {
|
for k in range(0u, $dim) {
|
||||||
@ -453,7 +452,7 @@ macro_rules! inv_impl(
|
|||||||
let mut n0 = k; // index of a non-zero entry
|
let mut n0 = k; // index of a non-zero entry
|
||||||
|
|
||||||
while n0 != $dim {
|
while n0 != $dim {
|
||||||
if self.at((n0, k)) != _0N {
|
if self.at((n0, k)) != Zero::zero() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ impl<N: 'static> Iterable<N> for vec::Vec0<N> {
|
|||||||
impl<N: 'static> IterableMut<N> for vec::Vec0<N> {
|
impl<N: 'static> IterableMut<N> for vec::Vec0<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
|
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
|
||||||
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).mut_iter() }
|
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).iter_mut() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user