1
function [stk,nwrk,txt,top]=%x2for(nwrk)
6
s2=stk(top);s1=stk(top-1);
10
[s1,nwrk,txt1]=typconv(s1,nwrk,'1'),
12
[s2,nwrk,txt1]=typconv(s2,nwrk,'1'),
15
[s1,te1,t1,m1,n1]=s1(1:5);
16
[s2,te2,t2,m2,n2]=s2(1:5);
17
it1=prod(size(s1))-1;it2=prod(size(s2))-1
19
if t2=='0' then t2='1',end
22
if m1=='1'&n1=='1'&m2=='1'&n2=='1' then // cas scalaire
25
if te2=='2' then s2='('+s2+')',end
26
if te1=='2' then s1='('+s1+')',end
27
stk=list(mulf(s1,s2),'1',t2,m1,n1)
29
if te1=='2' then s1(1)='('+s1(1)+')',s1(2)='('+s1(2)+')', end
30
if te2=='2' then s2='('+s2+')',end
31
stk=list([mulf(s1(1),s2(1)),mulf(s1(2),s2(1))],'1',t2,m1,n1)
33
if te2=='2' then s2(1)='('+s2(1)+')',s2(2)='('+s2(2)+')', end
34
if te1=='2' then s1='('+s1+')',end
35
stk=list([mulf(s1(1),s2(1)),mulf(s1(1),s2(2))],'1',t2,m1,n1)
37
if te1=='2' then s1(1)='('+s1(1)+')',s1(2)='('+s1(2)+')', end
38
if te2=='2' then s2(1)='('+s2(1)+')',s2(2)='('+s2(2)+')', end
39
stk=list([subf(mulf(s1(1),s2(1)),mulf(s1(2),s2(2))),..
40
addf(mulf(s1(1),s2(2)),mulf(s1(2),s2(1))) ],'1',t2,m1,n1)
46
if m1=='1'&n1=='1' then
50
[out,nwrk,txt]=outname(nwrk,t2,m2,n2)
52
txt=[txt;gencall(['dcopy',mn2,s2,'1',out,'1'])]
54
txt=[txt;gencall(['dscal',mn2,s1,out,'1'])]
55
if ~isnum(s1)&op(2)==s1 then
56
txt=[txt;gencall(['dcopy',mn2,out,'1',s1,'1'])]
59
stk=list(out,'-1',t2,m2,n2)
61
[outr,nwrk,txt]=outname(nwrk,t2,m2,n2)
62
if part(outr,1:4)<>'work' then
66
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
69
gencall(['dcopy',mn2,s2,'1',outr,'1']);
70
gencall(['dcopy',mn2,s2,'1',outi,'1']);
71
gencall(['dscal',mn2,s1(1),outr,'1']);
72
gencall(['dscal',mn2,s1(2),outi,'1'])];
73
stk=list([outr,outi],'-1',t2,m2,n2)
75
[outr,nwrk,txt]=outname(nwrk,t2,m2,n2)
76
if part(outr,1:4)<>'work' then
80
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
83
gencall(['dcopy',mn2,s2(1),'1',outr,'1']);
84
gencall(['dcopy',mn2,s2(2),'1',outi,'1']);
85
gencall(['dscal',mn2,s1,outr,'1']);
86
gencall(['dscal',mn2,s1,outi,'1'])];
87
stk=list([outr,outi],'-1',t2,m2,n2)
89
[outr,nwrk,txt]=outname(nwrk,t2,m2,n2)
90
if part(outr,1:4)<>'work' then
94
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
97
gencall(['dcopy',mn2,s2(1),'1',outr,'1']);
98
gencall(['dcopy',mn2,s2(2),'1',outi,'1']);
99
gencall(['wscal',mn2,s1(1),s1(2),outr,outi,'1'])];
100
stk=list([outr,outi],'-1',t2,m2,n2)
106
if m2=='1'&n2=='1' then
110
[out,nwrk,txt]=outname(nwrk,t2,m1,n1)
111
if out<>s1 then txt=[txt;gencall(['dcopy',mn1,s1,'1',out,'1'])], end
112
txt=[txt;gencall(['dscal',mn1,s2,out,'1'])]
113
if ~isnum(s2)&op(2)==s2 then
114
txt=[txt;gencall(['dcopy',mn1,out,'1',s2,'1'])]
117
stk=list(out,'-1',t2,m1,n1)
119
[outr,nwrk,txt]=outname(nwrk,t1,m1,n1)
120
if part(outr,1:4)<>'work' then
124
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
127
gencall(['dcopy',mn1,s1(1),'1',outr,'1']);
128
gencall(['dcopy',mn1,s1(2),'1',outi,'1']);
129
gencall(['dscal',mn1,s2,outr,'1']);
130
gencall(['dscal',mn1,s2,outi,'1'])];
131
stk=list([outr,outi],'-1',t2,m1,n1)
133
[outr,nwrk,txt]=outname(nwrk,t1,m1,n1)
134
if part(outr,1:4)<>'work' then
138
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
141
gencall(['dcopy',mn1,s1,'1',outr,'1']);
142
gencall(['dcopy',mn1,s1,'1',outi,'1']);
143
gencall(['dscal',mn1,s2(1),outr,'1']);
144
gencall(['dscal',mn1,s2(2),outi,'1'])];
145
stk=list([outr,outi],'-1',t2,m1,n1)
147
[outr,nwrk,txt]=outname(nwrk,t1,m1,n1)
148
if part(outr,1:4)<>'work' then
152
[outi,nwrk,txt]=outname(nwrk,t2,m2,n2)
155
gencall(['dcopy',mn1,s1(1),'1',outr,'1']);
156
gencall(['dcopy',mn1,s1(2),'1',outi,'1']);
157
gencall(['wscal',mn1,s2(1),s2(2),outr,outi,'1'])]
158
stk=list([outr,outi],'-1',t2,m1,n1)
166
[out,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
168
gencall(['dcopy',mulf(m1,n2),s1,'1',out,'1'])
169
gencall(['dvmul',mulf(m1,n2),s2,'1',out,'1'])]
170
stk=list(out,'-1',t2,m1,n2)
172
[outr,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
173
[outi,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
175
gencall(['dcopy',mulf(m1,n2),s1(1),'1',outr,'1'])
176
gencall(['dcopy',mulf(m1,n2),s1(2),'1',outi,'1'])
177
gencall(['dvmul',mulf(m1,n2),s2(1),'1',outr,'1'])
178
gencall(['dvmul',mulf(m1,n2),s2(1),'1',outi,'1'])]
179
stk=list([outr,outi],'-1',t2,m1,n2)
181
[outr,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
182
[outi,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
184
gencall(['dcopy',mulf(m1,n2),s2(1),'1',outr,'1'])
185
gencall(['dcopy',mulf(m1,n2),s2(2),'1',outi,'1'])
186
gencall(['dvmul',mulf(m1,n2),s1(1),'1',outr,'1'])
187
gencall(['dvmul',mulf(m1,n2),s1(1),'1',outi,'1'])]
188
stk=list([outr,outi],'-1',t2,m1,n2)
190
[outr,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
191
[outi,nwrk,txt]=outname(nwrk,t2,m1,n2,[s1,s2])
193
gencall(['dcopy',mulf(m1,n2),s1(1),'1',outr,'1'])
194
gencall(['dcopy',mulf(m1,n2),s1(2),'1',outi,'1'])
195
gencall(['wvmul',mulf(m1,n2),s2(1),s2(2),'1',outr,outi,'1'])]
196
stk=list([outr,outi],'-1',t2,m1,n2)