|
template<typename Archive , typename VT , bool TF> |
void | serialize (Archive &archive, const Vector< VT, TF > &vec) |
| Serializes the given vector and writes it to the archive. More...
|
|
template<typename Archive , typename VT > |
void | serializeHeader (Archive &archive, const VT &vec) |
| Serializes all meta information about the given vector. More...
|
|
template<typename Archive , typename VT , bool TF> |
void | serializeVector (Archive &archive, const DenseVector< VT, TF > &vec) |
| Serializes the elements of a dense vector. More...
|
|
template<typename Archive , typename VT , bool TF> |
void | serializeVector (Archive &archive, const SparseVector< VT, TF > &vec) |
| Serializes the elements of a sparse vector. More...
|
|
|
template<typename Archive , typename VT , bool TF> |
void | deserialize (Archive &archive, Vector< VT, TF > &vec) |
| Deserializes a vector from the given archive. More...
|
|
template<typename Archive , typename VT > |
void | deserializeHeader (Archive &archive, const VT &vec) |
| Deserializes all meta information about the given vector. More...
|
|
template<typename VT , bool TF> |
DisableIf_t< IsResizable_v< VT > > | prepareVector (DenseVector< VT, TF > &vec) |
| Prepares the given non-resizable dense vector for the deserialization process. More...
|
|
template<typename VT , bool TF> |
DisableIf_t< IsResizable_v< VT > > | prepareVector (SparseVector< VT, TF > &vec) |
| Prepares the given non-resizable sparse vector for the deserialization process. More...
|
|
template<typename VT > |
EnableIf_t< IsResizable_v< VT > > | prepareVector (VT &vec) |
| Prepares the given resizable vector for the deserialization process. More...
|
|
template<typename Archive , typename VT > |
void | deserializeVector (Archive &archive, VT &vec) |
| Deserializes a vector from the archive. More...
|
|
template<typename Archive , typename VT , bool TF> |
DisableIf_t< VT::simdEnabled > | deserializeDenseVector (Archive &archive, DenseVector< VT, TF > &vec) |
| Deserializes a dense vector from the archive. More...
|
|
template<typename Archive , typename VT , bool TF> |
EnableIf_t< VT::simdEnabled > | deserializeDenseVector (Archive &archive, DenseVector< VT, TF > &vec) |
| Deserializes a dense vector from the archive. More...
|
|
template<typename Archive , typename VT , bool TF> |
void | deserializeDenseVector (Archive &archive, SparseVector< VT, TF > &vec) |
| Deserializes a dense vector from the archive. More...
|
|
template<typename Archive , typename VT , bool TF> |
void | deserializeSparseVector (Archive &archive, DenseVector< VT, TF > &vec) |
| Deserializes a sparse vector from the archive. More...
|
|
template<typename Archive , typename VT , bool TF> |
void | deserializeSparseVector (Archive &archive, SparseVector< VT, TF > &vec) |
| Deserializes a sparse vector from the archive. More...
|
|
Serializer for dense and sparse vectors.
The VectorSerializer implements the necessary logic to serialize dense and sparse vectors, i.e. to convert them into a portable, binary representation. The following example demonstrates the (de-)serialization process of vectors:
{
archive << d << s;
}
{
archive >> d1;
archive >> d2
}
Binary archive for the portable serialization of data.
Definition: Archive.h:140
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
Efficient implementation of a fixed-sized vector.
Definition: StaticVector.h:230
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58
constexpr bool rowVector
Transpose flag for row vectors.
Definition: TransposeFlag.h:73
Note that it is even possible to (de-)serialize vectors with vector or matrix elements:
{
archive << vec;
}
{
archive >> vec;
}
As the examples demonstrates, the vector serialization offers an enormous flexibility. However, several actions result in errors:
- vectors cannot be reconstituted as matrices (and vice versa)
- the element type of the serialized and reconstituted vector must match, which means that on the source and destination platform the general type (signed/unsigned integral or floating point) and the size of the type must be exactly the same
- when reconstituting a StaticVector, its size must match the size of the serialized vector
In case an error is encountered during (de-)serialization, a std::runtime_exception is thrown.
template<typename
Archive , typename VT >
void blaze::VectorSerializer::deserializeHeader |
( |
Archive & |
archive, |
|
|
const VT & |
vec |
|
) |
| |
|
private |
Deserializes all meta information about the given vector.
- Parameters
-
archive | The archive to be read from. |
vec | The vector to be deserialized. |
- Returns
- void
- Exceptions
-
std::runtime_error | Error during deserialization. |
This function deserializes all meta information about the given vector contained in the header of the given archive. In case any error is detected during the deserialization process (for instance an invalid type of vector, element type, element size, or vector size) a std::runtime_error is thrown.