Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with the Matlab version #101

Open
cviel opened this issue Nov 23, 2023 · 1 comment
Open

Bug with the Matlab version #101

cviel opened this issue Nov 23, 2023 · 1 comment

Comments

@cviel
Copy link

cviel commented Nov 23, 2023

I have tested the package with Matlab and there are several problems that prevent it from being used :

  • It is impossible to have access to the variable in the interval (ex: for x = Interval(1,2), I have tried to use x[1], x(1) or x{1} but I cannot obtain a value)
  • The function "IntervalVector" return a wrong interval : y = IntervalVector([[3,4],[4,6]]) should give me [y]= [3,4]×[4,6] but matlab return (<3, 3.000000000000001> ; <4, 4.000000000000001> ; <4, 4.000000000000001> ; <6, 6.000000000000001>) i.e. [3,3]x[4,4]x[4,4]x[6,6]
  • the function Interval.EMPTY_SET doesn't work (but you can create an empty set by writing something like "Interval(2,-1)")
  • the function IntervalVector([a,a]) with a = Interval(1,2) doesn't work (with the python module it returns [a,a]x[a,a])
  • the function max() and min() don't work

I can't test the validity of the function "Function" since IntervalVector returns a wrong result, so to be tested.
Good luck to fix it, and thank you for your work !

@lebarsfa
Copy link
Contributor

Indeed, here are some quick answers:

  • The current workaround would be x.getitem(int32(0)) from

The operator [index] for a Codac object should be replaced with .getitem(int32(index)) [...] indices of Codac objects start at 0...

on https://www.codac.io/install/04-start-matlab-project.html . We plan to try to simplify this notation to something like x.i(0), if there is no side effect.

  • The current workaround would be y = IntervalVector(py.list({Interval(3,4),Interval(4,6)})) from

Python lists of objects should be converted to MATLAB cell arrays. [...] when a Codac function needs a py.list or Vector parameter, the corresponding MATLAB cell array should be given as py.list(…)

I do not know yet if there would be a simple way to simplify this.

  • MATLAB should give a hint to try Interval().EMPTY_SET.
  • IntervalVector(py.list({a,a})), see 2nd point.
  • Maybe x.ub() and x.lb() could be used instead? Maybe we should make max(x) and min(x) return this, I don't think it is currently done for any programming language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants