简体   繁体   English

用Java在磁盘上写入大型矩阵的最快方法

[英]Fastest way to write huge matrices on disk with Java

I need to write huge matrices to disk. 我需要将巨大的矩阵写入磁盘。 I will have around one hundred matrices of 500.000 rows and 30 columns of double values. 我将有大约100个矩阵,包含500.000行和30列的double值。 The first column of this matrix will work as an ID. 此矩阵的第一列将用作ID。

Then i want to have an hash map or similar that for a given ID returns the pointer to the line in which that id is in my matrix on disk. 然后我想拥有一个哈希映射或类似的哈希表,对于给定的ID,返回指向该ID在磁盘矩阵中的行的指针。

To be clear I want to have an hash map that tell me in which position of the matrix is the line relative to that ID. 为了清楚起见,我想要一个散列图,告诉我相对于该ID的线在矩阵的哪个位置。

I don't want to write on a text file but use directly the memory with pointers to a particular position. 我不想在文本文件上写,而是直接将内存与指向特定位置的指针一起使用。 It's like an hashmap but that will not be deleted at the end of the program. 它就像一个哈希图,但不会在程序结束时删除。

I'm searching for the most efficient ways you think of doing this for read/write operations. 我正在寻找您想到的用于读/写操作的最有效方法。

I suggest using a RandomAccessFile and writing your own code for the rest. 我建议使用RandomAccessFile并为其余部分编写您自己的代码。 You can write pointers in the file to other parts of the file using your own code in combination with the provided methods. 您可以结合使用自己的代码和提供的方法,将文件中的指针写入文件的其他部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM