Thanks Mikera, for the detailed response. I tested the element-wise product
on two sparse matrix.. it seems to run through the entire matrix ? Am I
missing something.

Regards,
Sunil

On Wed, Feb 17, 2016 at 7:47 AM, Mikera <mike.r.anderson...@gmail.com>
wrote:

> Hi Sunil,
>
> You are correct that the naive code will eagerly produce the full matrix
> UxV, which may be very large :-)
>
> I think your strategy of extracting rows and columns from U and V is the
> best one. Row and column extraction for dense matrices in vectorz-clj is
> very efficient since it just uses strided vectors, as is the dot product
> operation, so you probably won't see much of a performance overhead from
> doing it this way. I wouldn't worry about the verbosity - obviously you
> should encapsulate this logic in a function if you are doing it in many
> places.
>
> Top tip: also remember to use (non-zero-indices W) if you want to know
> which elements of the sparse matrix are non-zero without iterating over
> every element
>
>   Mike.
>
>
> On Tuesday, 16 February 2016 23:17:52 UTC+8, Sunil Nandihalli wrote:
>>
>> Hi Everybody,
>>  I am newbie to core.matrix .. I have the following expression
>>
>> W -> a large spare matrix of size MxN
>> U  -> a dense matrix of size         MxK
>> V ->  a dense matrix of size         KxN
>>
>> and K << (M,N)
>> (require [clojure.core.matrix :as m])
>>
>> I want to compute (m/mul W (m/* U V))
>>
>> m/mul computes element-wise product
>>
>> m/*      computes regular matrix multiplication
>>
>> I want to know if the above would compute full-matrix UV .. if it does
>> then I want to know if there is an elegant way to compute the
>> spare-resultant matrix without blowing up memory in the intermediate stage
>>
>> I am currently just extracting the corresponding rows and columns from U
>> and V for the elements which are non-zero in W .. but that seems
>> unnecessarily verbose...
>>
>> I am using the vectorz implementation of core.matrix
>>
>> Thanks in advance.
>>
>> Sunil.
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to