forked from M-Labs/nalgebra
Update to the last rust-nightly.
Version of rustc: 1.0.0-nightly (4874ca36f 2015-01-23 00:18:57 +0000).
This commit is contained in:
parent
713589ff50
commit
1b6a44e8fb
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nalgebra"
|
name = "nalgebra"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ] # FIXME: add the contributors.
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ] # FIXME: add the contributors.
|
||||||
|
|
||||||
description = "Linear algebra library for computer physics, computer graphics and general low-dimensional linear algebra for Rust."
|
description = "Linear algebra library for computer physics, computer graphics and general low-dimensional linear algebra for Rust."
|
||||||
|
@ -85,11 +85,11 @@ pub fn eigen_qr<N, V, VS, M>(m: &M, eps: &N, niter: usize) -> (M, V)
|
|||||||
// let mut shifter: M = Eye::new_identity(rows);
|
// let mut shifter: M = Eye::new_identity(rows);
|
||||||
|
|
||||||
let mut iter = 0us;
|
let mut iter = 0us;
|
||||||
for _ in (0 .. niter) {
|
for _ in (0us .. niter) {
|
||||||
let mut stop = true;
|
let mut stop = true;
|
||||||
|
|
||||||
for j in (0 .. ::dim::<M>()) {
|
for j in (0us .. ::dim::<M>()) {
|
||||||
for i in (0 .. j) {
|
for i in (0us .. j) {
|
||||||
if unsafe { eigenvalues.unsafe_at((i, j)) }.abs() >= *eps {
|
if unsafe { eigenvalues.unsafe_at((i, j)) }.abs() >= *eps {
|
||||||
stop = false;
|
stop = false;
|
||||||
break;
|
break;
|
||||||
|
@ -12,7 +12,7 @@ use std::mem;
|
|||||||
use structs::dvec::DVec;
|
use structs::dvec::DVec;
|
||||||
use traits::operations::{Inv, Transpose, Mean, Cov};
|
use traits::operations::{Inv, Transpose, Mean, Cov};
|
||||||
use traits::structure::{Cast, ColSlice, RowSlice, Diag, Eye, Indexable, Shape, Zero, One, BaseNum};
|
use traits::structure::{Cast, ColSlice, RowSlice, Diag, Eye, Indexable, Shape, Zero, One, BaseNum};
|
||||||
use std::fmt::{Show, Formatter, Result, String};
|
use std::fmt::{Show, Debug, Formatter, Result, String};
|
||||||
#[cfg(feature="arbitrary")]
|
#[cfg(feature="arbitrary")]
|
||||||
use quickcheck::{Arbitrary, Gen};
|
use quickcheck::{Arbitrary, Gen};
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ impl<N> DMat<N> {
|
|||||||
DMat {
|
DMat {
|
||||||
nrows: nrows,
|
nrows: nrows,
|
||||||
ncols: ncols,
|
ncols: ncols,
|
||||||
mij: (0 .. nrows * ncols).map(|i| { let m = i / nrows; f(i - m * nrows, m) }).collect()
|
mij: (0us .. nrows * ncols).map(|i| { let m = i / nrows; f(i - m * nrows, m) }).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ impl<N: Copy + Clone + Zero> Diag<DVec<N>> for DMat<N> {
|
|||||||
|
|
||||||
assert!(diag.len() == smallest_dim);
|
assert!(diag.len() == smallest_dim);
|
||||||
|
|
||||||
for i in (0 .. smallest_dim) {
|
for i in (0us .. smallest_dim) {
|
||||||
unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) }
|
unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ impl<N: Copy + Clone + Zero> Diag<DVec<N>> for DMat<N> {
|
|||||||
|
|
||||||
let mut diag: DVec<N> = DVec::new_zeros(smallest_dim);
|
let mut diag: DVec<N> = DVec::new_zeros(smallest_dim);
|
||||||
|
|
||||||
for i in (0 .. smallest_dim) {
|
for i in (0us .. smallest_dim) {
|
||||||
unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) }
|
unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ impl<N: ApproxEq<N>> ApproxEq<N> for DMat<N> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Show + Copy + String> Show for DMat<N> {
|
impl<N: Show + Copy + String> Debug for DMat<N> {
|
||||||
fn fmt(&self, form:&mut Formatter) -> Result {
|
fn fmt(&self, form:&mut Formatter) -> Result {
|
||||||
for i in (0us .. self.nrows()) {
|
for i in (0us .. self.nrows()) {
|
||||||
for j in (0us .. self.ncols()) {
|
for j in (0us .. self.ncols()) {
|
||||||
|
@ -58,7 +58,7 @@ impl<N> DVec<N> {
|
|||||||
/// Builds a vector filled with the result of a function.
|
/// Builds a vector filled with the result of a function.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn from_fn<F: FnMut(usize) -> N>(dim: usize, mut f: F) -> DVec<N> {
|
pub fn from_fn<F: FnMut(usize) -> N>(dim: usize, mut f: F) -> DVec<N> {
|
||||||
DVec { at: (0 .. dim).map(|i| f(i)).collect() }
|
DVec { at: (0us .. dim).map(|i| f(i)).collect() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -130,7 +130,7 @@ macro_rules! dvec_impl(
|
|||||||
fn axpy(&mut self, a: &N, x: &$dvec<N>) {
|
fn axpy(&mut self, a: &N, x: &$dvec<N>) {
|
||||||
assert!(self.len() == x.len());
|
assert!(self.len() == x.len());
|
||||||
|
|
||||||
for i in (0 .. x.len()) {
|
for i in (0us .. x.len()) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let self_i = self.unsafe_at(i);
|
let self_i = self.unsafe_at(i);
|
||||||
self.unsafe_set(i, self_i + *a * x.unsafe_at(i))
|
self.unsafe_set(i, self_i + *a * x.unsafe_at(i))
|
||||||
@ -486,7 +486,7 @@ macro_rules! small_dvec_from_impl (
|
|||||||
|
|
||||||
let mut at: [N; $dim] = [ $( $zeros, )* ];
|
let mut at: [N; $dim] = [ $( $zeros, )* ];
|
||||||
|
|
||||||
for i in (0 .. dim) {
|
for i in (0us .. dim) {
|
||||||
at[i] = f(i);
|
at[i] = f(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ macro_rules! diag_impl(
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn set_diag(&mut self, diag: &$tv<N>) {
|
fn set_diag(&mut self, diag: &$tv<N>) {
|
||||||
for i in (0 .. $dim) {
|
for i in (0us .. $dim) {
|
||||||
unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) }
|
unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ macro_rules! diag_impl(
|
|||||||
fn diag(&self) -> $tv<N> {
|
fn diag(&self) -> $tv<N> {
|
||||||
let mut diag: $tv<N> = ::zero();
|
let mut diag: $tv<N> = ::zero();
|
||||||
|
|
||||||
for i in (0 .. $dim) {
|
for i in (0us .. $dim) {
|
||||||
unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) }
|
unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user