The error you report has no reason to be. I can't figure out what it may be doing. If I generate the X
matrix you report, it all works fine:
X = rand (512, 512);
S = size (X);
O = ones (S);
X+O;
I don't know how you confirmed that you were using the builtin functions, so can you check that this works:
X = rand (512, 512);
S = builtin ("size", X);
O = builtin ("ones", S);
X+O;
Or could it be that the mex file someone compile for you somehow overloads the plus operator for double? Since you don't have the source for it, I'd suggest you do the following. After calling the mex function, save X
, exit, and load it in a new Octave session. Check that the error disappeared, and if not, share the file with us so that we can at least try to reproduce it.
X = your_closed_source_mex (...);
save -binary data.dat X
exit();
Then start a new Octave session:
load -binary data.dat
whos X # confirm that X is loaded
X = rand (512, 512);
S = size (X);
O = ones (S);
X+O;