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 orthogonal matrix |
||
5 | slib_parms=3\ |
||
6 | 2,matrix size m\ |
||
7 | 4, N coefficient range\ |
||
8 | 2,product of n reflexions |
||
9 | Q,coefficient ring: Q for the time being ,R,C,G (Gauss ring) |
||
10 | slib_author=Bernadette PERRIN-RIOU |
||
11 | slib_out=the generated matrix |
||
12 | slib_comment= product of n reflexions associated to n independant linear vectors (so its determinant is (-1)^n), the vector coefficients are bounded by N |
||
13 | slib_example= 4,3,3 |
||
3265 | bpr | 14 | slib_require=pari |
20 | reyssat | 15 | !exit |
16 | |||
17 | :proc |
||
18 | !distribute items $wims_read_parm into slib_size,slib_range,slib_n, slib_ring |
||
19 | !default slib_ring=Q |
||
20 | !bound slib_size between integer 2 and 20 default 2 |
||
21 | !bound slib_n between integer 1 and $slib_size default 2 |
||
22 | !bound slib_range between integer 1 and 1000000 |
||
23 | !default slib_range=4 |
||
24 | |||
25 | |||
26 | !if $slib_ring=Q |
||
27 | !readproc slib/matrix/givenrank $slib_n,$slib_size,$slib_n,$slib_range |
||
28 | !!slib_matrix=!translate internal ; to $\ |
||
29 | $ in $slib_out |
||
30 | |||
31 | slib_matrix=$slib_out |
||
32 | slib_out=!exec pari {slib_A=matid($slib_size);slib_n=$slib_n; \\ |
||
33 | slib_M= Mat([$slib_matrix]);\\ |
||
34 | for(slib_j=1 , slib_n,slib_vv=slib_M[slib_j,]; slib_A=slib_A*(matid($slib_size)-2/norml2(slib_vv)*slib_vv~*slib_vv));\\ |
||
35 | print(slib_A)} |
||
36 | |||
37 | slib_out= !trim $slib_out |
||
38 | slib_out=!line -1 of $slib_out |
||
39 | |||
40 | !endif |
||
41 |