-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
RFC: Change iteratorsize trait of product(itr1, itr2)
#16437
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
removed old _size methods Fixed ambiguous methods
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -320,10 +320,8 @@ _prod_size(a, b, ::HasLength, ::HasLength) = (length(a), length(b)) | |
| _prod_size(a, b, ::HasLength, ::HasShape) = (length(a), size(b)...) | ||
| _prod_size(a, b, ::HasShape, ::HasLength) = (size(a)..., length(b)) | ||
| _prod_size(a, b, ::HasShape, ::HasShape) = (size(a)..., size(b)...) | ||
| _prod_size(a, b, A, ::Union{HasShape, HasLength}) = | ||
| throw(ArgumentError("Cannot compute size for object of type $(typeof(a))")) | ||
| _prod_size(a, b, ::Union{HasShape, HasLength}, B) = | ||
| throw(ArgumentError("Cannot compute size for object of type $(typeof(b))")) | ||
| _prod_size(a, b, A, B) = | ||
| throw(ArgumentError("Cannot construct size for objects of types $(typeof(a)) and $(typeof(b))")) | ||
|
|
||
| # one iterator | ||
| immutable Prod1{I} <: AbstractProdIterator | ||
|
|
@@ -417,12 +415,11 @@ end | |
|
|
||
| prod_iteratorsize(::Union{HasLength,HasShape}, ::Union{HasLength,HasShape}) = HasShape() | ||
| # products can have an infinite iterator | ||
| prod_iteratorsize(::IsInfinite, ::IsInfinite) = IsInfinite() | ||
| prod_iteratorsize(a, ::IsInfinite) = IsInfinite() | ||
| prod_iteratorsize(::IsInfinite, b) = IsInfinite() | ||
| prod_iteratorsize(a, b) = SizeUnknown() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one too, but this should be removed, because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that would be a special case. How would you handle the majority of cases where you have (finite nonzero size) * (infinite size) ? |
||
|
|
||
| _size(p::Prod2) = (length(p.a), length(p.b)) | ||
| _size(p::Prod) = (length(p.a), _size(p.b)...) | ||
|
|
||
| """ | ||
| IteratorND(iter, dims) | ||
|
|
@@ -443,7 +440,7 @@ immutable IteratorND{I,N} | |
| end | ||
| new{I,N}(iter, shape) | ||
| end | ||
| (::Type{IteratorND}){I<:AbstractProdIterator}(p::I) = IteratorND(p, _size(p)) | ||
| (::Type{IteratorND}){I<:AbstractProdIterator}(p::I) = IteratorND(p, size(p)) | ||
| end | ||
|
|
||
| start(i::IteratorND) = start(i.iter) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is ambiguous