[Jprogramming] speed of matrix*vector operation.
Roger Hui
rhui000 at shaw.ca
Fri Nov 9 03:15:05 HKT 2007
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 ?@$ 0
y=: 256 312 ?@$ 0
6!:2 'x +/ .*y'
0.000503416
As well, use x?@$y rather than ?x$y . This makes a difference
especially when y is 2. The idea for x?@$y is from k.
ts=: 6!:2 , 7!:2@]
ts '1e6 ?@$ 2'
0.00208853 1.04934e6
ts '?1e6$2'
0.0127536 5.24352e6
----- Original Message -----
From: Devon McCormick <devonmcc at gmail.com>
Date: Thursday, November 8, 2007 11:03
Subject: Re: [Jprogramming] speed of matrix*vector operation.
To: Programming forum <programming at jsoftware.com>
> 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.
More information about the Programming
mailing list