diff --git a/Cargo.toml b/Cargo.toml index d3f632e2..2a3dbad9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ arbitrary = ["quickcheck"] [dependencies] rustc-serialize = "*" rand = "*" +num = "*" [dependencies.quickcheck] optional = true diff --git a/src/lib.rs b/src/lib.rs index 40b8ba7a..e028fcf7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,6 +85,7 @@ Feel free to add your project to this list if you happen to use **nalgebra**! #![cfg_attr(test, feature(test))] #![doc(html_root_url = "http://nalgebra.org/doc")] +extern crate num; extern crate rustc_serialize; extern crate rand; diff --git a/src/traits/structure.rs b/src/traits/structure.rs index 665ea071..2d284237 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -1,7 +1,7 @@ //! Traits giving structural informations on linear algebra objects or the space they live in. +use num::Float; use std::{f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize}; -use std::num::Float; use std::slice::{Iter, IterMut}; use std::ops::{Add, Sub, Mul, Div, Rem, Index, IndexMut}; use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute}; @@ -16,7 +16,8 @@ pub trait BaseNum: Copy + Zero + One + } /// Basic floating-point number numeric trait. -pub trait BaseFloat: Float + Cast + BaseNum { +/// (Note: Clone could be a constraint on BaseNum instead) +pub trait BaseFloat: Float + Clone + Cast + BaseNum { /// Archimedes' constant. fn pi() -> Self; /// 2.0 * pi.