src/GamIO/ML5Reals.cc
/* These are the functions which will output this sub-element in MATLAB ".mat"
   binary format, version 5.  This is done with a pair {tag,data}.  Both the
   tag & data will be written directly from these functions, bypassing the
   associated class structures which have no knowledge of GAMMA array types.
   
   Remember, the MATLAB MAT version 5 tag for this sub-element contains
   8-bytes with two important settings: 1.) data type & 2.) # of bytes.
   The data type is placed in the first 4 bytes and the number of bytes
   placed into the last 4 bytes (for non-compressed data elements which we
   will always output...).  In this case, we output the elements as doubles
   so that the data type should be MATLAB type miDOUBLE, i.e. value 9.
 
                Input           ML5Re	: MAT version 5 sub-element (this)
                                fp      : Output file stream
				mx      : GAMMA matrix
				rv	: GAMMA row vector
				cv	: GAMMA column vector
                Output          void    : Output file stream is modified
                                          by having the ML5Re written to it
		Note			: Since we write doubles (8 bytes)
					  per element we always end on an 8 
					  byte boundary.
                Note                    : No care taken herein to insure the
                                          sub-element is properly written.   */
These are the functions which will output this sub-element in MATLAB ".mat"
binary format, version 5.  This is done with a pair {tag,data}.  Both the
tag & data will be written directly from these functions, bypassing the
associated class structures which have no knowledge of GAMMA array types.

Remember, the MATLAB MAT version 5 tag for this sub-element contains
8-bytes with two important settings: 1.) data type & 2.) # of bytes.
The data type is placed in the first 4 bytes and the number of bytes
placed into the last 4 bytes (for non-compressed data elements which we
will always output...).  In this case, we output the elements as doubles
so that the data type should be MATLAB type miDOUBLE, i.e. value 9.


These are the functions which will output this sub - element in MATLAB " . mat " binary format version 5 . This is done with a pair { tag data } . Both the tag & data will be written directly from these functions bypassing the associated class structures which have no knowledge of GAMMA array types . Remember the MATLAB MAT version 5 tag for this sub - element contains 8 - bytes with two important settings : 1 . ) data type & 2 . ) # of bytes . The data type is placed in the first 4 bytes and the number of bytes placed into the last 4 bytes ( for non - compressed data elements which we will always output ... ) . In this case we output the elements as doubles so that the data type should be MATLAB type miDOUBLE i . e . value 9 .
int MatLab5Re::write(std::fstream& fp, const matrix& mx) const	
  {
  int32_t TB = 9;					
  fp.write((char*)&TB, sizeof(int32_t));			
  TB = mx.rows()*mx.cols()*sizeof(double);	
  fp.write((char*)&TB, sizeof(int32_t));			
  int i,j;
  double d;
  for(j=0; j<mx.cols(); j++)			
    for(i=0; i<mx.rows(); i++) 			
      {
      d = mx.getRe(i,j);
      fp.write((char*)&d, sizeof(double));
      }
  return 1;
  }
int MatLab5Re :: write ( std :: fstream & fp , const matrix & mx ) const { int32_t TB = 9 ; fp . write ( ( char * ) & TB , sizeof ( int32_t ) ) ; TB = mx . rows ( ) * mx . cols ( ) * sizeof ( double ) ; fp . write ( ( char * ) & TB , sizeof ( int32_t ) ) ; int i , j ; double d ; for ( j = 0 ; j < mx . cols ( ) ; j ++ ) for ( i = 0 ; i < mx . rows ( ) ; i ++ ) { d = mx . getRe ( i , j ) ; fp . write ( ( char * ) & d , sizeof ( double ) ) ; } return 1 ; }
These are the functions which will output this sub-element in MATLAB ".mat"
binary format, version 5.
These are the functions which will output this sub - element in MATLAB " . mat " binary format version 5 .
// MATLAB data type miDOUBLE // Output the data type  (TAG) // Number of mx bytes to output // Output the # of bytes (TAG) // Output the real elements of // the matrix column by column