[SciPy-User] Why doesn't dot product transpose?
Jason Rennie
jrennie at gmail.com
Sat Apr 23 14:25:30 EDT 2011
On Sat, Apr 23, 2011 at 1:19 PM, RJ Nowling <rnowling at gmail.com> wrote:
> As you pointed out, the simple answer is to use 1D arrays. We are
> using sparse matrices and want to perform dot products on the column
> vectors of those matrices. When I use csc_matrix.getcol() or
> matrix[:,1] syntax, a sparse 2D array is returned with shape (n, 1).
> It seems that my approach is getting the proper data structures for
> the dot product, as you pointed out.
>
The problem is that sparse matrices are just that, *matrices*. AFAIK, there
is no general sparse array structure. So, you may need to switch from
sparse to dense if you want shape=(n,) arrays. You can easily change
(dense) shapes with numpy.reshape().
> So, what's the correct way of getting a sparse shape (n,) column
> vector from a matrix? (E.g., we don't want to perform unnecessary
> operations by converting to dense representations.)
>
You can't AFAIK. What are you trying to do?
Jason
--
Jason Rennie
Research Scientist, ITA Software
617-714-2645
http://www.itasoftware.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110423/ee9e60ee/attachment.html>
More information about the SciPy-User
mailing list