开发者

Working with a giant matrix with Java

开发者 https://www.devze.com 2022-12-21 16:28 出处:网络
I hava read a related question here link text It was suggested there to work with a giant file and then use RandomAccessFile.

I hava read a related question here link text

It was suggested there to work with a giant file and then use RandomAccessFile.

My problem is that a matrix(consists of "0" and "1", not sparse) could be really huge. For example, a row size could be 10^10000. I need an efficient way to store such a matrix. Also, I need to work with such file (if I would store my matrix in it) in that way:

Say, I have a giant file which contains sequences of numbers. Numbers in a sequence are divided by ","(first number shows the raw number, remaining numbers show p开发者_StackOverflowlaces in matrix where "1"s stay). Sequences are divided by symbol "|". In addition, there is a symbol "||" which divide all of sequences into two groups. (that is a view of two matrixes. May be it is not efficient, but I don't know the way to make it better. Do you have any ideas? =) ) I have to read, for example, 100 numbers from an each row from a first group (extract a submatrix) and determine by them which rows I need to read from the second group. So I need the function seek(). Would it work with such a giant file?

I am a newbie. May be there are some efficient ways to store and read such a data?


There are about 10^80 atoms in the observable universe. So say you could store one bit in each atom, you need about 10^9920 universes about the same size as ours. Thats just to store one row.

How many rows were you condiering? You will need 10^9920 universes per row.


Hopefully you mean 10 000 entries and not 10^10000 Then you could use the BitSet class to store all in RAM (or you could use sth. like hadoop)

0

精彩评论

暂无评论...
验证码 换一张
取 消