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

philippe rouxph.22 at gmail.com
Fri Jul 1 10:41:59 CEST 2016


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




More information about the users mailing list