@Pauli, changing the order of the INSTANTIATE_ALL definition by putting npy_bool_wrapper first actually did fix things :) I'm not sure why order matters here, yet. But there is a comment just above this definition that states: /* * Order is important here, list int before float, float before * double, scalar before complex, etc. */ And since order does matter, having npy_bool_wrapper first probably is not optimal. So I'm trying to figure the relevance of ordering these things and what a proper order should be. Anyway, now I can use the toarray method with dtype=bool sparse matrices. I also ran scipy.sparse.test.test_base.py and got FAILED (SKIP=122,errors=16) the same number as before. So it doesn't seem like I broke anything new, but the test suite doesn't really do cross dtype checking. On Thu, May 30, 2013 at 11:52 AM, Pauli Virtanen <pav@iki.fi> wrote:
Blake Griffith <blake.a.griffith <at> gmail.com> writes:
Hello, I'm working on adding support for the bool dtype for sparse matrices. But I'm having some problems
I'm adding a wrapper for the npy_bool type. I've included a file called bool_ops.h which basically contains:
typedef npy_int8 npy_bool_wrapper;
This will potentially not be enough for SWIG to treat bool wrapper output values as a separate type, it might have to be a separate class. So it's best to stick to the complex types recipe if you don't exactly know what you are doing.
The order of instantiation and type maps should not matter.
One way to check what is going on is to look into the SWIG generated cxx files. Does bool_wrapper appear there in the same way as the complex types? The generated output is quite crazy and difficult to understand, but if you don't see bool wrapper anywhere, then something is not done correctly on the swig level.
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev