You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to figure out a consistent naming convention for routines that return the result in-place, as many routines will have two versions: in-place (e.g., eig_inplace) and out-of-place (e.g. eig). I think a good idea is to have the out-of-place version the default (eig), and have special naming convention for in-place (eig_inplace or some of the other option from the list below).
I couldn't find any naming convention how NumPy and Matlab does it. Looks like only Julia has a naming convention for in-place?
Certain functions in SciPy (perhaps also NumPy, but I couldn't find any) accept some logical arguments if they should overwrite the inputs or not. Take solve for instance:
For MATLAB I found this old blog post (https://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/#8) which says that some of the built-in functions already obey in-place semantics (e.g. A=max(A,B) will not create an intermediate variable). Users can take advantage of this in their own functions (hoping the MATLAB JIT will do the right thing):
functiony= myfunc(x)
y = sin(2*x.^2+3*x+4);
functionx= myfuncIP(x)
x = sin(2*x.^2+3*x+4);
We need to figure out a consistent naming convention for routines that return the result in-place, as many routines will have two versions: in-place (e.g.,
eig_inplace
) and out-of-place (e.g.eig
). I think a good idea is to have the out-of-place version the default (eig
), and have special naming convention for in-place (eig_inplace
or some of the other option from the list below).This was originally discussed at #10 (comment). List of options for syntax (#10 (comment)):
eig_inplace
eig_i
oreig_I
eigI
I'll update this list if more candidates are proposed.
A lot of people like
eig_inplace
. It's long, but presumably it won't be used as often aseig
, and it is clear what it does.Other languages:
I couldn't find any naming convention how NumPy and Matlab does it. Looks like only Julia has a naming convention for in-place?
Julia
out-of-place: svd
in-place: svd!
The text was updated successfully, but these errors were encountered: