I'm using oct2py to execute an octave function from python, and I get the following error:
oct2PyError: Octave evaluation error: error: binary operator '*' not implemented for 'int64 scalar' by 'complex matrix' operations
In python, im just calling the function with:
from oct2py import octave
results = octave.myOctaveFunction(parameters)
In debugging of myOctaveFunction, I think the error is in the code:
slc=interpft(slc, OSF*lines, 1);
where:
Edit: detailed traceback:
Traceback (most recent call last):
File "/home/ezaqui/Papyrus/plugins/org.python.pydev_5.1.2.201606231256/pysrc/_pydevd_bundle/pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/oct2py/dynamic.py", line 96, in __call__
return self._ref().feval(self.name, *inputs, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oct2py/core.py", line 369, in feval
store_as=store_as, plot_dir=plot_dir)
File "/usr/local/lib/python2.7/dist-packages/oct2py/core.py", line 568, in _feval
raise Oct2PyError(msg)
Oct2PyError: Octave evaluation error:
error: binary operator '*' not implemented for 'int64 scalar' by 'complex matrix' operations
tl;dr:
slc=interpft(slc, double(OSF*lines), 1);
Explanation:
You are trying to multiply a complex matrix with an int64 type. Apparently the multiplication operation is not defined for this type in octave; it's only defined for doubles.
>> int64(5) * [1 + 1i]
error: binary operator '*' not implemented for 'int64 scalar' by 'complex scalar' operations
>> double(5) * [1 + 1i]
ans = 5 + 5i
So this is not an oct2py problem specifically. Just ensure that OSF
is converted to double
before the multiplication with a complex matrix in your octave function instead.
As for why you're getting a multiplication with a complex in the first place, I suspect the interpft function takes the result of your multiplication and multiplies a complex matrix somewhere. In octave, as it turns out, multiplying an int64 with a double results in an int64:
>> class(int64(5) * double(5))
ans = int64