MF_fprint MD_fprint ME_fprint
MCF_fprint MCD_fprint MCE_fprint
Functionprint a matrix in ASCII format to a stream
Syntax C/C++#include <MFstd.h>
void MF_fprint( FILE *stream, fMatrix MA, ui ht, ui len, unsigned linewidth );
C++ MatObj#include <OptiVec.h>
void matrix<T>::fprint( FILE *stream, unsigned linewidth );
Pascal/Delphiuses MFstd;
procedure MF_fprint( var Stream:TextFile; MA:fMatrix; ht, len:UIntSize; linewidth:UInt );
CUDA function C/C++#include <cudaMFstd.h>
int cudaMF_fprint( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_fprint_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk );
CUDA function Pascal/Delphiuses MFstd;
function cudaMF_fprint( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_fprint_buf( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
DescriptionThe matrix MA is written in ASCII format to stream. Each line corresponds to one row of the matrix. The lines are numbered. If the specified linewidth is too small to write all columns, rows are cut off.
Printing starts always with a new line. This may lead to an empty line at the beginning. Especially the first line of a file is reserved for a possible headline.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}.

In contrast to MF_write, it is not possible to override the automatic choice of the format used for printing. The number of digits per element is determined by the available space, which depends in turn on the parameters len and linewidth.

CUDA versions only: cudaM?_fprint_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?_fprint to allocate its own buffer memory, cudaM?_fprint_buf is slightly faster.

Error handlingIf len exceeds the maximum number of entries possible for the linewidth chosen, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the program truncates the rows at the maximum number of columns possible.
See alsoMF_cprint,   MF_fhexprint,   chapter 14

MatrixLib Table of Contents  OptiVec home