Merge branch 'develop' into gnb-threadpool
This commit is contained in:
+30
-1
@@ -88,12 +88,14 @@ int write_file_matlab(const char *fname,
|
||||
void *data,
|
||||
int length,
|
||||
int dec,
|
||||
char format,
|
||||
unsigned int format,
|
||||
int multiVec)
|
||||
{
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
|
||||
AssertFatal((format&~MATLAB_RAW) <16,"");
|
||||
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -110,6 +112,31 @@ int write_file_matlab(const char *fname,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ( (format&MATLAB_RAW) == MATLAB_RAW ) {
|
||||
int sz[16]={sizeof(short), 2*sizeof(short),
|
||||
sizeof(int), 2*sizeof(int),
|
||||
sizeof(char), 2*sizeof(char),
|
||||
sizeof(long long),
|
||||
sizeof(double), 2*sizeof(double),
|
||||
sizeof(unsigned char),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short)
|
||||
};
|
||||
int eltSz= sz[format&~MATLAB_RAW];
|
||||
if (dec==1)
|
||||
fwrite(data, eltSz, length, fp);
|
||||
else
|
||||
for (i=0; i<length; i+=dec)
|
||||
fwrite(data+i*eltSz, eltSz, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
@@ -215,6 +242,8 @@ int write_file_matlab(const char *fname,
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "unknown dump format: %d\n", format);
|
||||
}
|
||||
|
||||
if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
|
||||
|
||||
+19
-1
@@ -337,7 +337,25 @@ typedef struct {
|
||||
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
||||
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
|
||||
*/
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format, int multiVec);
|
||||
#define MATLAB_RAW (1<<31)
|
||||
#define MATLAB_SHORT 0
|
||||
#define MATLAB_CSHORT 1
|
||||
#define MATLAB_INT 2
|
||||
#define MATLAB_CINT 3
|
||||
#define MATLAB_INT8 4
|
||||
#define MATLAB_CINT8 5
|
||||
#define MATLAB_LLONG 6
|
||||
#define MATLAB_DOUBLE 7
|
||||
#define MATLAB_CDOUBLE 8
|
||||
#define MATLAB_UINT8 9
|
||||
#define MATLEB_EREN1 10
|
||||
#define MATLEB_EREN2 11
|
||||
#define MATLEB_EREN3 12
|
||||
#define MATLAB_CSHORT_BRACKET1 13
|
||||
#define MATLAB_CSHORT_BRACKET2 14
|
||||
#define MATLAB_CSHORT_BRACKET3 15
|
||||
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format, int multiVec);
|
||||
|
||||
/*----------------macro definitions for reading log configuration from the config module */
|
||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||
|
||||
Reference in New Issue
Block a user