Subversion Repositories wimsdev

Rev

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 triangular matrix
5
slib_parms=5\
6
2,number of rows\
7
2,number of columns\
8
2,coefficient range\
9
random,u (upper) or d (down)\
10
Z,coefficient ring: Z for the time being,Q,R,C,G (Gauss ring), n (n is an integer for Z/nZ)
11
slib_author=Gang Xiao
12
slib_out=the generated matrix
13
slib_example=4,2,5,random\
14
4,2,5,u\
15
4,2,5,d
3265 bpr 16
slib_require=pari
20 reyssat 17
!exit
18
 
19
:proc
20
!distribute items $wims_read_parm into slib_rows,slib_cols,slib_range,slib_o,slib_ring
21
slib_o=!lower $slib_o
22
slib_o=!nospace $slib_o
23
slib_o=!char 1 of $slib_o
24
slib_r=!randitem u,d
25
!bound slib_o within d,u default $slib_r
26
!default slib_ring=Z
27
!bound slib_rows between integer 1 and 30 default 2
28
!bound slib_cols between integer 1 and 30 default 2
29
!bound slib_range between integer 1 and 1000000 default 2
30
 
31
!if $slib_ring=Z
32
 slib_ran1=(random(2*$slib_range+1)-$slib_range)
33
!endif
34
 
35
!if $slib_o=u
36
 slib_comp=x>y
37
!else
38
 slib_comp=x<y
39
!endif
40
 
41
slib_coef=if($slib_comp,0,$slib_ran1)
42
slib_out=!exec pari print(matrix($slib_rows,$slib_cols,x,y,$slib_coef))
43