Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Allow generators and iterators #194
Allow generators and iterators #194
Changes from 1 commit
10c5c2b
d3dd6e4
27699ff
e127fb4
948291d
243b7b0
8101bb3
8f44a30
c055d4d
0227942
9b34ed9
85cdb1b
46a91c2
8fb5108
5d04ff0
27994eb
6e4c09b
5b096d4
518fd3d
18f17af
8640d36
5be0415
4333bda
8219ad0
5402ed8
1350d47
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Something to note is that these methods are inconsistent with the ones treating
a
andb
as iterators of columns: a matrix of vectors will be treated differently from a vector of the same vectors. That's probably OK in practice, but that's one of the reasons why I'd like to move to requiring explicitly writingpairwise(d, eachol(a), eachcol(b))
in the longer term. That way we won't needdims
anymore.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.
That would be very nice, because it redirects the matrix-based method to the iterator-based method, and one could get rid of the matrix-based ones. The only issue I see is that for the specialized
*Euclidean
(and a few others) distances, where we do need the underlying matrix for performance reason, I don't seem to be able to unwrap it from theeachcol
generator.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.
Fortunately JuliaLang/julia#32310 should allow us to retrieve the underlying matrix!
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.
Yes, I looked at that one a bit today. Will they let it go into v1.6? I wonder how the ecosystem is going to adapt to v1.6 being the new LTS, and how fast packages will really drop 1.6- support. In many cases, there is no hard reason, only soft ones.
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.
Something to note is that these methods are inconsistent with the ones treating
a
andb
as iterators of columns: a matrix of vectors will be treated differently from a vector of the same vectors. That's probably OK in practice, but that's one of the reasons why I'd like to move to requiring explicitly writingpairwise(d, eachol(a), eachcol(b))
in the longer term. That way we won't needdims
anymore.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.
I'm not exactly sure I understand the inconsistency, actually. Could you please sketch an application case?
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.
For example,
pairwise(d, [a, b, c, d])
vs.pairwise(d, reshape([a, b, c, d], 2, 2))
witha
,b
,c
andd
vectors of numbers.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.
Ok, then I understood you correctly. Out of the two calls you mentioned, only the first one works. The second one fails because it treats
a
,b
,c
andd
like numbers, but then calls likeabs(a)
(or whatever necessary) fail.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.
Yes. But if we were fully consistent, the second call would be equivalent to the first one, since matrices are just one kind of iterator.