[Scilab-users] overloading concat "[ ]" operators

Samuel Gougeon sgougeon at free.fr
Fri Jul 1 11:33:52 CEST 2016


Hello Philippe,
You shall use a mlist() instead of a tlist.
Have a look at https://help.scilab.org/docs/6.0.0/en_US/mlist.html
mlist are array-oriented.
BR
Samuel

Le 01/07/2016 10:41, philippe a écrit :
> Hi,
>
> I have created a simple data structure  to handle "big integers" . It is
>   based on scilab tlist  and named "bigint" . I have overloaded basic
> unary/binary operators for bigint (like +,*,-,/,^,==,<,>,... ) :
>
>
>
> -->x=bigint('123456789987654321')
>   x  =
>
>
>   123456789987654321
>
> -->y=bigint('987654321123456789')
>   y  =
>
>
>   987654321123456789
>
> -->z=x-y
> z =
>
>
> -864197531135802468
>
>
>
> but now I want to create matrix of bigint  so I need to create
> functions like %bigint_c_bigint   and %bigint_f_bigint . I try using
> "cell" It's not exactly what I was expecting : matrix entries  are
> displayed as tlist  instead of bigint display (modified via %bigint_p )
>
>
>
> -->T=cell()
>   T  =
>
>
>       []
>
>
>
> -->T(1).entries=x
>   T  =
>
>
>   tlist(["bigint","rep","signe"],[7654321;5678998;1234],1)
>
> -->T(2).entries=y
>   T  =
>
>
> !tlist(["bigint","rep","signe"],[7654321;5678998;1234],1)  !
> !                                                          !
> !tlist(["bigint","rep","signe"],[3456789;5432112;9876],1)  !
>
>
> -->T(3).entries=z
>   T  =
>
>
> !tlist(["bigint","rep","signe"],[7654321;5678998;1234],1)   !
> !                                                           !
> !tlist(["bigint","rep","signe"],[3456789;5432112;9876],1)   !
> !                                                           !
> !tlist(["bigint","rep","signe"],[5802468;9753113;8641],-1)  !
>
>
>
> how could I get  a display like
>
>
> -->T
> T =
>
>
> !  123456789987654321 !
> !                     !
> !  987654321123456789 !
> !                     !
> ! -864197531135802468 !
>
>
>
> actually I only get
>
> -->T.entries
>   ans  =
>
>
>         ans(1)
>
>
>   123456789987654321
>
>         ans(2)
>
>
>   987654321123456789
>
>         ans(3)
>
>
>   -864197531135802468
>
>
>
> Philippe
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>




More information about the users mailing list