diff --git a/src/linalg/decompositions.rs b/src/linalg/decompositions.rs index 0c957682..47409224 100644 --- a/src/linalg/decompositions.rs +++ b/src/linalg/decompositions.rs @@ -8,8 +8,8 @@ use std::cmp::min; /// QR decomposition using Householder reflections /// # Arguments -/// * `m` matrix to decompose -pub fn decomp_qr(m: &DMat) -> (DMat, DMat) { +/// * `m` - matrix to decompose +pub fn decomp_qr(m: &DMat) -> (DMat, DMat) { let rows = m.nrows(); let cols = m.ncols(); assert!(rows >= cols); @@ -23,8 +23,8 @@ pub fn decomp_qr(m: &DMat) -> (DMat, DMat) { for j in range(start, rows) { for i in range(start, rows) { unsafe { - let vv = vec.at_fast(i-start)*vec.at_fast(j-start); - let qkij = qk.at_fast(i,j); + let vv = vec.at_fast(i - start) * vec.at_fast(j - start); + let qkij = qk.at_fast(i, j); qk.set_fast(i, j, qkij - vv - vv); } } @@ -32,11 +32,10 @@ pub fn decomp_qr(m: &DMat) -> (DMat, DMat) { qk }; - let iterations = min(rows-1, cols); + let iterations = min(rows - 1, cols); for ite in range(0u, iterations) { let mut v = r.col_slice(ite, ite, rows); - //let mut v = r.col_slice>(ite, rows-ite, rows); let alpha = if unsafe { v.at_fast(ite) } >= Zero::zero() { -Norm::norm(&v) diff --git a/src/traits/structure.rs b/src/traits/structure.rs index eb86190a..953f13b9 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -94,13 +94,13 @@ pub trait Col { /// Trait to access part of a column of a matrix pub trait ColSlice { /// Returns a view to a slice of a column of a matrix. - fn col_slice(&self, col_id :uint, row_start: uint, row_end: uint) -> C; + fn col_slice(&self, col_id: uint, row_start: uint, row_end: uint) -> C; } /// Trait to access part of a row of a matrix pub trait RowSlice { /// Returns a view to a slice of a row of a matrix. - fn row_slice(&self, row_id :uint, col_start: uint, col_end: uint) -> R; + fn row_slice(&self, row_id: uint, col_start: uint, col_end: uint) -> R; } /// Trait of objects having a spacial dimension known at compile time.