Bump to 0.1.6
This commit is contained in:
parent
431dd18aff
commit
bfa91ee92a
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "num"
|
name = "num"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
authors = ["The Rust Project Developers"]
|
authors = ["The Rust Project Developers"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
homepage = "https://github.com/rust-lang/num"
|
homepage = "https://github.com/rust-lang/num"
|
||||||
|
|
|
@ -59,7 +59,6 @@ use Integer;
|
||||||
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::iter::{AdditiveIterator, MultiplicativeIterator};
|
|
||||||
use std::num::FromStrRadix;
|
use std::num::FromStrRadix;
|
||||||
use std::num::{Int, ToPrimitive, FromPrimitive};
|
use std::num::{Int, ToPrimitive, FromPrimitive};
|
||||||
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
||||||
|
@ -852,20 +851,6 @@ impl FromStrRadix for BigUint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator<Item = BigUint>> AdditiveIterator<BigUint> for T {
|
|
||||||
fn sum(self) -> BigUint {
|
|
||||||
let init: BigUint = Zero::zero();
|
|
||||||
self.fold(init, |acc, x| acc + x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Iterator<Item = BigUint>> MultiplicativeIterator<BigUint> for T {
|
|
||||||
fn product(self) -> BigUint {
|
|
||||||
let init: BigUint = One::one();
|
|
||||||
self.fold(init, |acc, x| acc * x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BigUint {
|
impl BigUint {
|
||||||
/// Creates and initializes a `BigUint`.
|
/// Creates and initializes a `BigUint`.
|
||||||
///
|
///
|
||||||
|
@ -1554,20 +1539,6 @@ impl<R: Rng> RandBigInt for R {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator<Item = BigInt>> AdditiveIterator<BigInt> for T {
|
|
||||||
fn sum(self) -> BigInt {
|
|
||||||
let init: BigInt = Zero::zero();
|
|
||||||
self.fold(init, |acc, x| acc + x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Iterator<Item = BigInt>> MultiplicativeIterator<BigInt> for T {
|
|
||||||
fn product(self) -> BigInt {
|
|
||||||
let init: BigInt = One::one();
|
|
||||||
self.fold(init, |acc, x| acc * x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BigInt {
|
impl BigInt {
|
||||||
/// Creates and initializes a BigInt.
|
/// Creates and initializes a BigInt.
|
||||||
///
|
///
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
//! Complex numbers.
|
//! Complex numbers.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::num::FloatMath;
|
use std::num::Float;
|
||||||
use std::iter::{AdditiveIterator, MultiplicativeIterator};
|
|
||||||
use std::ops::{Add, Div, Mul, Neg, Sub};
|
use std::ops::{Add, Div, Mul, Neg, Sub};
|
||||||
|
|
||||||
use {Zero, One, Num};
|
use {Zero, One, Num};
|
||||||
|
@ -76,7 +75,7 @@ impl<T: Clone + Num> Complex<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone + FloatMath> Complex<T> {
|
impl<T: Clone + Float> Complex<T> {
|
||||||
/// Calculate |self|
|
/// Calculate |self|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn norm(&self) -> T {
|
pub fn norm(&self) -> T {
|
||||||
|
@ -84,7 +83,7 @@ impl<T: Clone + FloatMath> Complex<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone + FloatMath + Num> Complex<T> {
|
impl<T: Clone + Float + Num> Complex<T> {
|
||||||
/// Calculate the principal Arg of self.
|
/// Calculate the principal Arg of self.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn arg(&self) -> T {
|
pub fn arg(&self) -> T {
|
||||||
|
@ -252,24 +251,6 @@ impl<T: fmt::Show + Num + PartialOrd + Clone> fmt::Show for Complex<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T> AdditiveIterator<Complex<A>> for T
|
|
||||||
where A: Clone + Num, T: Iterator<Item = Complex<A>>
|
|
||||||
{
|
|
||||||
fn sum(self) -> Complex<A> {
|
|
||||||
let init: Complex<A> = Zero::zero();
|
|
||||||
self.fold(init, |acc, x| acc + x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<A, T> MultiplicativeIterator<Complex<A>> for T
|
|
||||||
where A: Clone + Num, T: Iterator<Item = Complex<A>>
|
|
||||||
{
|
|
||||||
fn product(self) -> Complex<A> {
|
|
||||||
let init: Complex<A> = One::one();
|
|
||||||
self.fold(init, |acc, x| acc * x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![feature(old_orphan_check)]
|
|
||||||
|
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
@ -45,9 +43,6 @@
|
||||||
//!
|
//!
|
||||||
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
|
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
|
||||||
|
|
||||||
#![feature(associated_types)]
|
|
||||||
#![feature(macro_rules)]
|
|
||||||
#![feature(default_type_params)]
|
|
||||||
#![feature(slicing_syntax)]
|
#![feature(slicing_syntax)]
|
||||||
#![cfg_attr(test, deny(warnings))]
|
#![cfg_attr(test, deny(warnings))]
|
||||||
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||||
|
|
|
@ -17,7 +17,6 @@ use std::fmt;
|
||||||
use std::ops::{Add, Div, Mul, Neg, Rem, Sub};
|
use std::ops::{Add, Div, Mul, Neg, Rem, Sub};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::num::{FromPrimitive, FromStrRadix, Float};
|
use std::num::{FromPrimitive, FromStrRadix, Float};
|
||||||
use std::iter::{AdditiveIterator, MultiplicativeIterator};
|
|
||||||
|
|
||||||
use bigint::{BigInt, BigUint, Sign};
|
use bigint::{BigInt, BigUint, Sign};
|
||||||
use {Num, Signed, Zero, One};
|
use {Num, Signed, Zero, One};
|
||||||
|
@ -456,25 +455,6 @@ impl<T: FromStrRadix + Clone + Integer + PartialOrd>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T> AdditiveIterator<Ratio<A>> for T
|
|
||||||
where A: Clone + Integer + PartialOrd, T: Iterator<Item = Ratio<A>>
|
|
||||||
{
|
|
||||||
fn sum(self) -> Ratio<A> {
|
|
||||||
let init: Ratio<A> = Zero::zero();
|
|
||||||
self.fold(init, |acc, x| acc + x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<A, T> MultiplicativeIterator<Ratio<A>> for T
|
|
||||||
where A: Clone + Integer + PartialOrd, T: Iterator<Item = Ratio<A>>
|
|
||||||
{
|
|
||||||
fn product(self) -> Ratio<A> {
|
|
||||||
let init: Ratio<A> = One::one();
|
|
||||||
self.fold(init, |acc, x| acc * x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue