Rev 3265 | Rev 4349 | 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 |
||
| 4158 | bpr | 4 | |
| 20 | reyssat | 5 | slib_author=Gang Xiao |
| 4158 | bpr | 6 | |
| 20 | reyssat | 7 | slib_example=3,5,1,5 |
| 3265 | bpr | 8 | slib_require=pari |
| 20 | reyssat | 9 | !exit |
| 10 | |||
| 11 | :proc |
||
| 12 | !distribute items $wims_read_parm into slib_row,slib_col,slib_rank,slib_range,slib_ring |
||
| 13 | !default slib_ring=Z |
||
| 14 | !bound slib_row between integer 1 and 20 default 2 |
||
| 15 | !bound slib_col between integer 1 and 20 default 2 |
||
| 16 | slib_sizemin=$[min($slib_row,$slib_col)] |
||
| 17 | !bound slib_rank between integer 1 and $slib_sizemin |
||
| 18 | !bound slib_range between integer 1 and 1000000 default 2 |
||
| 19 | |||
| 20 | !if $slib_ring=Z |
||
| 21 | slib_sh1=!shuffle $slib_rank |
||
| 22 | slib_sh2=!shuffle $slib_col |
||
| 23 | slib_ran1=(random($slib_range)*(2*random(2)-1)) |
||
| 24 | slib_ran2=(2*random(2)-1) |
||
| 25 | slib_coefu=if(x==y,$slib_ran2,if(x<y,0,$slib_ran1)) |
||
| 26 | slib_coefd=if(x==y,$slib_ran2,if(x>y,0,$slib_ran1)) |
||
| 27 | slib_triu=matrix($slib_row,$slib_rank,x,y,$slib_coefu) |
||
| 28 | slib_trid=vecextract(matrix($slib_rank,$slib_col,x,y,$slib_coefd),[$slib_sh1],[$slib_sh2]) |
||
| 29 | slib_out=!exec pari print($slib_triu*$slib_trid) |
||
| 30 | !exit |
||
| 31 | !endif |
||
| 32 |