在 Octave 中保存和加载矩阵的最快文件格式?
我有一个大约 11,000 x 1,000 的矩阵,保存为 csv。加载需要很长时间。
保存矩阵最快(或推荐)的格式是什么?
I have a matrix that is about 11,000 x 1,000, saved as a csv. It takes forever to load.
What is the fastest (or recommended) format to save matrices in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
数据从哪里来?
早在我读研究生时,我就在 C++ 程序中生成了模拟数据和结果。由于我拥有数据,因此我编写了一个例程,以 Octave 所需的二进制格式写入矩阵数据 --- 哪个点的读取速度非常快,因为它变成了一个
fread
调用。Where does the data come from?
Way back when I was in graduate school, I generated simulation data and results in a C++ program. As I owned the data, I wrote a routine to write the matrix data in the binary format expected by Octave --- and which point reading is pretty fast as it becomes a single
fread
call.不要忘记 -binary 选项。例如,
当我忘记使用 -binary 选项时,我的 80,000 x 402 双精度矩阵需要超过 22 分钟才能加载。使用 -binary 选项,花费的时间不到 2.5 秒。
Don't forget the -binary option. For example,
When I forgot to use the -binary option, my 80,000 x 402 matrix of doubles took more than 22 minutes to load. With the -binary option, it took less than 2.5 seconds.