Rev 20 | Rev 4158 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
4 | slib_title=Generates a random unimodular matrix |
||
5 | slib_parms=3\ |
||
6 | 2,matrix size\ |
||
7 | 2,coefficient range\ |
||
8 | Z,coefficient ring: Z for the time being, or G (Gauss ring) |
||
9 | slib_author=Gang Xiao |
||
10 | slib_out=the generated matrix |
||
11 | slib_example=3, 5 |
||
3265 | bpr | 12 | slib_require=pari |
20 | reyssat | 13 | !exit |
14 | |||
15 | :proc |
||
16 | !distribute items $wims_read_parm into slib_size,slib_range,slib_ring |
||
17 | !default slib_ring=Z |
||
18 | !bound slib_size between integer 2 and 20 default 2 |
||
19 | !bound slib_range between integer 1 and 1000000 default 2 |
||
20 | |||
21 | !if $slib_ring=Z |
||
22 | slib_sh1=!shuffle $slib_size |
||
23 | slib_sh2=!shuffle $slib_size |
||
24 | slib_ran1=(random($slib_range)*(2*random(2)-1)) |
||
25 | slib_ran2=(2*random(2)-1) |
||
26 | slib_coefu=if(x==y,$slib_ran2,if(x>y,0,$slib_ran1)) |
||
27 | slib_coefd=if(x==y,$slib_ran2,if(x<y,0,$slib_ran1)) |
||
28 | slib_triu=matrix($slib_size,$slib_size,x,y,$slib_coefu) |
||
29 | slib_trid=vecextract(matrix($slib_size,$slib_size,x,y,$slib_coefd),[$slib_sh1],[$slib_sh2]) |
||
30 | slib_out=!exec pari print($slib_triu*$slib_trid) |
||
31 | !exit |
||
32 | !endif |
||
33 |