Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement std::iter::{Sum, Product} #11

Merged
merged 4 commits into from
Mar 6, 2018
Merged

Conversation

termoshtt
Copy link
Contributor

Resolve #3

  • Implement Sum<Complex<T>> and Sum<&Complex<T>> using Zero + AddAssign
  • Implement Product<Complex<T>> and Product<&Complex<T>> using One + MulAssign

Num and NumAssign are used for type constraint.

@termoshtt
Copy link
Contributor Author

error: no associated item named `new` found for type `std::collections::hash_map::DefaultHasher` in the current scope
    --> src/lib.rs:1162:22
     |
1162 |     let mut hasher = <RandomState as BuildHasher>::Hasher::new();
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I met this error with 1.12.0. I will use 1.14.0 like #7

@cuviper
Copy link
Member

cuviper commented Jan 11, 2018

Thanks - I'll need to hold this PR until I'm ready to make breaking changes.

@termoshtt
Copy link
Contributor Author

I see the num-complex 0.2 milestone, where these two issues are listed. Is there another issue to be included in num-complex 0.2 ?

@cuviper
Copy link
Member

cuviper commented Jan 11, 2018

Maybe also #6 for no_std, after rust-num/num-traits#16.

@termoshtt
Copy link
Contributor Author

I guess the no_std feature of num-traits will take a long time...
IMHO, we bump up version to 0.2 with the current two issues, and postpone the no_std feature to 0.3. What do you think about it?

@cuviper
Copy link
Member

cuviper commented Jan 13, 2018

I'd rather work it out and bump only once in a long while.

termoshtt and others added 4 commits March 6, 2018 13:44
Folding can be faster for some iterators, and this way we also don't
need to require `NumAssign`.
@cuviper
Copy link
Member

cuviper commented Mar 6, 2018

Rebased, then I made it use folds instead. Thanks for the PR!

bors r+

bors bot added a commit that referenced this pull request Mar 6, 2018
11: Implement std::iter::{Sum, Product} r=cuviper a=termoshtt

Resolve #3 

- Implement `Sum<Complex<T>>` and `Sum<&Complex<T>>` using `Zero` + `AddAssign`
- Implement `Product<Complex<T>>` and `Product<&Complex<T>>` using `One` + `MulAssign`

`Num` and `NumAssign` are used for type constraint.
@bors
Copy link
Contributor

bors bot commented Mar 6, 2018

Build succeeded

@bors bors bot merged commit eaf7010 into rust-num:master Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants