qutip / qutip-cupy

CuPy linear-algebra backend for QuTiP
BSD 3-Clause "New" or "Revised" License
18 stars 10 forks source link

Rename data layer specialization functions to match QuTiP conventions #15

Closed hodgestar closed 3 years ago

hodgestar commented 3 years ago

Currently the specialization functions are named, e.g., cpd_add. Existing QuTiP data layer specializations are named with the function name first, e.g. add_dense.

We should rename the CuPy specializations to, e.g., add_cupydense.

jakelishman commented 3 years ago

Just for clarity, the naming scheme I used is:

In general, these don't actually matter too much, because they're largely not intended for direct public use - you can just query the dispatcher object to get the correct specialisation. It mattered more for the two core classes, which also need to be able to be used from Cython, where the full dispatcher mechanisms are bypassed.

MrRobot2211 commented 3 years ago

Is there any reason for the specialized construstors not to be named <constructor>_<typename>? E.g. diags_Dense

hodgestar commented 3 years ago

Is there any reason for the specialized construstors not to be named <constructor>_<typename>?

diags_cupydense looks good to me -- let's use the convention everywhere.

jakelishman commented 3 years ago

As much as there is one, the reason they didn't have it was because in my first pass at writing things, the constructors weren't exposed outside of Cython, and they'd be accessed with qualified access by csr.diags or dense.empty, etc; they used proper namespacing rather than "C namespacing", since they weren't really going to be called by the same functions. With multiple dispatch, the single namespacing like that no longer makes sense.

MrRobot2211 commented 3 years ago

This has been tackled in #10 . I am closing this one an opening one in QuTiP to change names.