35 #ifndef _BLAZE_MATH_SERIALIZATION_VECTORSERIALIZER_H_ 36 #define _BLAZE_MATH_SERIALIZATION_VECTORSERIALIZER_H_ 170 template<
bool IsDenseVector >
171 struct VectorValueMappingHelper;
183 template<
typename T >
184 struct VectorValueMapping
186 enum { value = VectorValueMappingHelper< IsDenseVector<T>::value >::value };
212 template<
typename Archive,
typename VT,
bool TF >
220 template<
typename Archive,
typename VT,
bool TF >
229 template<
typename Archive,
typename VT >
232 template<
typename Archive,
typename VT,
bool TF >
235 template<
typename Archive,
typename VT,
bool TF >
243 template<
typename Archive,
typename VT >
246 template<
typename VT,
bool TF >
249 template<
typename VT,
bool TF >
252 template<
typename VT >
255 template<
typename Archive,
typename VT >
258 template<
typename Archive,
typename VT,
bool TF >
262 template<
typename Archive,
typename VT,
bool TF >
266 template<
typename Archive,
typename VT,
bool TF >
269 template<
typename Archive,
typename VT,
bool TF >
272 template<
typename Archive,
typename VT,
bool TF >
363 archive << uint8_t ( VectorValueMapping<VT>::value );
364 archive << uint8_t ( TypeValueMapping<ET>::value );
365 archive << uint8_t (
sizeof( ET ) );
367 archive << uint64_t( IsDenseVector<VT>::value ? vec.size() : vec.nonZeros() );
390 while( ( i < (~vec).
size() ) && ( archive << (~vec)[i] ) ) {
417 while( ( element != (~vec).
end() ) &&
418 ( archive << element->index() << element->value() ) ) {
486 else if( (
type_ & 1U ) != 0U || (
type_ & (~3U) ) != 0U ) {
511 template<
typename VT
526 template<
typename VT
542 template<
typename VT >
545 vec.resize (
size_,
false );
570 else if(
type_ == 2U ) {
603 while( ( i !=
size_ ) && ( archive >> value ) ) {
633 if(
size_ == 0UL )
return;
634 archive.read( &(~vec)[0],
size_ );
665 while( ( i !=
size_ ) && ( archive >> value ) ) {
700 while( ( i !=
number_ ) && ( archive >> index >> value ) ) {
701 (~vec)[index] = value;
735 while( ( i !=
number_ ) && ( archive >> index >> value ) ) {
736 (~vec).append( index, value,
false );
760 struct VectorSerializer::VectorValueMappingHelper<true>
773 struct VectorSerializer::VectorValueMappingHelper<false>
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
void serialize(Archive &archive, const Vector< VT, TF > &vec)
Serializes the given vector and writes it to the archive.
Definition: VectorSerializer.h:336
Header file for auxiliary alias declarations.
uint64_t size_
The size of the vector.
Definition: VectorSerializer.h:284
Binary archive for the portable serialization of data.The Archive class implements the functionality ...
Definition: Archive.h:141
Header file for basic type definitions.
Header file for the SparseVector base class.
T Type
The instantiated type.
Definition: DisableIf.h:99
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Serializer for dense and sparse vectors.The VectorSerializer implements the necessary logic to serial...
Definition: VectorSerializer.h:153
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
8-bit unsigned integer type of the Blaze library.
Header file for the DenseVector base class.
void deserializeVector(Archive &archive, VT &vec)
Deserializes a vector from the archive.
Definition: VectorSerializer.h:565
void deserializeHeader(Archive &archive, const VT &vec)
Deserializes all meta information about the given vector.
Definition: VectorSerializer.h:476
void serializeVector(Archive &archive, const DenseVector< VT, TF > &vec)
Serializes the elements of a dense vector.
Definition: VectorSerializer.h:387
uint8_t version_
The version of the archive.
Definition: VectorSerializer.h:280
#define BLAZE_THROW_RUNTIME_ERROR(MESSAGE)
Macro for the emission of a std::runtime_error exception.This macro encapsulates the default way of B...
Definition: Exception.h:379
Header file for the DisableIf class template.
void serializeHeader(Archive &archive, const VT &vec)
Serializes all meta information about the given vector.
Definition: VectorSerializer.h:358
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
uint8_t elementSize_
The size in bytes of a single element of the vector.
Definition: VectorSerializer.h:283
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
Header file for the EnableIf class template.
64-bit unsigned integer type of the Blaze library.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
typename EnableIfTrue< Condition, T >::Type EnableIfTrue_
Auxiliary type for the EnableIfTrue class template.The EnableIfTrue_ alias declaration provides a con...
Definition: EnableIf.h:138
void deserialize(Archive &archive, Vector< VT, TF > &vec)
Deserializes a vector from the given archive.
Definition: VectorSerializer.h:448
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a N-dimensional vector type...
Definition: Vector.h:61
Header file for run time assertion macros.
VectorSerializer()
The default constructor of the VectorSerializer class.
Definition: VectorSerializer.h:303
Conversion from a data type to a serial representation.This class template converts the given data ty...
Definition: TypeValueMapping.h:163
uint64_t number_
The total number of elements contained in the vector.
Definition: VectorSerializer.h:285
uint8_t type_
The type of the vector.
Definition: VectorSerializer.h:281
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Header file for the IsDenseVector type trait.
void deserializeSparseVector(Archive &archive, DenseVector< VT, TF > &vec)
Deserializes a sparse vector from the archive.
Definition: VectorSerializer.h:692
Header file for the TypeValueMapping class template.
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
DisableIfTrue< VT::simdEnabled >::Type deserializeDenseVector(Archive &archive, DenseVector< VT, TF > &vec)
Deserializes a dense vector from the archive.
Definition: VectorSerializer.h:596
DisableIf_< IsResizable< VT > > prepareVector(DenseVector< VT, TF > &vec)
Prepares the given non-resizable dense vector for the deserialization process.
Definition: VectorSerializer.h:513
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:177
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Constraint on the data type.
Header file for the IsResizable type trait.
Header file for the Vector CRTP base class.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
uint8_t elementType_
The type of an element.
Definition: VectorSerializer.h:282