![]() |
Sometimes it is necessary to store vector and/or matrices on disk, for instance for storing results or for sharing specific setups with other people. The Blaze math serialization module provides the according functionality to create platform independent, portable, binary representations of vectors and matrices that can be used to store the Blaze data structures without loss of precision and to reliably transfer them from one machine to another.
The following example demonstrates the (de-)serialization of dense and sparse vectors:
The (de-)serialization of vectors is not restricted to vectors of built-in data type, but can also be used for vectors with vector or matrix element type:
As the examples demonstrates, the vector serialization offers an enormous flexibility. However, several actions result in errors:
In case an error is encountered during (de-)serialization, a std::runtime_exception is thrown.