I got accepted to Google Summer of Code! Thank you everyone who has helped me get this far, and Amber for making me a congratulatory google cake!
On my proposal timeline I gave myself 2 weeks to add support to sparse matrices
dtype=bool. So far,
dtype=bool works implementation was not too hard,
and most of my time was spent figuring out how SWIG works.
However there is still a lot of work to do in testing bool support. This will
be more time consuming than it should be because the sparse test suite is
bool dtype implementation
sparsetools/ directory contains several
files. The header files (
*.h) contain C++ routines these are wrapped by SWIG
according to instructions in the
*.i interface files. SWIG uses the header
and interface files to generate python
*.py files C++ code in
*.cxx files are compiled and linked the functions they define can
be called by the generated
Where do I add bool support?
sparsetools/ is a file called
complex_ops.h which translates
numpy's complex types to C++ classes. Well, that is what I want to do, except
for numpy's bool types instead! My new file
bool_ops.h is much simpler
though. It basically does
typedef npy_int8 npy_bool_wrapper;
Yep that's it, (for now anyway). This file basically says to treat the
npy_bool_wrapper type like the
npy_int8. Because boolean algebra is almost
npy_bool_wrapper is used in
numpy.i to define a
typemap from numpy's
npy_bool type to our
sparsetools.i we have to declare the new data type and add it to the
INSTANTIATE_ALL macro which is used in all the *.i files to call the
functions we want from the *.h files.
sputils.py prevents it from upcast.
Then tests need to be added, but this isn't too easy. The test suite does not
have a way to take some general data or dtype. So I am going through adding
tests one-by-one where it seems appropriate. I'm also trying to add tests for
other dtypes because there don't seem to be any tests for anything other than
float64 and int64.
While I was doing this I discovered a few
bugs relating to how sparse
Once I'm done adding tests and fixing what ever does not pass, I'll move on to the next stage in my proposal. Adding support for boolean operations.