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
[email protected]
http://lists.scilab.org/mailman/listinfo/users


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

Reply via email to