k-order DLL: fix wrong assertion in MATLAB mode

Bug introduced in 4c6e911d6 (only apparent under Octave, since under MATLAB
assertions are skipped).

Ref #217
time-shift
Sébastien Villemot 2019-04-15 17:32:53 +02:00
parent 2169341639
commit a101457cf0
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 5 additions and 4 deletions

View File

@ -125,11 +125,12 @@ DynamicModelMFile::eval(const Vector &y, const Vector &x, const Vector &modParam
if (retVal != 0)
throw DynareException(__FILE__, __LINE__, "Trouble calling " + funcname);
assert(static_cast<int>(mxGetM(plhs[0])) == md[i-1].nrows());
assert(static_cast<int>(mxGetN(plhs[0])) == md[i-1].ncols());
if (i == 1)
std::copy_n(mxGetPr(plhs[0]), mxGetM(plhs[0])*mxGetN(plhs[0]), md[i-1].base());
{
assert(static_cast<int>(mxGetM(plhs[0])) == md[i-1].nrows());
assert(static_cast<int>(mxGetN(plhs[0])) == md[i-1].ncols());
std::copy_n(mxGetPr(plhs[0]), mxGetM(plhs[0])*mxGetN(plhs[0]), md[i-1].base());
}
else
unpackSparseMatrixAndCopyIntoTwoDMatData(plhs[0], md[i-1]);