[Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Manoj Kumar
Hello, I am trying to add support for sparse matrices in RandomizedLasso. I'm stuck at this line. swap, nrm2 = linalg.get_blas_funcs(('swap', 'nrm2'), (X,)) When X is sparse. this fails with the following error. AttributeError, flags not found. Is this expected behaviour? Any help would be

Re: [Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Vlad Niculae
Hi Manoj, For efficiency, the BLAS api defines different functions for different underlying datatypes (float32, float64, complex64, complex128). The scipy get_blas_funcs utility has the role of getting the Python wrapper for the given BLAS functions (in this case 'swap' and 'nrm2', that's

Re: [Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Olivier Grisel
2014-03-18 19:56 GMT+01:00 Manoj Kumar manojkumarsivaraj...@gmail.com: Hello, I am trying to add support for sparse matrices in RandomizedLasso. I'm stuck at this line. swap, nrm2 = linalg.get_blas_funcs(('swap', 'nrm2'), (X,)) When X is sparse. this fails with the following error.

Re: [Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Olivier Grisel
2014-03-18 20:09 GMT+01:00 Olivier Grisel olivier.gri...@ensta.org: BLAS functions only work for contiguous (dense) arrays. You will need scipy sparse equivalent functions to work with CSR or CSC datastructures. For instance the `nrm2` function could be emulated by: row_norms =

Re: [Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Manoj Kumar
Hi Vlad and Oliver, Thanks a lot. On Wed, Mar 19, 2014 at 12:41 AM, Olivier Grisel olivier.gri...@ensta.orgwrote: 2014-03-18 20:09 GMT+01:00 Olivier Grisel olivier.gri...@ensta.org: BLAS functions only work for contiguous (dense) arrays. You will need scipy sparse equivalent functions

Re: [Scikit-learn-general] Query in Sparse matrices: scipy.linalg.get_blas_funcs()

2014-03-18 Thread Lars Buitinck
2014-03-18 20:09 GMT+01:00 Olivier Grisel olivier.gri...@ensta.org: I don't know how to efficiently swap 2 rows of a CSR matrix. Maybe the algorithm would have to be adapted a bit in the sparse case. Not familiar with the code but if swaps are common, you could keep an array of pointers or