Commit 8789151c authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Dynare++: compatibility fixes with MatIO 1.5

parent cecb375b
......@@ -39,13 +39,19 @@ void NameList::writeMat(mat_t* fd, const char* vname) const
else
m[j*getNum()+i] = ' ';
# if MATIO_MAJOR_VERSION > 1 || (MATIO_MAJOR_VERSION == 1 && MATIO_MINOR_VERSION >= 5)
size_t dims[2];
const matio_compression compression = MAT_COMPRESSION_NONE;
# else
int dims[2];
const int compression = COMPRESSION_NONE;
# endif
dims[0] = getNum();
dims[1] = maxlen;
matvar_t *v = Mat_VarCreate(vname, MAT_C_CHAR, MAT_T_UINT8, 2, dims, m, 0);
Mat_VarWrite(fd, v, COMPRESSION_NONE);
Mat_VarWrite(fd, v, compression);
Mat_VarFree(v);
delete[] m;
......
......@@ -34,7 +34,13 @@ ConstTwoDMatrix::ConstTwoDMatrix(int first_row, int num, const ConstTwoDMatrix&
@<|ConstTwoDMatrix::writeMat| code@>=
void ConstTwoDMatrix::writeMat(mat_t* fd, const char* vname) const
{
#if MATIO_MAJOR_VERSION > 1 || (MATIO_MAJOR_VERSION == 1 && MATIO_MINOR_VERSION >= 5)
size_t dims[2];
const matio_compression compression = MAT_COMPRESSION_NONE;
#else
int dims[2];
const int compression = COMPRESSION_NONE;
#endif
dims[0] = nrows();
dims[1] = ncols();
double *data = new double[nrows()*ncols()];
......@@ -45,7 +51,7 @@ void ConstTwoDMatrix::writeMat(mat_t* fd, const char* vname) const
matvar_t *v = Mat_VarCreate(vname, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data, 0);
Mat_VarWrite(fd, v, COMPRESSION_NONE);
Mat_VarWrite(fd, v, compression);
Mat_VarFree(v);
delete[] data;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment