0001 function t_mplinsolve(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 1
0015 quiet = 0;
0016 end
0017
0018 t_begin(4, quiet);
0019
0020 ijs = [
0021 1 1 1205.63;
0022 4 1 -1205.63;
0023 25 1 17.3611;
0024 28 1 -17.3611;
0025 43 1 1;
0026 2 2 1024;
0027 8 2 -1024;
0028 26 2 16;
0029 32 2 -16;
0030 3 3 1164.84;
0031 6 3 -1164.84;
0032 27 3 17.0648;
0033 30 3 -17.0648;
0034 1 4 -1205.63;
0035 4 4 2201.34;
0036 5 4 -453.695;
0037 9 4 -542.009;
0038 13 4 0.776236;
0039 14 4 -0.451721;
0040 18 4 -0.324515;
0041 25 4 -17.3611;
0042 28 4 39.4759;
0043 29 4 -10.5107;
0044 33 4 -11.6041;
0045 37 4 -3.30738;
0046 38 4 1.94219;
0047 42 4 1.36519;
0048 4 5 -453.695;
0049 5 5 581.372;
0050 6 5 -127.677;
0051 13 5 -0.451721;
0052 14 5 0.568201;
0053 15 5 -0.11648;
0054 28 5 -10.5107;
0055 29 5 16.0989;
0056 30 5 -5.58824;
0057 37 5 1.94219;
0058 38 5 -3.2242;
0059 39 5 1.28201;
0060 3 6 -1164.84;
0061 5 6 -127.677;
0062 6 6 1676.74;
0063 7 6 -384.227;
0064 14 6 -0.11648;
0065 15 6 0.163059;
0066 16 6 -0.0465791;
0067 27 6 -17.0648;
0068 29 6 -5.58824;
0069 30 6 32.4374;
0070 31 6 -9.78427;
0071 38 6 1.28201;
0072 39 6 -2.4371;
0073 40 6 1.15509;
0074 6 7 -384.227;
0075 7 7 1141.16;
0076 8 7 -756.935;
0077 15 7 -0.0465791;
0078 16 7 0.371828;
0079 17 7 -0.325249;
0080 30 7 -9.78427;
0081 31 7 23.4822;
0082 32 7 -13.698;
0083 39 7 1.15509;
0084 40 7 -2.77221;
0085 41 7 1.61712;
0086 2 8 -1024;
0087 7 8 -756.935;
0088 8 8 1925.77;
0089 9 8 -144.836;
0090 16 8 -0.325249;
0091 17 8 0.844105;
0092 18 8 -0.518855;
0093 26 8 -16;
0094 31 8 -13.698;
0095 32 8 35.6731;
0096 33 8 -5.97513;
0097 40 8 1.61712;
0098 41 8 -2.80473;
0099 42 8 1.1876;
0100 4 9 -542.009;
0101 8 9 -144.836;
0102 9 9 686.845;
0103 13 9 -0.324515;
0104 17 9 -0.518855;
0105 18 9 0.84337;
0106 28 9 -11.6041;
0107 32 9 -5.97513;
0108 33 9 17.5792;
0109 37 9 1.36519;
0110 41 9 1.1876;
0111 42 9 -2.55279;
0112 10 10 1207.63;
0113 13 10 -1205.63;
0114 34 10 17.3611;
0115 37 10 -17.3611;
0116 11 11 1026;
0117 17 11 -1024;
0118 35 11 16;
0119 41 11 -16;
0120 12 12 1166.84;
0121 15 12 -1164.84;
0122 36 12 17.0648;
0123 39 12 -17.0648;
0124 4 13 0.776236;
0125 5 13 -0.451721;
0126 9 13 -0.324515;
0127 10 13 -1205.63;
0128 13 13 2190.83;
0129 14 13 -447.892;
0130 18 13 -535.137;
0131 28 13 3.30738;
0132 29 13 -1.94219;
0133 33 13 -1.36519;
0134 34 13 -17.3611;
0135 37 13 39.1419;
0136 38 13 -10.5107;
0137 42 13 -11.6041;
0138 4 14 -0.451721;
0139 5 14 0.568201;
0140 6 14 -0.11648;
0141 13 14 -447.892;
0142 14 14 573.221;
0143 15 14 -122.862;
0144 28 14 -1.94219;
0145 29 14 3.2242;
0146 30 14 -1.28201;
0147 37 14 -10.5107;
0148 38 14 15.5829;
0149 39 14 -5.58824;
0150 5 15 -0.11648;
0151 6 15 0.163059;
0152 7 15 -0.0465791;
0153 12 15 -1164.84;
0154 14 15 -122.862;
0155 15 15 1669.87;
0156 16 15 -379.651;
0157 29 15 -1.28201;
0158 30 15 2.4371;
0159 31 15 -1.15509;
0160 36 15 -17.0648;
0161 38 15 -5.58824;
0162 39 15 31.8704;
0163 40 15 -9.78427;
0164 6 16 -0.0465791;
0165 7 16 0.371828;
0166 8 16 -0.325249;
0167 15 16 -379.651;
0168 16 16 1131.92;
0169 17 16 -750.073;
0170 30 16 -1.15509;
0171 31 16 2.77221;
0172 32 16 -1.61712;
0173 39 16 -9.78427;
0174 40 16 23.1242;
0175 41 16 -13.698;
0176 7 17 -0.325249;
0177 8 17 0.844105;
0178 9 17 -0.518855;
0179 11 17 -1024;
0180 16 17 -750.073;
0181 17 17 1914.92;
0182 18 17 -138.499;
0183 31 17 -1.61712;
0184 32 17 2.80473;
0185 33 17 -1.1876;
0186 35 17 -16;
0187 40 17 -13.698;
0188 41 17 35.2181;
0189 42 17 -5.97513;
0190 4 18 -0.324515;
0191 8 18 -0.518855;
0192 9 18 0.84337;
0193 13 18 -535.137;
0194 17 18 -138.499;
0195 18 18 676.012;
0196 28 18 -1.36519;
0197 32 18 -1.1876;
0198 33 18 2.55279;
0199 37 18 -11.6041;
0200 41 18 -5.97513;
0201 42 18 17.0972;
0202 19 19 1.88667;
0203 25 19 -1;
0204 20 20 1.54931;
0205 26 20 -1;
0206 21 21 1.78346;
0207 27 21 -1;
0208 22 22 0.666667;
0209 34 22 -1;
0210 23 23 0.666667;
0211 35 23 -1;
0212 24 24 0.666667;
0213 36 24 -1;
0214 1 25 17.3611;
0215 4 25 -17.3611;
0216 19 25 -1;
0217 2 26 16;
0218 8 26 -16;
0219 20 26 -1;
0220 3 27 17.0648;
0221 6 27 -17.0648;
0222 21 27 -1;
0223 1 28 -17.3611;
0224 4 28 39.4759;
0225 5 28 -10.5107;
0226 9 28 -11.6041;
0227 13 28 3.30738;
0228 14 28 -1.94219;
0229 18 28 -1.36519;
0230 4 29 -10.5107;
0231 5 29 16.0989;
0232 6 29 -5.58824;
0233 13 29 -1.94219;
0234 14 29 3.2242;
0235 15 29 -1.28201;
0236 3 30 -17.0648;
0237 5 30 -5.58824;
0238 6 30 32.4374;
0239 7 30 -9.78427;
0240 14 30 -1.28201;
0241 15 30 2.4371;
0242 16 30 -1.15509;
0243 6 31 -9.78427;
0244 7 31 23.4822;
0245 8 31 -13.698;
0246 15 31 -1.15509;
0247 16 31 2.77221;
0248 17 31 -1.61712;
0249 2 32 -16;
0250 7 32 -13.698;
0251 8 32 35.6731;
0252 9 32 -5.97513;
0253 16 32 -1.61712;
0254 17 32 2.80473;
0255 18 32 -1.1876;
0256 4 33 -11.6041;
0257 8 33 -5.97513;
0258 9 33 17.5792;
0259 13 33 -1.36519;
0260 17 33 -1.1876;
0261 18 33 2.55279;
0262 10 34 17.3611;
0263 13 34 -17.3611;
0264 22 34 -1;
0265 11 35 16;
0266 17 35 -16;
0267 23 35 -1;
0268 12 36 17.0648;
0269 15 36 -17.0648;
0270 24 36 -1;
0271 4 37 -3.30738;
0272 5 37 1.94219;
0273 9 37 1.36519;
0274 10 37 -17.3611;
0275 13 37 39.1419;
0276 14 37 -10.5107;
0277 18 37 -11.6041;
0278 4 38 1.94219;
0279 5 38 -3.2242;
0280 6 38 1.28201;
0281 13 38 -10.5107;
0282 14 38 15.5829;
0283 15 38 -5.58824;
0284 5 39 1.28201;
0285 6 39 -2.4371;
0286 7 39 1.15509;
0287 12 39 -17.0648;
0288 14 39 -5.58824;
0289 15 39 31.8704;
0290 16 39 -9.78427;
0291 6 40 1.15509;
0292 7 40 -2.77221;
0293 8 40 1.61712;
0294 15 40 -9.78427;
0295 16 40 23.1242;
0296 17 40 -13.698;
0297 7 41 1.61712;
0298 8 41 -2.80473;
0299 9 41 1.1876;
0300 11 41 -16;
0301 16 41 -13.698;
0302 17 41 35.2181;
0303 18 41 -5.97513;
0304 4 42 1.36519;
0305 8 42 1.1876;
0306 9 42 -2.55279;
0307 13 42 -11.6041;
0308 17 42 -5.97513;
0309 18 42 17.0972;
0310 1 43 1;
0311 ];
0312 A = sparse(ijs(:, 1), ijs(:, 2), ijs(:, 3));
0313 b = [
0314 0;
0315 0;
0316 0;
0317 0;
0318 0;
0319 0;
0320 0;
0321 0;
0322 0;
0323 0;
0324 0;
0325 0;
0326 -0.00896054;
0327 -0.0617829;
0328 -0.0772931;
0329 -0.0230638;
0330 -0.0185934;
0331 -0.02;
0332 -0.336;
0333 -0.2755;
0334 -0.353;
0335 0;
0336 0;
0337 0;
0338 1.3;
0339 1.55;
0340 1.4;
0341 0;
0342 -0.9;
0343 0;
0344 -1;
0345 0;
0346 -1.25;
0347 0;
0348 0;
0349 0;
0350 0.167;
0351 -0.042;
0352 0.2835;
0353 -0.171;
0354 0.2275;
0355 -0.259;
0356 0;
0357 ];
0358 ex = [
0359 0;
0360 0.04612219791119214;
0361 0.0509334351882598;
0362 -0.05953571031927305;
0363 -0.09461814898578046;
0364 -0.008909854578010561;
0365 -0.05785829019394401;
0366 -0.02232729212460287;
0367 -0.1137760871247425;
0368 -0.03062777824802364;
0369 -0.01013282572376477;
0370 -0.005330939680091628;
0371 -0.02914165388753019;
0372 -0.03376073204420303;
0373 4.021341450281111e-05;
0374 -0.01727289094763518;
0375 -0.008382063634320435;
0376 -0.04854008812629265;
0377 -0.2663945795760685;
0378 -0.4548081594272799;
0379 -0.3787862287965494;
0380 -0.02580075363496279;
0381 -0.02801219343110931;
0382 -0.09165765332863518;
0383 -0.1665986614487812;
0384 -0.4291388294822789;
0385 -0.3225500876094941;
0386 3.967864472606993;
0387 5.577372159790927;
0388 3.762341481664236;
0389 5.858342308599034;
0390 3.951628532808602;
0391 6.471657726723339;
0392 -0.01720051102355974;
0393 -0.01867480495813735;
0394 -0.06110513277164123;
0395 -0.1239317474796463;
0396 -0.1848327901217308;
0397 -0.4283638085291988;
0398 0.07640167050820651;
0399 -0.1319901818980452;
0400 0.4366406661538687;
0401 0.0007894844305239289;
0402 ];
0403
0404 t = '''''';
0405 x = mplinsolve(A, b, '', []);
0406 t_is(x, ex, 13, t);
0407
0408 t = '\';
0409 x = mplinsolve(A, b, '\', []);
0410 t_is(x, ex, 13, t);
0411
0412 t = 'PARDISO';
0413 if have_fcn('pardiso')
0414 x = mplinsolve(A, b, 'PARDISO', struct('solver', 0));
0415 t_is(x, ex, 13, [t ' : direct']);
0416
0417 [x, info] = mplinsolve(A, b, 'PARDISO', struct('solver', 1));
0418 t_is(x, ex, 1, [t ' : iterative']);
0419 else
0420 t_skip(2, [t ' not available']);
0421 end
0422
0423 t_end;