fixing style issues
This commit is contained in:
parent
d1a58f960c
commit
a213a3da93
@ -8,8 +8,8 @@ use std::cmp::min;
|
||||
|
||||
/// QR decomposition using Householder reflections
|
||||
/// # Arguments
|
||||
/// * `m` matrix to decompose
|
||||
pub fn decomp_qr<N: Clone + Num + Float>(m: &DMat<N>) -> (DMat<N>, DMat<N>) {
|
||||
/// * `m` - matrix to decompose
|
||||
pub fn decomp_qr<N: Clone + Float>(m: &DMat<N>) -> (DMat<N>, DMat<N>) {
|
||||
let rows = m.nrows();
|
||||
let cols = m.ncols();
|
||||
assert!(rows >= cols);
|
||||
@ -23,8 +23,8 @@ pub fn decomp_qr<N: Clone + Num + Float>(m: &DMat<N>) -> (DMat<N>, DMat<N>) {
|
||||
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<N: Clone + Num + Float>(m: &DMat<N>) -> (DMat<N>, DMat<N>) {
|
||||
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<DVec<N>>(ite, rows-ite, rows);
|
||||
let alpha =
|
||||
if unsafe { v.at_fast(ite) } >= Zero::zero() {
|
||||
-Norm::norm(&v)
|
||||
|
@ -94,13 +94,13 @@ pub trait Col<C> {
|
||||
/// Trait to access part of a column of a matrix
|
||||
pub trait ColSlice<C> {
|
||||
/// 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<R> {
|
||||
/// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user