Awesome!
On May 6, 2014 2:23 PM, "Jorge Cañardo Alastuey" <notifications@github.com>
wrote:

> In biom/_filter.pyx:
>
> > +from biom.exception import TableException
> > +
> > +
> > +cdef _zero_rows_CSR_or_columns_CSC(arr, cnp.ndarray[cnp.uint8_t, ndim=1] booleans, int axis):
> > +    """Zero out rows or columns for a matrix in CSR or CSC format
> > +    respectively."""
> > +    cdef Py_ssize_t m, n, row_or_col, j
> > +    cdef cnp.int32_t start, end
> > +    cdef cnp.ndarray[cnp.int32_t, ndim=1] indptr = arr.indptr
> > +    cdef cnp.ndarray[cnp.float64_t, ndim=1] data = arr.data
> > +    n = arr.shape[axis]
> > +    for row_or_col in range(n):
> > +        if booleans[row_or_col]:
> > +            continue
> > +        start, end = indptr[row_or_col], indptr[row_or_col+1]
> > +        for j in range(start, end):
>
> Good point! Turns out that calling arange ends up being up to 10 times
> slower (overhead of creating an array), but using slice syntax (data[start:end]
> = 0) is both fast and terse.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/biocore/biom-format/pull/318/files#r12346374>
> .
>