Block trust region MEX: add safety check for squareness of blocks

time-shift
Sébastien Villemot 2020-07-22 18:01:31 +02:00
parent 9430b4e9ca
commit adf1fdb009
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ subroutine mexFunction(nlhs, plhs, nrhs, prhs) bind(c, name='mexFunction')
real(real64), dimension(size(blocks(i)%col_indices)) :: x_block
x_indices => blocks(i)%col_indices
f_indices => blocks(i)%row_indices
if (size(x_indices) /= size(f_indices)) then
call mexErrMsgTxt("Non-square block")
return
end if
x_block = x(x_indices)
call trust_region_solve(x_block, matlab_fcn, info, tolf = tolf)
x(x_indices) = x_block