He means matrix multiply.  * in MatLab is matrix multiply.

You should exclude the time required for generating the
random numbers.  e.g.

   6!:2 '(?256$0)+/ . *?256 312$0'
0.00416422
   x=: 256 [EMAIL PROTECTED] 0
   y=: 256 312 [EMAIL PROTECTED] 0
   6!:2 'x +/ .*y'
0.000503416

As well, use  [EMAIL PROTECTED] rather than ?x$y .  This makes a difference
especially when y is 2.  The idea for [EMAIL PROTECTED] is from k.

   ts=: 6!:2 , 7!:[EMAIL PROTECTED]
   ts '1e6 [EMAIL PROTECTED] 2'
0.00208853 1.04934e6
   ts '?1e6$2'
0.0127536 5.24352e6



----- Original Message -----
From: Devon McCormick <[EMAIL PROTECTED]>
Date: Thursday, November 8, 2007 11:03
Subject: Re: [Jprogramming] speed of matrix*vector operation.
To: Programming forum <[email protected]>

> If you really meant matrix multiply:
> 
>    6!:2 '(?256$0)+/ . *?256 312$0'
> 0.0180562
> 
> But, of course, this whole exercise is wrong-headed.  The 
> strength of J is
> not
> in timing comparisons of trivially simple arithmetic, it's in 
> the power and
> expressiveness
> of the notation.
> 
> > I told my friend about how nice J was.  Am I wrong?
> > >
> > > He said, how fast can you multiply a 1000x1000 matrix times
> > > a 1x1000 vector to get a 1x1000 resultant vector.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to