Minor codding style fixes.

This commit is contained in:
Sébastien Crozet 2015-08-09 14:39:45 +02:00
parent a14393be43
commit 2091cd8da6

View File

@ -133,12 +133,12 @@ pub fn cholesky<N, V, VS, M>(m: &M) -> Result<M, &'static str>
return Err("Cholesky: Input matrix is not symmetric"); return Err("Cholesky: Input matrix is not symmetric");
} }
for i in 0..out.nrows() { for i in 0 .. out.nrows() {
for j in 0..(i+1) { for j in 0 .. (i + 1) {
let mut sum: N = out[(i,j)]; let mut sum: N = out[(i, j)];
for k in 0..j { for k in 0 .. j {
sum = sum - out[(i, k)] * out[(j, k)]; sum = sum - out[(i, k)] * out[(j, k)];
} }
@ -146,7 +146,7 @@ pub fn cholesky<N, V, VS, M>(m: &M) -> Result<M, &'static str>
out[(i, j)] = sum / out[(j, j)]; out[(i, j)] = sum / out[(j, j)];
} }
else if sum > N::zero() { else if sum > N::zero() {
out[(i,i)] = sum.sqrt(); out[(i, i)] = sum.sqrt();
} }
else { else {
return Err("Cholesky: Input matrix is not positive definite to machine precision"); return Err("Cholesky: Input matrix is not positive definite to machine precision");
@ -154,11 +154,10 @@ pub fn cholesky<N, V, VS, M>(m: &M) -> Result<M, &'static str>
} }
} }
for i in 0..out.nrows() { for i in 0 .. out.nrows() {
for j in i+1..out.ncols() { for j in i + 1 .. out.ncols() {
out[(i,j)] = N::zero(); out[(i, j)] = N::zero();
} }
} }
return Ok(out); return Ok(out);