a:53072 194 # 1f<o:p></o:p>
b: 194 1 # 1f<o:p></o:p>
<o:p> </o:p>
\t sum each (a*:b)<o:p></o:p>
2521j<o:p></o:p>
<o:p> </o:p>
\t a $ b<o:p></o:p>
80j<o:p></o:p>
<o:p> </o:p>
\t a mmu b<o:p></o:p>
80j<o:p></o:p>
<o:p> </o:p>
It would be good to see a comparison with R, Python or matlab.<o:p></o:p>
<o:p> </o:p>
Kim<o:p></o:p>
<o:p> </o:p>
Von: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] Im Auftrag von Terry Lynch
Gesendet: Sonntag, 13. März 2016 18:20
An: Kdb+ Personal Developers
Betreff: Re: [personal kdb+] Dot product of two matrices<o:p></o:p>
<o:p> </o:p>
$ performs dot product on floats: http://code.kx.com/wiki/Reference/DollarSign<o:p></o:p>
<o:p> </o:p>
a:53072 194 # 1f<o:p></o:p>
b: 194 1 # 1f<o:p></o:p>
<o:p> </o:p>
q)\ts res1:sum each (a*:b)<o:p></o:p>
1569 386039648<o:p></o:p>
q)\ts res2:a$b<o:p></o:p>
78 1960624<o:p></o:p>
q)res1~res2<o:p></o:p>
1b<o:p></o:p>
<o:p> </o:p>
Terry<o:p></o:p>
<o:p> </o:p>
On Sun, Mar 13, 2016 at 12:59 PM, Krishna Kumar <kumar.ramanathan@gmail.com> wrote:<o:p></o:p>
Hi, <o:p></o:p>
I have a matrix of 53072X194(53072 rows, 194 columns) and another vector, 194X1.<o:p></o:p>
I’m using the following to get the dot product of the two : <o:p></o:p>
a:53072 194 # 1<o:p></o:p>
b: 194 1 # 1<o:p></o:p>
(Just as examples, the above values)<o:p></o:p>
dotProduct : sum each (a*:b)<o:p></o:p>
I get the correct value, but it takes a long time, is there a more efficient approach to do this?<o:p></o:p>
<o:p> </o:p>
Thanks, <o:p></o:p>
Kumar<o:p></o:p>
–
Submitted via Google Groups