Skip to content

diff(A::SArray, [dim])? #84

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

Closed
wsshin opened this issue Dec 2, 2016 · 5 comments
Closed

diff(A::SArray, [dim])? #84

wsshin opened this issue Dec 2, 2016 · 5 comments

Comments

@wsshin
Copy link
Contributor

wsshin commented Dec 2, 2016

Is there a plan to implement diff(A::SArray, [dim])? This should be doable, because the size of the result can be predicted from size(A).

@andyferris
Copy link
Member

All the reducer and cumulative methods (and diff) require both size(A) and dim to infer the size, and unfortunately there is no way to get at the (probably constant value) dim during compilation time. If you want to do this on vectors, then no problem, but in general we have to do something a bit different.

I was thinking Val{dim} might make sense for these functions, in place of dim. Does this sound reasonable?

PS - We welcome PRs :)

@andyferris
Copy link
Member

See #65 for related discussion

@wsshin
Copy link
Contributor Author

wsshin commented Dec 6, 2016

Your answer in #65 is great. Thanks!

Yes, I think being able to pass Val{dim} will be useful. Motivated by your encouragement to do PR, I have actually implemented diff(::StaticArray{T,N}, ::Type{Val{D}}). Which source file do you think this function should go? Maybe mapreduce.jl?

@wsshin
Copy link
Contributor Author

wsshin commented Dec 12, 2016

Generated a PR: #86.

@andyferris
Copy link
Member

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants