Subversion Repositories wimsdev

Rev

Rev 7692 | Blame | Compare with Previous | Last modification | View Log | RSS feed

!if $wims_read_parm!=slib_header
  !goto proc
!endif
slib_author=Gang, XIAO

slib_example=4,6,5,random\
4,6,5,u\
4,6,5,d
slib_require=pari
!exit

:proc
!distribute items $wims_read_parm into slib_rows,slib_cols,slib_range,slib_o,slib_ring
slib_o=!lower $slib_o
slib_o=!nospace $slib_o
slib_o=!char 1 of $slib_o
slib_r=!randitem d,u
!bound slib_o within d,u default $slib_r
!default slib_ring=Z
!bound slib_rows between integer 1 and 30 default 2
!bound slib_cols between integer 1 and 30 default 2
!bound slib_range between integer 1 and 1000000 default 2

!if $slib_ring=Z
  slib_ran1=(random(2*$slib_range+1)-$slib_range)
  slib_ran2=(random($slib_range)+1)*(2*random(2)-1)
!endif

!if $slib_o=u
  slib_comp=x>y
!else
  slib_comp=x<y
!endif

slib_coef=if(x==y,$slib_ran2,if($slib_comp,0,$slib_ran1))
slib_out=!exec pari print(matrix($slib_rows,$slib_cols,x,y,$slib_coef))