MF_store MD_store ME_store
MCF_store MCD_store MCE_store
MI_storeMBI_storeMSI_storeMLI_storeMQI_store
MU_storeMUB_storeMUS_storeMUL_storeMUQ_store
Functionstore a matrix in binary format into a stream
Syntax C/C++#include <MFstd.h>
int MF_store( FILE *stream, fMatrix MA, ui ht, ui len );
C++ MatObj#include <OptiVec.h>
int matrix<T>::store( FILE *stream );
Pascal/Delphiuses MFstd;
function MF_store( var Stream:FILE; MA:fMatrix; ht, len:UIntSize ): Integer;
CUDA function C/C++#include <cudaMFstd.h>
int cudaMF_store( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_store_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk );
CUDA function Pascal/Delphiuses MFstd;
function cudaMF_store( var Stream:File; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_store_buf( var Stream:File; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
DescriptionThe matrix MA of ht*len elements is written to stream in binary format. The stream must be already open for binary write operations.

CUDA versions only: cudaM?_store_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_store to allocate its own buffer memory, cudaM?_store_buf is slightly faster.

GCC and CLang only: GCC and CLang (including BCC32C) pad the 10-byte data type long double to 12 or 16 bytes in memory (12 byte in 32-bit, 16 byte in 64 bit). In order to maintain compatibility of the generated data files between compilers, the ME_store / ME_recall and MCE_store / MCE_recall pairs always use 10-byte storage on disk.

Thread safetyDifferent threads may safely call any functions of the VF_ / MF_store and VF_ / MF_recall families simultaneously, as long as the refer to different streams. If they have to access one and the same stream, however, the user must take appropriate measures (critical sections, mutexes), in order to prevent race conditions.
Error handlingError handling is performed by the C function fwrite or the Delphi function BlockWrite, on which MF_store etc. are based.
Return value0, if successful; otherwise 1. In order to obtain more information, inspect errno (C/C++) or IOResult (Delphi).
See alsoMF_recall,   chapter 14

MatrixLib Table of Contents  OptiVec home