Re: [Lapackpp-devel] How to write and read the matrix on hard disk efficiently?
Status: Beta
Brought to you by:
cstim
From: Christian S. <sti...@tu...> - 2006-03-12 13:59:46
|
Hi, Am Sonntag, 12. M=810=8A1rz 2006 06:52 schrieb Cheng Guo: > In my program, large LaGenMatDouble matrices will be wrote on the hard > disk frequently for later use. I know that the "<<" operator has been > overload to write the matrix to text files, but I think this would be > less efficient than to write/read the matrix to/from binary files.Does > directly writing the LaGenMatDouble matrix to a binary file saves all > the information about the matrix or otherwise how to write and read the > matrix on hard disk efficiently? I'm not sure what kind of "binary file writing" you expect. The operator<<(= )=20 has been overloaded so that writing the matrix to somewhere would work in t= he=20 first place -- if operator<<() didn't exist, writing a matrix would not wor= k=20 at all. So: A normal C++ class doesn't support any kind of "writing to file= ",=20 neither binary nor text. For you convenience LaGenMatDouble offers you the= =20 operator<< to write in text format to a file. If you additionally need to=20 write in binary format, you need to write your own method to do so. Shouldn= 't=20 be too difficult, though -- simply iterate over all matrix elements. But=20 there is no standard way to do this, so you need to come up with your own=20 binary format anyway. Again: No such thing currently exists in lapack++, so= =20 you have to write these methods on your own anyway. Christian |