~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to tests/sparse.tst

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

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