Rev 20 | Rev 4161 | 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=Data sum |
||
5 | slib_parms=1\ |
||
6 | ,[data] or [data],[weight] |
||
7 | slib_author=Adeline Grelot and Bernadette PERRIN-RIOU |
||
8 | slib_out=data sum |
||
9 | slib_comment=Data and weight can be recognized under many formats, \ |
||
10 | in particular as a matrix (with data before weight). |
||
11 | slib_example=[2,-7,6]\ |
||
12 | [2,1;-7,6;1,1]\ |
||
13 | [2,-7,1],[1,6,1]\ |
||
3265 | bpr | 14 | [2,-7,1;1,6,1] |
15 | slib_require=pari |
||
20 | reyssat | 16 | !exit |
17 | |||
18 | :proc |
||
19 | !if [ isin $wims_read_parm or ; isin $wims_read_parm |
||
20 | !readproc slib/stat/dataproc $wims_read_parm |
||
21 | !else |
||
22 | slib_data=$wims_read_parm |
||
23 | slib_weight=$empty |
||
24 | slib_cnt=!itemcnt $slib_data |
||
25 | !endif |
||
26 | !if $slib_cnt =0 |
||
27 | slib_out=0 |
||
28 | !else |
||
29 | !if $slib_weight=$empty |
||
30 | slib_out=!sum x for x in $slib_data |
||
31 | !else |
||
32 | slib_out=!exec pari print(Mat([$slib_data])*Mat([$slib_weight])~); |
||
33 | !endif |
||
34 | !endif |
||
35 | slib_out=!trim $slib_out |