[Scilab-users] "unique" bug with complex ?

classic Classic list List threaded Threaded
3 messages Options
Philippe Roux Philippe Roux
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] "unique" bug with complex ?

Hi,

the following behaviour of "unique" function (with scilab 5.5.2  and
6.0.0) looks like a bug to me :

8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--

unique ([1 -1 1 -1])
 ans  =

  - 1.    1.

-->unique ([1 -1 1 -1]*%i)
 ans  =

  - i      i    - i      i


-->unique (string([1 -1 1 -1]*%i))
 ans  =

!%i  -%i  !

8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--

I don't found bug report on bugzilla, so I should probably report it
except if i misunderstood the synopsis of the function ...

Can some one confirm the bug?


Philippe

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: "unique" bug with complex ?

Hello Philippe,

unique() sorts components to deduplicate them. So, components are
assumed to be sortable.
This is not the case for complex numbers. Here there are 2 issues
1) This limitation is not documented.
2) We could need deduplicating complex numbers, but this limitation is
not overcome.

It would be possible to intersort complex numbers according to their
real and secondly their imaginary parts (for instance). The sorting
criteria does not really matter, since here we want only use it to
deduplicate.

For even less sortable objects like polynomials, another algorithm could
be implemented.
For the time being, unique() can't be use for a set of polynomials or
other non-sortable objects.

Yes, reporting this behavior would be useful. Thanks!

Best regards
Samuel

Le 28/09/2017 à 23:30, philippe a écrit :

> Hi,
>
> the following behaviour of "unique" function (with scilab 5.5.2  and
> 6.0.0) looks like a bug to me :
>
> 8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--
>
> unique ([1 -1 1 -1])
>   ans  =
>
>    - 1.    1.
>
> -->unique ([1 -1 1 -1]*%i)
>   ans  =
>
>    - i      i    - i      i
>
>
> -->unique (string([1 -1 1 -1]*%i))
>   ans  =
>
> !%i  -%i  !
>
> 8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--
>
> I don't found bug report on bugzilla, so I should probably report it
> except if i misunderstood the synopsis of the function ...
>
> Can some one confirm the bug?
>
>
> Philippe
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Philippe Roux Philippe Roux
Reply | Threaded
Open this post in threaded view
|

Re: "unique" bug with complex ?

Hi Samuel,

Le 29/09/2017 à 00:27, Samuel Gougeon a écrit :
> Hello Philippe,
>
> unique() sorts components to deduplicate them. So, components are
> assumed to be sortable.

Ok I understand the problem, I think I could find a workaround using
"find" instead of sorting values.
> [...]
> Yes, reporting this behavior would be useful. Thanks!

done :

http://bugzilla.scilab.org/show_bug.cgi?id=15279

Have a nice day!

Philippe

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users