null/empty seems fine


On Mon, Oct 28, 2013 at 2:46 PM, Jai Ram Rideout
<notifications@github.com>wrote:

> In biom/backends/scipysparse.py:
>
> > +        """
> > +        dense_vec = asarray(vec._matrix.todense())
> > +
> > +        if vec.shape == (1, 1):
> > +            # Handle the special case where we only have a single element, but
> > +            # we don't want to return a numpy scalar / 0-d array. We still want
> > +            # to return a vector of length 1.
> > +            return dense_vec.reshape(1)
> > +        else:
> > +            return squeeze(dense_vec)
> > +
> > +    def __init__(self, num_rows, num_cols, dtype=float, data=None):
> > +        # I hate myself for having the empty special case throughout the
> > +        # code... makes it much less elegant. However, scipy doesn't support
> > +        # empty (i.e., 0x0) sparse matrices, but we do.
> > +        if num_rows == 0 and num_cols == 0:
>
> It seems that the latest scipy (0.13.0) handles these border cases but
> earlier versions do not. The 0x1 and 1x0 cases will also fail, so I'll need
> to update the code to handle the case where either of the dimensions are 0.
>
> Do we want to treat a 0x0, 1x0, and 0x1 matrix the same way? i.e. as a
> null/empty matrix
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/biom-format/biom-format/pull/227/files#r7262713>
> .
>