Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 33

Thread: Multiplying very large matrices

  1. #11
    Join Date
    Jul 2005
    Beans
    1,535
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Multiplying very large matrices

    I second WW's advice. I have personally used the Colt (http://acs.lbl.gov/~hoschek/colt/) and it is very good. You will hear a lot of people complain about the slower performance of java, but the Colt group has managed to write a BLAS implementation that is 90% as fast as FORTRAN.
    When I invented the Web, I didn't have to ask anyone's permission.
    ~Tim Berners-Lee on Net Neutrality
    -------------------------------------
    Visit the Ubuntu Programming IRC-channel at #ubuntu-programming (chat.freenode.net).

  2. #12
    Join Date
    Jul 2007
    Beans
    10

    Re: Multiplying very large matrices

    Quote Originally Posted by PaulM1985 View Post
    Hi


    I agree that opening and reading the files is probably the cause of the problem. I am currently storing the matrix files on a USB memory stick and running the program on there so that my hard disk doesnt have to do the creating/deleting of large files. Is there a way that I could use the USB stick as additional RAM memory?

    Paul
    Paul, USB sick memory is very slow. Slower than disk. And it has a limited number of writes (it's flash). If you have to use files, use disk files.

    --Mark

  3. #13
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Multiplying very large matrices

    Also, you should not be using the naive method, there are better ones...

    http://en.wikipedia.org/wiki/Matrix_...ion#Algorithms

    (But I second the advice of using something from a library...)

  4. #14
    Join Date
    Jun 2007
    Location
    The Fiery Desert
    Beans
    141
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Multiplying very large matrices

    If you can use Python, then try NumPy, which is made specifically for dealing with matrices and arrays in an efficient manner. I haven't dealt with sets quite as huge as yours, but I've processed data sets with about 200,000 lines and eight columns of data, and while it wasn't super-fast, it certainly faithfully crunched through it without errors. NumPy is also in the Ubuntu repos.

    A library is likely to be implementing one of those algorithms for improved efficiency.
    Die writing: I write crazy things
    PhD Wander: I write crazy things about my travels
    RedScout: Lenovo 3000 C100, 1.5GHz Celeron M, 1.25GB RAM, 120GB HDD

  5. #15
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Multiplying very large matrices

    Quote Originally Posted by Erdaron View Post
    If you can use Python, then try NumPy, ...A library is likely to be implementing one of those algorithms for improved efficiency.
    NumPy is python binding for C libraries, used in scientific calculations. Speed would unlikely be issue there.

  6. #16
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Multiplying very large matrices

    haskell can do matrix multiplication faster than C ...

    what I would recommend is converting the second matrix so that rows are vertical and columns are horizontal, then you can read the rows you want using readline, multiply them and write them out to a file.
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  7. #17
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: Multiplying very large matrices

    Hi

    Thanks with the advice using the -Xmx512m, but unfortunately I ran out of memory again, because I have to have a couple of other large matrices in memory for singular value decomposition.

    I am using the USB stick because I didn't want to have any damage to my hard disk because of large scale writing and deleting.

    I don't know Python, but know a bit of C. Would you recommend using C instead of Java. Would I be able to read and write to files as I am already doing?

    Any other general advice?

    Thanks

    Paul

  8. #18
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: Multiplying very large matrices

    Quote Originally Posted by slavik View Post
    haskell can do matrix multiplication faster than C ...

    what I would recommend is converting the second matrix so that rows are vertical and columns are horizontal, then you can read the rows you want using readline, multiply them and write them out to a file.

    Hi Slavik

    Thanks for the idea but that was something I had thought of and tried originally. Unfortunately, it was still taking a very long time to compute.

    Paul

  9. #19
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Multiplying very large matrices

    Quote Originally Posted by PaulM1985 View Post
    I am using the USB stick because I didn't want to have any damage to my hard disk because of large scale writing and deleting.
    Seriously now... this is the least of your concerns. Reading and writing are what hard drives are built to do, and throughout their lifetime, your matrix ops are a drop in the ocean...

  10. #20
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: Multiplying very large matrices

    The only reason I am concerned is that I have had to replace 2 hard disks on my laptop in the past and so I don't really want to have to get a 3rd.

Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •