matrix calculation error

前端 未结 3 1184
梦谈多话
梦谈多话 2021-01-29 05:22

I am using R tool to calculate SVD (svd(m)) and it works on small matrix but as I pass it 20Kx20X matrix. After processing, it gives the following erro

3条回答
  •  梦毁少年i
    2021-01-29 05:27

    If you're storing doubles that are 8 bytes, 20Kx20K means 8*20,000*20,000/1024/1024 ~ 3GB of RAM to hold the whole thing in memory.

    I don't know how much RAM you've got available, but I'd look into what R can do to serialize the matrix out to disk as needed.

    Is the matrix sparse or banded? Can you do something to decrease the amount of memory you need?

    How large is the null space for you matrix? What's the condition number (ratio of largest-to-smallest eigenvalue)? A large condition number can be an indication of difficulties in solving. A matrix need not have a zero row or column to be nearly singular.

    UPDATE:

    Based on your comment, I'd say that RAM is the least of your problems. Sounds like it's possible to hold the entire matrix in memory - if you can address it all. You can address the entire matrix. You're running on a 64-bit OS - is your version of R 64-bit as well?

    Unfortunately, one of the byproducts of SVD is to get the size of the null space.

    You can get the minimum eigenvalue for your matrix using Jacobi iteration. Lanczos might be a good choice for getting the maximum eigenvalue. It'd be a lot of work to get all of them; you might just want the five smallest and largest to assess.

    Anytime I experience an error with some software I immediately paste it into a Google search. At least it's comforting to know that I'm not the first to experience a particular problem:

    http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=Error+in+svd(m)+:+infinite+or+missing+values+in+'x'

提交回复
热议问题