Older version of Matlab, using Symbolic Toolbox (Mapple)

» h = sym(hilb(5))
 
h =
 
[   1, 1/2, 1/3, 1/4, 1/5]
[ 1/2, 1/3, 1/4, 1/5, 1/6]
[ 1/3, 1/4, 1/5, 1/6, 1/7]
[ 1/4, 1/5, 1/6, 1/7, 1/8]
[ 1/5, 1/6, 1/7, 1/8, 1/9]
 
» h * inv(h)
 
ans =
 
[ 1, 0, 0, 0, 0]
[ 0, 1, 0, 0, 0]
[ 0, 0, 1, 0, 0]
[ 0, 0, 0, 1, 0]
[ 0, 0, 0, 0, 1]
 
Works up to 30 increasingly slow and on
40 gives segmentation fault.


--- Roger Hui <[EMAIL PROTECTED]> wrote:

> How about asking your friend to invert the 40 by 40 Hilbert 
> matrix in MatLab?  This is how you can do it in J:
> 
>    h =: % 1 + +/~ i.40x
>    h1=: %. h
>    h +/ .* h1  NB. verify that it's the identity matrix
> 
> 
> 
> ----- Original Message -----
> From: [EMAIL PROTECTED]
> Date: Thursday, November 8, 2007 10:13
> Subject: [Jprogramming] speed of matrix*vector operation.
> To: [email protected]
> 
> > 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.
> >
> > his MatLab code ran in about .6 seconds.
> >
> > His code follows..
> >
> > matrix = randn(312,256);
> > vector = randn(256,1);
> >
> > tic
> > for i = 1:1000
> >     output = matrix*vector;
> > end
> > toc
> >
> > I wrote my code which runs in about 2.5 minutes
> >
> > here is my code:
> >
> > #!/home/efittery/bin/jconsole
> >
> > A =: 256 312 $ 1+ i. 312 * 256x
> > B =: 312   1 $ 1+ i. 312x
> >
> > jumbo =: monad define
> >     for. i. y do.
> >         yVector =: A +/ .* B
> >     end.
> >     )
> >
> > jumbo 1000
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to