Add the <-- JVM NOT MANDATORY --> TAG
[scilab.git] / scilab / modules / sparse / tests / unit_tests / sparse.tst
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) ????-2008 - INRIA
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7
8 // <-- JVM NOT MANDATORY -->
9
10 mode(5)
11 lines(0)
12 ij=[1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6];
13 v=[1;2;3;4;5;6;7;8;9];
14 ij1=[1 6;1 2;6 5];
15 v1=[-1;-1;-1];
16 vc=v+%i*(21:29)';
17 v1c=v1+%i*[0;0.3;-1.2];
18 zer=sparse([],[],[6,6]);
19 //
20 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
21 b=sparse([1 6;1 2;6 5],[-1;-1;-1],[6 6]);
22 ma=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9),[6 6]);
23 mb=sparse([1 6;1 2;6 5],-[-1;-1;-1],[6 6]);
24 ac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
25 bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
26 mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
27 mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
28 //
29 if %t then
30 //-------------------------------------------------------------
31 //test des primitives sparse, full
32 //--------------------------------------------------------------
33 //  -- for real matrix
34 if or(full(sparse(0.3))<>0.3) then pause,end
35 v=0*ones(1,3);v(3)=5;v(1)=1;
36 if or(full(sparse([1 1;1 3],[1 5]))<>v) then pause,end
37 v=0*ones(1,300);v(300)=5;v(1)=1;
38 if or(full(sparse([1 1;1 300],[1 5]))<>v) then pause,end
39 v=0*ones(3,1);v(3)=5;v(1)=1;
40 if or(full(sparse([1 1;3 1],[1 5]))<>v) then pause,end
41 v=0*ones(300,1);v(300)=5;v(1)=1;
42 if or(full(sparse([1 1;300 1],[1 5]))<>v) then pause,end
43 sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
44 a=[0,0,3,0,2,1;;5,0,0,4,0,0;0,0,0,0,0,0;0,0,7,6,0,0;8,0,0,0,0,0;0,0,0,0,0,9];
45 if or(full(sp)<>a) then pause,end
46 sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[8 6]);a(8,6)=0;
47 if or(full(sp)<>a) then pause,end
48 if or(full(sparse([],[],[4 10]))<>0*ones(4,10)) then pause,end
49 v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
50 a=[0;10;11;12;0;13];
51 if or(full(v)<>a) then pause,end
52 v=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
53 a=[0,10,11,12,0,13];
54 if or(full(v)<>a) then pause,end
55 //  -- for complex matrix
56 sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
57 a=[0,0,3+%i*23,0,2+%i*22,1+%i*21
58    5+%i*25,0,0,4+%i*24,0,0
59    0,0,0,0,0,0
60    0,0,7+%i*27,6+%i*26,0,0
61    8+%i*28,0,0,0,0,0
62    0,0,0,0,0,9+%i*29];
63 if or(full(sp)<>a) then pause,end
64 sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[8 6]);
65 a(8,6)=0;
66 if or(full(sp)<>a) then pause,end
67 v=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
68 a=[0;10-%i*3;11;12+%i*5;0;13+%i*0.5];
69 if or(full(v)<>a) then pause,end
70 v=sparse([1 2;1 3;1 4;1 6],[10-3*%i;11;12+5*%i;13+0.5*%i],[1,6]);
71 a=[0,10-%i*3,11,12+%i*5,0,13+%i*0.5];
72 if or(full(v)<>a) then pause,end
73 //-------------------------------------------------------------
74 //test de la primitives spget
75 //--------------------------------------------------------------
76 sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
77 [ij,v]=spget(sp);
78 if or(ij<>[1,3;1,5;1,6;2,1;2,4;4,3;4,4;5,1;6,6])|or(v<>[3;2;1;5;4;7;6;8;9]) then pause,end
79 zer=sparse([],[],[6,6]);[ij,v]=spget(zer);
80 if ij<>[]|v<>[] then pause,end
81 //-----------------------------------------------
82 // addition and substraction tests
83 //-----------------------------------------------
84 // -- real real
85 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
86 b=sparse([1 6;1 2;6 5],[-1;-1;-1],[6 6]);
87 v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
88 vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
89 ma=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9),[6 6]);
90 mb=sparse([1 6;1 2;6 5],-[-1;-1;-1],[6 6]);
91 zer=sparse([],[],[6,6]);
92 ac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
93 bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
94 vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
95 vct=sparse([1 2;1 3;1 4;1 6],[10-3*%i;11;12+5*%i;13+0.5*%i],[1,6]);
96 mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
97 mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
98 if or(full(v+sparse([],[],[6,1]))<>full(v)) then pause,end
99 if or(full(sparse([],[],[6,1])+v)<>full(v)) then pause,end
100 if or(full(v+v)<>full(v)+full(v)) then pause,end
101 if or(full(v-v)<>full(v)-full(v)) then pause,end
102 if or(full(vt+sparse([],[],[1,6]))<>full(vt)) then pause,end
103 if or(full(vt+vt)<>full(vt)+full(vt)) then pause,end
104 if or(full(vt-vt)<>full(vt)-full(vt)) then pause,end
105 if or(full(zer+zer)<>0*ones(6,6)) then pause,end
106 if or(full(a+a)<>full(a)+full(a)) then pause,end
107 if or(full(b+b)<>full(b)+full(b)) then pause,end
108 if or(full(a+zer)<>full(a)) then pause,end
109 if or(full(zer+a)<>full(a)) then pause,end
110 if or(full(b+a)<>full(b)+full(a)) then pause,end
111 if or(full(a+b)<>full(b)+full(a)) then pause,end
112 if or(full(a+ma)<>full(a)+full(ma)) then pause,end
113 if or(full(a-a)<>full(a)-full(a)) then pause,end
114 if or(full(a-ma)<>full(a)-full(ma)) then pause,end
115 if or(full(b-mb)<>full(b)-full(mb)) then pause,end
116 if or(full(a-zer)<>full(a)) then pause,end
117 if or(full(zer-a)<>-full(a)) then pause,end
118 if or(full(a-mb)<>full(a)-full(mb)) then pause,end
119 //  -- real complex
120 if or(full(sparse([],[],[6,1])+vc)<>full(vc)) then pause,end
121 if or(full(v+vc)<>full(v)+full(vc)) then pause,end
122 if or(full(v-vc)<>full(v)-full(vc)) then pause,end
123 if or(full(vt+vct)<>full(vt)+full(vct)) then pause,end
124 if or(full(vt-vct)<>full(vt)-full(vct)) then pause,end
125 if or(full(a+ac)<>full(a)+full(ac)) then pause,end
126 if or(full(b+bc)<>full(b)+full(bc)) then pause,end
127 if or(full(a+bc)<>full(a)+full(bc)) then pause,end
128 if or(full(zer+ac)<>full(zer)+full(ac)) then pause,end
129 if or(full(b+ac)<>full(b)+full(ac)) then pause,end
130 if or(full(a-ac)<>full(a)-full(ac)) then pause,end
131 if or(full(b-bc)<>full(b)-full(bc)) then pause,end
132 if or(full(a-bc)<>full(a)-full(bc)) then pause,end
133 if or(full(zer-ac)<>full(zer)-full(ac)) then pause,end
134 if or(full(b-ac)<>full(b)-full(ac)) then pause,end
135 // -- complex real
136 if or(full(vc+v)<>full(vc)+full(v)) then pause,end
137 if or(full(vc-v)<>full(vc)-full(v)) then pause,end
138 if or(full(vct+vt)<>full(vct)+full(vt)) then pause,end
139 if or(full(vct-vt)<>full(vct)-full(vt)) then pause,end
140 if or(full(ac+a)<>full(ac)+full(a)) then pause,end
141 if or(full(bc+b)<>full(bc)+full(b)) then pause,end
142 if or(full(ac+b)<>full(ac)+full(b)) then pause,end
143 if or(full(ac+zer)<>full(zer)+full(ac)) then pause,end
144 if or(full(bc+a)<>full(bc)+full(a)) then pause,end
145 if or(full(ac-a)<>full(ac)-full(a)) then pause,end
146 if or(full(bc-b)<>full(bc)-full(b)) then pause,end
147 if or(full(ac-b)<>full(ac)-full(b)) then pause,end
148 if or(full(ac-zer)<>-full(zer)+full(ac)) then pause,end
149 if or(full(bc-a)<>full(bc)-full(a)) then pause,end
150 // -- complex complex
151 if or(full(vc+vc)<>full(vc)+full(vc)) then pause,end
152 if or(full(vc-vc)<>full(vc)-full(vc)) then pause,end
153 if or(full(vct+vct)<>full(vct)+full(vct)) then pause,end
154 if or(full(vct-vct)<>full(vct)-full(vct)) then pause,end
155 if or(full(ac+ac)<>full(ac)+full(ac)) then pause,end
156 if or(full(bc+bc)<>full(bc)+full(bc)) then pause,end
157 if or(full(ac+bc)<>full(ac)+full(bc)) then pause,end
158 if or(full(bc+ac)<>full(bc)+full(ac)) then pause,end
159 if or(full(ac-ac)<>full(zer)) then pause,end
160 if or(full(bc-bc)<>full(zer)) then pause,end
161 if or(full(ac-bc)<>full(ac)-full(bc)) then pause,end
162 if or(full(bc-ac)<>full(bc)-full(ac)) then pause,end
163 // sparse full and full sparse operation (soft coded apoerations)
164 if or(full(a+1)<>full(a)+1) then pause,end
165 if or(full(1+a)<>full(a)+1) then pause,end
166 if or(full(a+ones(6,6))<>full(a)+ones(6,6)) then pause,end
167 if or(full(ones(6,6)+a)<>full(a)+ones(6,6)) then pause,end
168 if or(full(a+2*eye())<>full(a)+2*eye()) then pause,end
169 if or(full(2*eye()+a)<>full(a)+2*eye()) then pause,end
170 if or(full(a-1)<>full(a)-1) then pause,end
171 if or(full(1-a)<>1-full(a)) then pause,end
172 if or(full(a-ones(6,6))<>full(a)-ones(6,6)) then pause,end
173 if or(full(ones(6,6)-a)<>ones(6,6)-full(a)) then pause,end
174 if or(full(a-2*eye())<>full(a)-2*eye()) then pause,end
175 if or(full(2*eye()-a)<>2*eye()-full(a)) then pause,end
176 if or(full(ac+1)<>full(ac)+1) then pause,end
177 if or(full(1+ac)<>full(ac)+1) then pause,end
178 if or(full(ac+ones(6,6))<>full(ac)+ones(6,6)) then pause,end
179 if or(full(ones(6,6)+ac)<>full(ac)+ones(6,6)) then pause,end
180 if or(full(ac+2*eye())<>full(ac)+2*eye()) then pause,end
181 if or(full(2*eye()+ac)<>full(ac)+2*eye()) then pause,end
182 if or(full(ac-1)<>full(ac)-1) then pause,end
183 if or(full(1-ac)<>1-full(ac)) then pause,end
184 if or(full(ac-ones(6,6))<>full(ac)-ones(6,6)) then pause,end
185 if or(full(ones(6,6)-ac)<>ones(6,6)-full(ac)) then pause,end
186 if or(full(ac-2*eye())<>full(ac)-2*eye()) then pause,end
187 if or(full(2*eye()-ac)<>2*eye()-full(ac)) then pause,end
188 if or(full(ac+full(bc))<>full(ac)+full(bc)) then pause,end
189 if or(full(ac-full(bc))<>full(ac)-full(bc)) then pause,end
190 if or(full(full(ac)+full(bc))<>full(ac)+full(bc)) then pause,end
191 end
192 if %t then
193 //-----------------------------------------------
194 // multiplication tests
195 //-----------------------------------------------
196 // real x real
197 // sparse scalar , saclar sparse
198 if or(full(a*2)<>full(a)*2) then pause,end
199 if or(full(2*a)<>full(a)*2) then pause,end
200 if  a*[]<>[] then pause,end
201 if  []*a<>[] then pause,end
202 c=rand(6,6);
203 if norm(a*c-full(a)*c) >100*%eps then pause,end
204 if norm(c*a-c*full(a)) >100*%eps then pause,end
205 // sparse sparse
206 if or(full(zer*zer)<>full(zer)) then pause,end
207 if or(full(a*zer)<>full(zer)) then pause,end
208 if or(full(zer*a)<>full(zer)) then pause,end
209 if  norm(full(a*a)-full(a)*full(a),1)>100*%eps then pause,end
210 if  norm(full(b*b)-full(b)*full(b),1)>100*%eps then pause,end
211 if  norm(full(a*b)-full(a)*full(b),1)>100*%eps then pause,end
212 if  norm(full(b*a)-full(b)*full(a),1)>100*%eps then pause,end
213 // complex x real real x complex
214 // sparse scalar , scalar sparse
215 if or(full(ac*2)<>full(ac)*2) then pause,end
216 if or(full(2*ac)<>full(ac)*2) then pause,end
217 if norm(full((2+%i)*a)-(2+%i)*full(a),1) >100*%eps then pause,end
218 if norm(full(a*(2+%i))-(2+%i)*full(a),1) >100*%eps then pause,end
219 if  ac*[]<>[] then pause,end
220 if  []*ac<>[] then pause,end
221 c=rand(6,6);
222 cc=c+rand(6,6)*%i;
223 if norm(ac*c-full(ac)*c) >100*%eps then pause,end
224 if norm(cc*a-cc*full(a)) >100*%eps then pause,end
225 // sparse sparse
226 if or(full(ac*zer)<>full(zer)) then pause,end
227 if or(full(zer*ac)<>full(zer)) then pause,end
228 if  norm(full(ac*a)-full(ac)*full(a),1)>100*%eps then pause,end
229 if  norm(full(bc*b)-full(bc)*full(b),1)>100*%eps then pause,end
230 if  norm(full(a*bc)-full(a)*full(bc),1)>100*%eps then pause,end
231 if  norm(full(b*ac)-full(b)*full(ac),1)>100*%eps then pause,end
232 // // complex x complex
233 if norm(ac*cc-full(ac)*cc) >100*%eps then pause,end
234 if norm(cc*ac-cc*full(ac)) >100*%eps then pause,end
235 // sparse sparse
236 if  norm(full(ac*ac)-full(ac)*full(ac),1)>100*%eps then pause,end
237 if  norm(full(bc*bc)-full(bc)*full(bc),1)>100*%eps then pause,end
238 if  norm(full(bc*ac)-full(bc)*full(ac),1)>100*%eps then pause,end
239 //----------------------------------------------------------
240 // element wise multiplication tests
241 //----------------------------------------------------------
242 if or(full(ac.*2)<>full(ac)*2) then pause,end
243 if or(full((2).*ac)<>full(ac)*2) then pause,end
244 if  a.*[]<>[] then pause,end
245 if  [].*a<>[] then pause,end
246 c=rand(6,6);
247 //if norm(a*c-full(a)*c) >100*%eps then pause,end
248 //if norm(c*a-c*full(a)) >100*%eps then pause,end
249 // sparse sparse
250 if or(full(zer.*zer)<>full(zer)) then pause,end
251 if or(full(a.*zer)<>full(zer)) then pause,end
252 if or(full(zer.*a)<>full(zer)) then pause,end
253 if  norm(full(a.*a)-full(a).*full(a),1)>100*%eps then pause,end
254 if  norm(full(b.*b)-full(b).*full(b),1)>100*%eps then pause,end
255 if  norm(full(a.*b)-full(a).*full(b),1)>100*%eps then pause,end
256 if  norm(full(b.*a)-full(b).*full(a),1)>100*%eps then pause,end
257 // complex x real real x complex
258 // sparse scalar , scalar sparse
259 if norm(full((2+%i).*a)-(2+%i).*full(a),1) >100*%eps then pause,end
260 if norm(full(a.*(2+%i))-(2+%i).*full(a),1) >100*%eps then pause,end
261 if  ac.*[]<>[] then pause,end
262 if  [].*ac<>[] then pause,end
263 c=rand(6,6);
264 cc=c+rand(6,6)*%i;
265 if norm(full(ac.*c)-full(ac).*c) >100*%eps then pause,end
266 if norm(full(cc.*a)-cc.*full(a)) >100*%eps then pause,end
267 // sparse sparse
268 if or(full(ac.*zer)<>full(zer)) then pause,end
269 if or(full(zer.*ac)<>full(zer)) then pause,end
270 if  norm(full(ac.*a)-full(ac).*full(a),1)>100*%eps then pause,end
271 if  norm(full(bc.*b)-full(bc).*full(b),1)>100*%eps then pause,end
272 if  norm(full(a.*bc)-full(a).*full(bc),1)>100*%eps then pause,end
273 if  norm(full(b.*ac)-full(b).*full(ac),1)>100*%eps then pause,end
274 // // complex x complex
275 if norm(ac.*cc-full(ac).*cc) >100*%eps then pause,end
276 if norm(cc.*ac-cc.*full(ac)) >100*%eps then pause,end
277 // sparse sparse
278 if  norm(full(ac.*ac)-full(ac).*full(ac),1)>100*%eps then pause,end
279 if  norm(full(bc.*bc)-full(bc).*full(bc),1)>100*%eps then pause,end
280 if  norm(full(bc.*ac)-full(bc).*full(ac),1)>100*%eps then pause,end
281 // ----------------------------------------------------------
282 // test de la transposition
283 //-----------------------------------------------------------
284 if or(full(a')<>full(a)') then pause,end
285 if or(full(ac')<>full(ac)') then pause,end
286 if or(full(zer')<>full(zer)' ) then pause,end
287 v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
288 if or(full(v')<>full(v)') then pause,end
289 if or(full((v')')<>full(v)) then pause,end
290 vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
291 if or(full(vc')<>full(vc)') then pause,end
292 if or(full((vc')')<>full(vc)) then pause,end
293 // ----------------------------------------------------------
294 // test des concatenation
295 //-----------------------------------------------------------
296 if or(full([a])<>full(a)) then pause,end
297 if or(full([a b])<>[full(a) full(b)]) then pause,end
298 if or(full([a;b])<>[full(a);full(b)]) then pause,end
299 if or(full([a []])<>full(a)) then pause,end
300 if or(full([a;[]])<>full(a)) then pause,end
301 if or(full([a zer])<>[full(a) full(zer)]) then pause,end
302 if or(full([zer;b])<>[full(zer);full(b)]) then pause,end
303 if or(full([ac])<>full(ac)) then pause,end
304 if or(full([ac b])<>[full(ac) full(b)]) then pause,end
305 if or(full([ac;b])<>[full(ac);full(b)]) then pause,end
306 if or(full([ac []])<>full(ac)) then pause,end
307 if or(full([ac;[]])<>full(ac)) then pause,end
308 if or(full([a bc])<>[full(a) full(bc)]) then pause,end
309 if or(full([a;bc])<>[full(a);full(bc)]) then pause,end
310 if or(full([ac bc])<>[full(ac) full(bc)]) then pause,end
311 if or(full([ac;bc])<>[full(ac);full(bc)]) then pause,end
312 // ----------------------------------------------------------
313 // test des extractions
314 //-----------------------------------------------------------
315 af=full(a);
316 if or(full(a(1,3))<>af(1,3)) then pause,end
317 if or(full(a(1,4))<>af(1,4)) then pause,end
318 if or(full(a(1,:))<>af(1,:)) then pause,end
319 v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);vf=full(v);
320 if or(full(v(:))<>vf(:)) then pause,end
321 if or(full(v(3:4))<>vf(3:4)) then pause,end
322 if or(full(v([1 5]))<>vf([1 5])) then pause,end
323 if or(full(v([4 3]))<>vf([4 3])) then pause,end
324 if or(full(v([4 4]))<>vf([4 4])) then pause,end
325 if or(full(v([1 1]))<>vf([1 1])) then pause,end
326 v=v';vf=vf';
327 if or(full(v(:))<>vf(:)) then pause,end
328 if or(full(v(3:4))<>vf(3:4)) then pause,end
329 if or(full(v([1 5]))<>vf([1 5])) then pause,end
330 if or(full(v([4 3]))<>vf([4 3])) then pause,end
331 if or(full(v([4 4]))<>vf([4 4])) then pause,end
332 if or(full(v([1 1]))<>vf([1 1])) then pause,end
333 acff=full(ac);
334 if or(full(ac(1,3))<>acff(1,3)) then pause,end
335 if or(full(ac(1,4))<>acff(1,4)) then pause,end
336 if or(full(ac(1,:))<>acff(1,:)) then pause,end
337 vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);vcf=full(vc);
338 if or(full(vc(:))<>vcf(:)) then pause,end
339 if or(full(vc(3:4))<>vcf(3:4)) then pause,end
340 if or(full(vc([1 5]))<>vcf([1 5])) then pause,end
341 if or(full(vc([4 3]))<>vcf([4 3])) then pause,end
342 if or(full(vc([4 4]))<>vcf([4 4])) then pause,end
343 if or(full(vc([1 1]))<>vcf([1 1])) then pause,end
344 vc=vc';vcf=vcf';
345 if or(full(vc(:))<>vcf(:)) then pause,end
346 if or(full(vc(3:4))<>vcf(3:4)) then pause,end
347 if or(full(vc([1 5]))<>vcf([1 5])) then pause,end
348 if or(full(vc([4 3]))<>vcf([4 3])) then pause,end
349 if or(full(vc([4 4]))<>vcf([4 4])) then pause,end
350 if or(full(vc([1 1]))<>vcf([1 1])) then pause,end
351 // ----------------------------------------------------------
352 // test des insertions
353 //-----------------------------------------------------------
354 end
355 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
356 vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
357 // full line insertion
358 //----------------------
359 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
360 if or(full(a1)<>A) then pause,end
361 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
362 if or(full(a1)<>A) then pause,end
363 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
364 if or(full(a1)<>A) then pause,end
365 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
366 if or(full(a1)<>A) then pause,end
367 a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
368 if or(full(a1)<>A) then pause,end
369 a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
370 if or(full(a1)<>A) then pause,end
371 a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([1 3],:)=[Vt;2*Vt];
372 if or(full(a1)<>A) then pause,end
373 a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([3 1],:)=[Vt;2*Vt];
374 if or(full(a1)<>A) then pause,end
375 a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);Vt=full(vt);A([1 3 1],:)=[Vt;2*Vt;3*Vt];
376 if or(full(a1)<>A) then pause,end
377 //  insert zero vector
378 vt=sparse([],[],[1,6]);
379 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
380 if or(full(a1)<>A) then pause,end
381 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
382 if or(full(a1)<>A) then pause,end
383 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
384 if or(full(a1)<>A) then pause,end
385 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
386 if or(full(a1)<>A) then pause,end
387 a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
388 if or(full(a1)<>A) then pause,end
389 a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
390 if or(full(a1)<>A) then pause,end
391 a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([1 3],:)=[Vt;2*Vt];
392 if or(full(a1)<>A) then pause,end
393 a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([3 1],:)=[Vt;2*Vt];
394 if or(full(a1)<>A) then pause,end
395 a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);Vt=full(vt);A([1 3 1],:)=[Vt;2*Vt;3*Vt];
396 if or(full(a1)<>A) then pause,end
397 a=sparse([],[],[6,6]);
398 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
399 if or(full(a1)<>A) then pause,end
400 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
401 if or(full(a1)<>A) then pause,end
402 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
403 if or(full(a1)<>A) then pause,end
404 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
405 if or(full(a1)<>A) then pause,end
406 a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
407 if or(full(a1)<>A) then pause,end
408 a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
409 if or(full(a1)<>A) then pause,end
410 b=sparse([1 1;1 3;1 6;2 1;2 2;2 4],10:15,[2,6]);
411 a1=a;a1([1 3],:)=b;A=full(a);B=full(b);A([1 3],:)=B;
412 if or(full(a1)<>A) then pause,end
413 a1=a;a1([3 1],:)=b;A=full(a);B=full(b);A([3 1],:)=B;
414 if or(full(a1)<>A) then pause,end
415 b=sparse([1 1;1 3;1 6;2 1;2 2;2 4;3 3;3 5],10:17,[3,6]);
416 a1=a;a1([1 3 1],:)=b;A=full(a);B=full(b);A([1 3 1],:)=B;
417 if or(full(a1)<>A) then pause,end
418 //  insert zero vector
419 vt=sparse([],[],[1,6]);
420 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
421 if or(full(a1)<>A) then pause,end
422 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
423 if or(full(a1)<>A) then pause,end
424 a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
425 if or(full(a1)<>A) then pause,end
426 a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
427 if or(full(a1)<>A) then pause,end
428 a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
429 if or(full(a1)<>A) then pause,end
430 a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
431 if or(full(a1)<>A) then pause,end
432 b=sparse([1 1;1 3;1 6;2 1;2 2;2 4],10:15,[2,6]);
433 a1=a;a1([1 3],:)=b;A=full(a);B=full(b);A([1 3],:)=B;
434 if or(full(a1)<>A) then pause,end
435 a1=a;a1([3 1],:)=b;A=full(a);B=full(b);A([3 1],:)=B;
436 if or(full(a1)<>A) then pause,end
437 b=sparse([1 1;1 3;1 6;2 1;2 2;2 4;3 3;3 5],10:17,[3,6]);
438 a1=a;a1([1 3 1],:)=b;A=full(a);B=full(b);A([1 3 1],:)=B;
439 if or(full(a1)<>A) then pause,end
440 // full column insertion
441 //----------------------
442 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
443 v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
444 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
445 if or(full(a1)<>A) then pause,end
446 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
447 if or(full(a1)<>A) then pause,end
448 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
449 if or(full(a1)<>A) then pause,end
450 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
451 if or(full(a1)<>A) then pause,end
452 a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
453 if or(full(a1)<>A) then pause,end
454 //
455 a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
456 if or(full(a1)<>A) then pause,end
457 a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
458 if or(full(a1)<>A) then pause,end
459 b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
460 a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
461 if or(full(a1)<>A) then pause,end
462 a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
463 if or(full(a1)<>A) then pause,end
464 b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
465 a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
466 if or(full(a1)<>A) then pause,end
467 v=sparse([],[],[6,1]);
468 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
469 if or(full(a1)<>A) then pause,end
470 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
471 if or(full(a1)<>A) then pause,end
472 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
473 if or(full(a1)<>A) then pause,end
474 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
475 if or(full(a1)<>A) then pause,end
476 a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
477 if or(full(a1)<>A) then pause,end
478 //
479 a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
480 if or(full(a1)<>A) then pause,end
481 a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
482 if or(full(a1)<>A) then pause,end
483 b=sparse([],[],[6,2]);
484 a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
485 if or(full(a1)<>A) then pause,end
486 a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
487 if or(full(a1)<>A) then pause,end
488 b=sparse([],[],[6,3]);
489 a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
490 if or(full(a1)<>A) then pause,end
491 a=sparse([],[],[6,6]);
492 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
493 if or(full(a1)<>A) then pause,end
494 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
495 if or(full(a1)<>A) then pause,end
496 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
497 if or(full(a1)<>A) then pause,end
498 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
499 if or(full(a1)<>A) then pause,end
500 a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
501 if or(full(a1)<>A) then pause,end
502 //
503 a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
504 if or(full(a1)<>A) then pause,end
505 a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
506 if or(full(a1)<>A) then pause,end
507 b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
508 a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
509 if or(full(a1)<>A) then pause,end
510 a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
511 if or(full(a1)<>A) then pause,end
512 b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
513 a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
514 if or(full(a1)<>A) then pause,end
515 v=sparse([],[],[6,1]);
516 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
517 if or(full(a1)<>A) then pause,end
518 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
519 if or(full(a1)<>A) then pause,end
520 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
521 if or(full(a1)<>A) then pause,end
522 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
523 if or(full(a1)<>A) then pause,end
524 a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
525 if or(full(a1)<>A) then pause,end
526 //
527 a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
528 if or(full(a1)<>A) then pause,end
529 a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
530 if or(full(a1)<>A) then pause,end
531 b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
532 a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
533 if or(full(a1)<>A) then pause,end
534 a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
535 if or(full(a1)<>A) then pause,end
536 b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
537 a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
538 if or(full(a1)<>A) then pause,end
539 v=sparse([],[],[6,1]);
540 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
541 if or(full(a1)<>A) then pause,end
542 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
543 if or(full(a1)<>A) then pause,end
544 a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
545 if or(full(a1)<>A) then pause,end
546 a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
547 if or(full(a1)<>A) then pause,end
548 a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
549 if or(full(a1)<>A) then pause,end
550 //
551 a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
552 if or(full(a1)<>A) then pause,end
553 a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
554 if or(full(a1)<>A) then pause,end
555 b=sparse([],[],[6,2]);
556 a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
557 if or(full(a1)<>A) then pause,end
558 a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
559 if or(full(a1)<>A) then pause,end
560 b=sparse([],[],[6,3]);
561 a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
562 if or(full(a1)<>A) then pause,end
563 // row column insertion
564 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
565 b=sparse([1 2;1 3;3 3],-(1:3),[3,3]);
566 a1=a;a1(1,1)=sparse(30);A=full(a);A(1,1)=30;
567 if or(full(a1)<>A) then pause,end
568 a1=a;a1(1,6)=sparse(30);A=full(a);A(1,6)=30;
569 if or(full(a1)<>A) then pause,end
570 a1=a;a1(1,8)=sparse(30);A=full(a);A(1,8)=30;
571 if or(full(a1)<>A) then pause,end
572 a1=a;a1(1:3,1:3)=b;A=full(a);A(1:3,1:3)=full(b);
573 if or(full(a1)<>A) then pause,end
574 a1=a;a1(1:3,6:8)=b;A=full(a);A(1:3,6:8)=full(b);
575 if or(full(a1)<>A) then pause,end
576 a1=a;a1(6:8,1:3)=b;A=full(a);A(6:8,1:3)=full(b);
577 if or(full(a1)<>A) then pause,end
578 a1=a;a1([3 2 1],1:3)=b;A=full(a);A([3 2 1],1:3)=full(b);
579 if or(full(a1)<>A) then pause,end
580 a1=a;a1([1 2 1],1:3)=b;A=full(a);A([1 2 1],1:3)=full(b);
581 if or(full(a1)<>A) then pause,end
582 a1=a;a1([3 2 1],[3 2 1])=b;A=full(a);A([3 2 1],[3 2 1])=full(b);
583 if or(full(a1)<>A) then pause,end
584 a1=a;a1([1 2 1],[3 2 1])=b;A=full(a);A([1 2 1],[3 2 1])=full(b);
585 if or(full(a1)<>A) then pause,end
586 a1=a;a1([1 2 1],[1 2 1])=b;A=full(a);A([1 2 1],[1 2 1])=full(b);
587 if or(full(a1)<>A) then pause,end
588 //sparse full
589 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
590 vt=11:16;
591 // full line insertion
592 //----------------------
593 a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
594 if or(full(a1)<>A) then pause,end
595 a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
596 if or(full(a1)<>A) then pause,end
597 a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
598 if or(full(a1)<>A) then pause,end
599 a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
600 if or(full(a1)<>A) then pause,end
601 a1=a;a1(7,:)=vt;A=full(a);A(7,:)=vt;
602 if or(full(a1)<>A) then pause,end
603 a1=a;a1(8,:)=vt;A=full(a);A(8,:)=vt;
604 if or(full(a1)<>A) then pause,end
605 a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);A([1 3],:)=[vt;2*vt];
606 if or(full(a1)<>A) then pause,end
607 a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);A([3 1],:)=[vt;2*vt];
608 if or(full(a1)<>A) then pause,end
609 a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);A([1 3 1],:)=[vt;2*vt;3*vt];
610 if or(full(a1)<>A) then pause,end
611 a=sparse([],[],[6,6]);
612 a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
613 if or(full(a1)<>A) then pause,end
614 a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
615 if or(full(a1)<>A) then pause,end
616 a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
617 if or(full(a1)<>A) then pause,end
618 a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
619 if or(full(a1)<>A) then pause,end
620 a1=a;a1(7,:)=vt;A=full(a);A(7,:)=vt;
621 if or(full(a1)<>A) then pause,end
622 a1=a;a1(8,:)=vt;A=full(a);A(8,:)=vt;
623 if or(full(a1)<>A) then pause,end
624 b=[1:6;11:16];
625 a1=a;a1([1 3],:)=b;A=full(a);A([1 3],:)=b;
626 if or(full(a1)<>A) then pause,end
627 a1=a;a1([3 1],:)=b;A=full(a);A([3 1],:)=b;
628 if or(full(a1)<>A) then pause,end
629 b=[1:6;11:16;21:26];
630 a1=a;a1([1 3 1],:)=b;A=full(a);A([1 3 1],:)=b;
631 if or(full(a1)<>A) then pause,end
632 // full column insertion
633 //----------------------
634 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
635 v=(1:6)';
636 a1=a;a1(:,1)=v;A=full(a);A(:,1)=v;
637 if or(full(a1)<>A) then pause,end
638 a1=a;a1(:,2)=v;A=full(a);A(:,2)=v;
639 if or(full(a1)<>A) then pause,end
640 a1=a;a1(:,1)=v;A=full(a);A(:,1)=v;
641 if or(full(a1)<>A) then pause,end
642 a1=a;a1(:,2)=v;A=full(a);A(:,2)=v;
643 if or(full(a1)<>A) then pause,end
644 a1=a;a1(:,3)=v;A=full(a);A(:,3)=v;
645 if or(full(a1)<>A) then pause,end
646 //
647 a1=a;a1(:,7)=v;A=full(a);A(:,7)=v;
648 if or(full(a1)<>A) then pause,end
649 a1=a;a1(:,8)=v;A=full(a);A(:,8)=v;
650 if or(full(a1)<>A) then pause,end
651 b=[(1:6)' (11:16)'];
652 a1=a;a1(:,[1 3])=b;A=full(a);A(:,[1 3])=b;
653 if or(full(a1)<>A) then pause,end
654 a1=a;a1(:,[3 1])=b;A=full(a);A(:,[3 1])=b;
655 if or(full(a1)<>A) then pause,end
656 b=[(1:6)' (11:16)' (21:26)'];
657 a1=a;a1(:,[1 3 1])=b;A=full(a);A(:,[1 3 1])=b;
658 if or(full(a1)<>A) then pause,end
659 //********
660 // row column insertion
661 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
662 b=-[1 2 3;4 5 6;7 8 9];
663 a1=a;a1(1,1)=30;A=full(a);A(1,1)=30;
664 if or(full(a1)<>A) then pause,end
665 a1=a;a1(1,6)=30;A=full(a);A(1,6)=30;
666 if or(full(a1)<>A) then pause,end
667 a1=a;a1(1,8)=30;A=full(a);A(1,8)=30;
668 if or(full(a1)<>A) then pause,end
669 a1=a;a1(1:3,1:3)=b;A=full(a);A(1:3,1:3)=b;
670 if or(full(a1)<>A) then pause,end
671 a1=a;a1(1:3,6:8)=b;A=full(a);A(1:3,6:8)=b;
672 if or(full(a1)<>A) then pause,end
673 a1=a;a1(6:8,1:3)=b;A=full(a);A(6:8,1:3)=b;
674 if or(full(a1)<>A) then pause,end
675 a1=a;a1([3 2 1],1:3)=b;A=full(a);A([3 2 1],1:3)=b;
676 if or(full(a1)<>A) then pause,end
677 a1=a;a1([1 2 1],1:3)=b;A=full(a);A([1 2 1],1:3)=b;
678 if or(full(a1)<>A) then pause,end
679 a1=a;a1([3 2 1],[3 2 1])=b;A=full(a);A([3 2 1],[3 2 1])=b;
680 if or(full(a1)<>A) then pause,end
681 a1=a;a1([1 2 1],[3 2 1])=b;A=full(a);A([1 2 1],[3 2 1])=b;
682 if or(full(a1)<>A) then pause,end
683 a1=a;a1([1 2 1],[1 2 1])=b;A=full(a);A([1 2 1],[1 2 1])=b;
684 if or(full(a1)<>A) then pause,end
685 // vector insertion
686 v=sparse([1 1;3 1;6 1],[10 11 12],[6 1]);
687 v1=v;v1(1)=33;V=full(v);V(1)=33;
688 if or(full(v1)<>V) then pause,end
689 v1=v;v1(2)=33;V=full(v);V(2)=33;
690 if or(full(v1)<>V) then pause,end
691 v1=v;v1(8)=33;V=full(v);V(8)=33;
692 if or(full(v1)<>V) then pause,end
693 v1=v;v1([1 2 8])=[5;10;33];V=full(v);V([1 2 8])=[5;10;33];
694 if or(full(v1)<>V) then pause,end
695 v1=v;v1(:)=[];
696 if or(full(v1)<>[]) then pause,end
697 v1=v;v1(1)=sparse(33);V=full(v);V(1)=33;
698 if or(full(v1)<>V) then pause,end
699 v1=v;v1(2)=sparse(33);V=full(v);V(2)=33;
700 if or(full(v1)<>V) then pause,end
701 v1=v;v1(8)=sparse(33);V=full(v);V(8)=33;
702 if or(full(v1)<>V) then pause,end
703 v1=v;v1([1 2 8])=sparse([5;10;33]);V=full(v);V([1 2 8])=[5;10;33];
704 if or(full(v1)<>V) then pause,end
705 v1=v;v1([1 2 1])=sparse([5;10;33]);V=full(v);V([1 2 1])=[5;10;33];
706 if or(full(v1)<>V) then pause,end
707 v1=v;v1(:)=[];
708 if or(full(v1)<>[]) then pause,end
709 v1=v;v1(:)=sparse([2 1],44,[6 1]);V=full(v);V(:)=[0;44;0;0;0;0];
710 if or(full(v1)<>V) then pause,end
711 v=v';
712 v1=v;v1(1)=33;V=full(v);V(1)=33;
713 if or(full(v1)<>V) then pause,end
714 v1=v;v1(2)=33;V=full(v);V(2)=33;
715 if or(full(v1)<>V) then pause,end
716 v1=v;v1(8)=33;V=full(v);V(8)=33;
717 if or(full(v1)<>V) then pause,end
718 v1=v;v1([1 2 8])=[5 10 33];V=full(v);V([1 2 8])=[5 10 33];
719 if or(full(v1)<>V) then pause,end
720 v1=v;v1(1)=sparse(33);V=full(v);V(1)=33;
721 if or(full(v1)<>V) then pause,end
722 v1=v;v1(2)=sparse(33);V=full(v);V(2)=33;
723 if or(full(v1)<>V) then pause,end
724 v1=v;v1(8)=sparse(33);V=full(v);V(8)=33;
725 if or(full(v1)<>V) then pause,end
726 v1=v;v1([1 2 8])=sparse([5 10 33]);V=full(v);V([1 2 8])=[5 10 33];
727 if or(full(v1)<>V) then pause,end
728 v1=v;v1([1 2 1])=sparse([5 10 33]);V=full(v);V([1 2 1])=[5 10 33];
729 if or(full(v1)<>V) then pause,end
730 v1=v;v1(:)=sparse([1 2],44,[1,6]);V=full(v);V(:)=[0 44 0 0 0 0];
731 if or(full(v1)<>V) then pause,end
732 v1=v;v1(1)=[];V=full(v);V(1)=[];
733 if or(full(v1)<>V) then pause,end
734 //test des comparaisons
735 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
736 b=sparse([1 6;1 2;6 5],[10;-1;-1],[6 6]);
737 if full(a==a)<>full(a)==full(a) then pause,end
738 if full(a<>a)<>(full(a)<>full(a)) then pause,end
739 if full(a>sparse(5))<>(full(a)>5) then pause,end
740 if full(sparse(5)>a)<>(5>full(a)) then pause,end
741 if full(b>a)<>(full(b)>full(a))  then pause,end
742 if full(a==full(a))<>full(a)==full(a) then pause,end
743 if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
744 if full(a>5)<>(full(a)>5) then pause,end
745 if full(5>a)<>(5>full(a)) then pause,end
746 if full(b>full(a))<>(full(b)>full(a))  then pause,end
747 if full(full(a)==a)<>full(a)==full(a) then pause,end
748 if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
749 if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
750 if full(full(b)>a)<>(full(b)>full(a))  then pause,end
751 a=sparse([1 1;3 1;6 1],[10 11 12],[6 1]);
752 if full(a==a)<>full(a)==full(a) then pause,end
753 if full(a<>a)<>(full(a)<>full(a)) then pause,end
754 if full(a>sparse(5))<>(full(a)>5) then pause,end
755 if full(sparse(5)>a)<>(5>full(a)) then pause,end
756 if full(a==full(a))<>full(a)==full(a) then pause,end
757 if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
758 if full(a>5)<>(full(a)>5) then pause,end
759 if full(5>a)<>(5>full(a)) then pause,end
760 if full(full(a)==a)<>full(a)==full(a) then pause,end
761 if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
762 if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
763 a=a';
764 if full(a==a)<>full(a)==full(a) then pause,end
765 if full(a<>a)<>(full(a)<>full(a)) then pause,end
766 if full(a>sparse(5))<>(full(a)>5) then pause,end
767 if full(sparse(5)>a)<>(5>full(a)) then pause,end
768 if full(a==full(a))<>full(a)==full(a) then pause,end
769 if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
770 if full(a>5)<>(full(a)>5) then pause,end
771 if full(5>a)<>(5>full(a)) then pause,end
772 if full(full(a)==a)<>full(a)==full(a) then pause,end
773 if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
774 if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
775 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
776 b=sparse([1 6;1 2;5 5],[10;-1;-1],[5 6]);
777 if a==b<>%f then pause,end
778 if a<>b<>%t then pause,end