Fwd: Re: improved Matrix.times()


Sender: nxo@Cs.Nott.AC.UK
Subject: Re: improved Matrix.times()


Dear Marcell,

I would like to know, can the huge matrices handles 100,000 (of rows and 
columns) times 100,000 (of rows and columns)?

Please, I'm looking for matrices method that can handle Single Value 
Decomposition a matrix of 100 thousands rows and columns.


Many Thanks,
Nas.



On May 21 2008, Marcell Missura wrote:

> After trying to multiply two huge matrices and running out of heap memory
> I suggest to juice up the times(Matrix) method of the Matrix class with
> the following few lines to avoid creating a massive amount of garbage on
> the heap that needs to be collected.
> 
> public Matrix times(Matrix B)
> {
>         if (B.m != n)
>                 throw new IllegalArgumentException("Matrix inner
> dimensions must agree.");
> 
>         Matrix C = new Matrix(m, B.n);
> 
>         for (int i = 0; i < m; i++)
>                 for (int j = 0; j < B.n; j++)
>                         for (int k = 0; k < n; k++)
>                                 C.A[i][j] += A[i][k] * B.A[k][j];
> 
>         return C;
> }
> 
> 
> 
> 
> 
> 

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



----- End forwarded message -----





Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov