0

I am writing the program, but because the size of the matrix is too large, the RAM is insufficient and cannot calculate. Is there any other method to this? For example, can data be stored in virtual memory or HDD instead of RAM?

I am writing the program, but because the size of the matrix is too large, the RAM is insufficient and cannot calculate. Is there any other method to this?

kacar4206
  • 1
  • 1
  • 2
    Show your code. – Roman Ryzhiy Dec 01 '22 at 14:04
  • Are you maybe creating sub-matrices in this calculation? Can you instead find a way to do this in-place on your existing single matrix copy? – Hans Kesting Dec 01 '22 at 14:06
  • 1
    Memory is abstracted, you don't really know if you are in RAM or on disk or in a register. You might just need to build the program for x64 so you can address more memory. – Crowcoder Dec 01 '22 at 14:07
  • The age when individual programs were primarily concerned with the *physical* RAM was circa the 80s. On any modern OS, your program is going to be concerned with its *address space*. The details of how (some parts of) that space are mapped to either real RAM or pages of a file on disk are the *OS*'s concerns, not your program's. As Crowcoder says, provided you're targetting x64 you shouldn't exhaust your address space. – Damien_The_Unbeliever Dec 01 '22 at 14:11
  • (50000×50000)×64 = 160GB. Can you afford writing that to disk while your program runs (disk space and run time)? – BurnsBA Dec 01 '22 at 14:14
  • Looks to me as if your first goal should be how to split the problem into several significantly smaller ones (while staying mathematically correct). I am not familiar with GPU-Calculation outside the fact it exists, but I _guess_ that wouldn't save you neither. – Fildor Dec 01 '22 at 15:28
  • This might also help: https://stackoverflow.com/a/3140623/982149 – Fildor Dec 01 '22 at 15:32
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 01 '22 at 18:43

1 Answers1

0

maybe it's off topic, or I'm getting the question wrong, but if what you need is just the determinant, perhaps you could try to reduce first the matrix to a triangular matrix with Gauss reduction algorithm (https://en.wikipedia.org/wiki/Gaussian_elimination).

If memory is extremely limited you can write code that does that iterating on rows/columns, for each row memorizing the coefficent and accessing the single cells to modify.

Once your matrix is triangular you can just compute the numbers on the diagonal then to get the determinant, you can also tell the rank easly this way.

Mattia Mele
  • 129
  • 1
  • 6