No, don't need to change it. Just thought I'd note it as an easy way to
play with indptr.

You shouldn't use the `.T` there. The idea is that swapping a row of `X`
where `X` is CSR will swap a column of `X` if it happens to be CSC. So the
transpose is implicit.

I wouldn't bother defining `swap_csr_column`, just `swap_column`.


On 24 April 2014 22:58, Manoj Kumar <notifications@github.com> wrote:

>  In sklearn/utils/sparsefuncs.py:
>
> > +        n += X.shape[0]
> > +    if m > n:
> > +        m, n = n, m
> > +
> > +    indptr = X.indptr
> > +    indices = X.indices.copy()
> > +    data = X.data.copy()
> > +
> > +    nz_m = indptr[m + 1] - indptr[m]
> > +    nz_n = indptr[n + 1] - indptr[n]
> > +    m_ptr1 = indptr[m]
> > +    m_ptr2 = indptr[m + 1]
> > +    n_ptr1 = indptr[n]
> > +    n_ptr2 = indptr[n + 1]
> > +
> > +    # If non zero rows are equal in mth and nth row, then swapping becomes
>
> Great, do I need to change this too?
>
> Also for the swap_column case it is enough to do this right?
>
> def swap_csr_column(X, m, n):
>     return swap_csc_row(X.T, m, n)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/scikit-learn/scikit-learn/pull/3104/files#r11947285>
> .
>