5
5
6
6
use std:: collections:: TreeMap ;
7
7
use std:: io:: { Command , File , IoResult , Process } ;
8
- use std:: num;
8
+ use std:: num:: { Float , mod } ;
9
9
use std:: str:: { MaybeOwned , mod} ;
10
10
11
11
use data:: Matrix ;
@@ -177,18 +177,19 @@ impl Figure {
177
177
/// 
178
178
///
179
179
/// ```
180
- /// # extern crate num ;
180
+ /// # extern crate complex ;
181
181
/// # extern crate simplot;
182
182
/// # fn main() {
183
183
/// # use std::io::{fs, USER_RWX};
184
- /// use num ::Complex;
184
+ /// use complex ::Complex;
185
185
/// use simplot::axis::{BottomX, LeftY, Logarithmic, RightY};
186
186
/// use simplot::color::{DarkViolet, Rgb};
187
187
/// use simplot::curve::Lines;
188
188
/// use simplot::grid::Major;
189
189
/// use simplot::key::{Center, Inside, Top};
190
190
/// use simplot::{BottomXRightY, Figure, logspace};
191
191
/// use std::f64::consts::PI;
192
+ /// use std::num::Float;
192
193
///
193
194
/// fn tf(x: f64) -> Complex<f64> {
194
195
/// Complex::new(0., x) / Complex::new(10., x) / Complex::new(1., x / 10_000.)
@@ -197,7 +198,7 @@ impl Figure {
197
198
/// let (start, end) = (1.1, 90_000.);
198
199
/// let xs = logspace(start, end, 101);
199
200
/// let phase = xs.map(|x| tf(x).arg() * 180. / PI);
200
- /// let magnitude = xs.map(|x| tf(x).norm ());
201
+ /// let magnitude = xs.map(|x| tf(x).abs ());
201
202
///
202
203
/// # fs::mkdir_recursive(&Path::new("target/doc/simplot"), USER_RWX).unwrap();
203
204
/// # assert_eq!(Some(String::new()),
@@ -351,6 +352,7 @@ impl Figure {
351
352
/// use simplot::curve::{Impulses, LinesPoints, Steps};
352
353
/// use simplot::key::{Inside, Left, Top};
353
354
/// use simplot::{Circle, Dash, Figure, linspace};
355
+ /// use std::num::FloatMath;
354
356
///
355
357
/// let xs = linspace::<f64>(-10., 10., 51);
356
358
///
@@ -429,6 +431,7 @@ impl Figure {
429
431
/// use simplot::key::{Outside, Right, Top};
430
432
/// use simplot::{Figure, FilledCircle, linspace};
431
433
/// use std::f64::consts::PI;
434
+ /// use std::num::FloatMath;
432
435
/// use std::rand::{Rng, mod};
433
436
///
434
437
/// fn sinc(mut x: f64) -> f64 {
@@ -510,6 +513,7 @@ impl Figure {
510
513
/// use simplot::{Figure, linspace};
511
514
/// use std::f64::consts::PI;
512
515
/// use std::iter;
516
+ /// use std::num::Float;
513
517
///
514
518
/// let (start, end) = (-5., 5.);
515
519
/// let xs = linspace(start, end, 101);
@@ -757,7 +761,7 @@ trait Script {
757
761
pub fn linspace < T > ( start : T , end : T , n : uint ) -> Linspace < T > where T : Float {
758
762
let step = if n < 2 {
759
763
// NB The value of `step` doesn't matter in these cases
760
- num :: zero ( )
764
+ Float :: zero ( )
761
765
} else {
762
766
( end - start) / num:: cast ( n - 1 ) . unwrap ( )
763
767
} ;
@@ -771,13 +775,13 @@ pub fn linspace<T>(start: T, end: T, n: uint) -> Linspace<T> where T: Float {
771
775
}
772
776
773
777
pub fn logspace < T > ( start : T , end : T , n : uint ) -> Logspace < T > where T : Float {
774
- assert ! ( start > num :: zero( ) && end > num :: zero( ) ) ;
778
+ assert ! ( start > Float :: zero( ) && end > Float :: zero( ) ) ;
775
779
776
780
let ( start, end) = ( start. ln ( ) , end. ln ( ) ) ;
777
781
778
782
let step = if n < 2 {
779
783
// NB The value of `step` doesn't matter in these cases
780
- num :: zero ( )
784
+ Float :: zero ( )
781
785
} else {
782
786
( end - start) / num:: cast ( n - 1 ) . unwrap ( )
783
787
} ;
0 commit comments