Open
Description
Description of the problem
We are starting off with implementing different backends for our APIs. C++ will be the first one to be implemented. We are planning to include both in our next release. Though not all APIs will be covered till the next release. However having as much as possible will be great. Following is a list of questions and task that needs to be considered for this issue,
- How to call C++ code from Python? - I am thinking to provide an optional keyword argument which will help in selecting the backend to be used. For example, in case of quick sort, the call would look like,
quick_sort(input_array, backend=pydatastructs.Backend.CPP)
orquick_sort(input_array, backend=pydatastructs.Backend.Cython)
. Ifbackend
parameter is not provided then, the most efficient backend will be used. For example,quick_sort
will automatically select the right backend according to the benchmarks we have. - File Structure - This mainly concerns to C++ backend. I am thinking to create one
.h
and.cpp
file for one API. For example,OneDimensionalArray
will be implemented in a different.cpp
file andMultiDimensionalArray
will be implemented in a different.cpp
file. Note both these kind of arrays are in the same python file. The reason for separating codes is to disconnect the API implementations internally. This will also help in reducing the binary size of each implementation. If compilation of one fails then that won't effect the usage of others. - Alternatives to
unordered_map
,unordered_set
for C++ backend. #438 - Build system to be used - I am leaning towards Meson as it's easier to deal with as compared to CMake, it's modern and is recently being adopted by libraries like SciPy.
- Add a
backend
option to all the APIs in PyDataStructs and default topydatastructs.Backend.Python
. #433
Example of the problem
References/Other comments
cc: @pratikgl