-
Notifications
You must be signed in to change notification settings - Fork 17
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
In-place "bang" versions of functions. #1
Conversation
Thanks, though I might modify this slightly: what if we were to use the same format as VML.jl, which uses an explicit output array: This can then also be used for 2-argument functions ( |
Yes, sounds like a good idea to have a unified interface. There is the caveat that I did not find any reference mentioning that it's ok to pass the input as output array. |
Actually it would be great to be as compatible as possible with similar frameworks, so that one might use one or the other as a drop-in replacement. |
Okay, I've just pushed a change, let me know what you think. I'll close this for now. |
Looks good. (There's a missing closing parenthesis on line 33.) Thanks! |
ah, thanks! |
How do you feel about not checking the input sizes? I feel it could be up to the user to make sure everything's fine when using a bang function. |
Hmm, I'm slightly hesitant, as it is only 1 check for the whole array, and it is so easy to get these things wrong. It would be useful to know the overhead: would you be able to profile it with and without the check? Alternatively, it would be nice if there was a way to use the |
Just using my code
and these are consistent across multiple runs. So it seems to be a 5% - 10% effect, which is not much. I suppose having a |
Hmm, that's more than I thought it would be, it also seems like a lot of extra allocation. Maybe I'll remove the checks for the time being and stick a big warning in the docs. |
This works great. Because I do not need the arrays after calculations, I added in-place "bang" versions of the functions. This keeps allocations down.