Subversion Repositories wimsdev

Rev

Rev 4349 | Details | Compare with Previous | Last modification | View Log | RSS feed

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