1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187
|
profile on
test_all
TEST_ALL test the Factorize package (factorize, inverse, and related)
If you have editted the Factorize package, type "clear classes" before
running any tests.
Example
test_all % run all tests
test_all (0) ; % do not run performance tests
See also <a href="matlab:help factorize">factorize</a>, <a href="matlab:help inverse">inverse</a>, <a href="matlab:help test_performance">test_performance</a>, <a href="matlab:help test_accuracy">test_accuracy</a>, <a href="matlab:help test_disp">test_disp</a>,
<a href="matlab:help test_errors">test_errors</a>
----------Dense LU factorization:
factorize: strategy default, A has size 3-by-3, full.
factorize: try LU ... OK.
F =
class: factorization_lu_dense
dense LU factorization: A(p,:) = L*U
A: [3x3 double]
Factors:
L: [3x3 double]
U: [3x3 double]
p: [3 2 1]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
A_condest: 6.821417e+02
S =
class: factorization_lu_dense
dense LU factorization: A(p,:) = L*U
A: [3x3 double]
Factors:
L: [3x3 double]
U: [3x3 double]
p: [3 2 1]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 3
A_condest: 6.821417e+02
error: 0
Dense LU With an imaginary F.alpha: F =
class: factorization_lu_dense
dense LU factorization: A(p,:) = L*U
A: [3x3 double]
Factors:
L: [3x3 double]
U: [3x3 double]
p: [3 2 1]
is_inverse: 0
is_ctrans: 0
alpha: 3.14159 + (2)i
A_rank: 3
A_condest: 6.821417e+02
error 6.24741e-12
----------Sparse LU factorization:
factorize: strategy default, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try LU ... OK.
F =
class: factorization_lu_sparse
sparse LU factorization: P*(R\A)*Q = L*U
A: [3x3 double]
Factors:
L: [3x3 double]
U: [3x3 double]
P: [3x3 double]
Q: [3x3 double]
R: [3x3 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
A_condest: 1.004378e+02
S =
class: factorization_lu_sparse
sparse LU factorization: P*(R\A)*Q = L*U
A: [3x3 double]
Factors:
L: [3x3 double]
U: [3x3 double]
P: [3x3 double]
Q: [3x3 double]
R: [3x3 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 3
A_condest: 1.004378e+02
error: 3.12642e-17
----------Dense Cholesky factorization:
factorize: strategy default, A has size 3-by-3, full.
factorize: try CHOL ... OK.
F =
class: factorization_chol_dense
dense Cholesky factorization: A = R'*R
A: [3x3 double]
Factors:
R: [3x3 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
S =
class: factorization_chol_dense
dense Cholesky factorization: A = R'*R
A: [3x3 double]
Factors:
R: [3x3 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 3
error: 1.36648e-17
----------Sparse Cholesky factorization:
factorize: strategy default, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try CHOL ... OK.
F =
class: factorization_chol_sparse
sparse Cholesky factorization: P'*A*P = L*L'
A: [3x3 double]
Factors:
L: [3x3 double]
P: [3x3 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
S =
class: factorization_chol_sparse
sparse Cholesky factorization: P'*A*P = L*L'
A: [3x3 double]
Factors:
L: [3x3 double]
P: [3x3 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 3
error: 1.36648e-17
----------Dense QR factorization:
factorize: strategy qr, A has size 3-by-2, full.
factorize: try QR of A ... OK.
F =
class: factorization_qr_dense
dense economy QR factorization: A = Q*R
A: [3x2 double]
Factors:
Q: [3x2 double]
R: [2x2 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
S =
class: factorization_qr_dense
dense economy QR factorization: A = Q*R
A: [3x2 double]
Factors:
Q: [3x2 double]
R: [2x2 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
error: 6.22897e-16
----------Dense COD factorization:
factorize: strategy default, A has size 3-by-2, full.
factorize: try COD ... OK.
F =
class: factorization_cod_dense
dense COD factorization: A = U*R*V'
A: [3x2 double]
Factors:
U: [3x2 double]
R: [2x2 double]
V: [2x2 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
S =
class: factorization_cod_dense
dense COD factorization: A = U*R*V'
A: [3x2 double]
Factors:
U: [3x2 double]
R: [2x2 double]
V: [2x2 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
error: 4.71271e-17
----------Sparse COD factorization:
factorize: strategy cod, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try COD ... OK.
F =
class: factorization_cod_sparse
sparse COD factorization: A = U*R*V'
A: [3x2 double]
Factors:
U: [1x1 struct]
R: [3x2 double]
V: [1x1 struct]
r: 2
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
S =
class: factorization_cod_sparse
sparse COD factorization: A = U*R*V'
A: [3x2 double]
Factors:
U: [1x1 struct]
R: [3x2 double]
V: [1x1 struct]
r: 2
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
error: 6.55681e-16
----------Dense QR factorization of A':
factorize: strategy qr, A has size 2-by-3, full.
factorize: try QR of A' ... OK.
F =
class: factorization_qrt_dense
dense economy QR factorization: A' = Q*R
A: [2x3 double]
Factors:
Q: [3x2 double]
R: [2x2 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
S =
class: factorization_qrt_dense
dense economy QR factorization: A' = Q*R
A: [2x3 double]
Factors:
Q: [3x2 double]
R: [2x2 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
error: 9.85539e-16
----------Sparse QR factorization:
factorize: strategy default, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try QR of A ... OK.
F =
class: factorization_qr_sparse
sparse QR factorization of A: (A*P)'*A*P = R'*R
A: [3x2 double]
Factors:
R: [2x2 double]
P: [2x2 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
S =
class: factorization_qr_sparse
sparse QR factorization of A: (A*P)'*A*P = R'*R
A: [3x2 double]
Factors:
R: [2x2 double]
P: [2x2 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
error: 5.55647e-16
----------Sparse QR factorization of A':
factorize: strategy default, A has size 2-by-3, sparse with 6 nonzeros.
factorize: try QR of A' ... OK.
F =
class: factorization_qrt_sparse
sparse QR factorization of A': (P*A)*(P*A)' = R'*R
A: [2x3 double]
Factors:
R: [2x2 double]
P: [2x2 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
S =
class: factorization_qrt_sparse
sparse QR factorization of A': (P*A)*(P*A)' = R'*R
A: [2x3 double]
Factors:
R: [2x2 double]
P: [2x2 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
A_condest: 1.573790e+00
error: 5.55647e-16
----------SVD factorization:
factorize: strategy svd, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try SVD ... OK.
F =
class: factorization_svd
singular value decomposition: A = U*S*V'
A: [3x2 double]
Factors:
U: [3x3 double]
S: [2x1 double]
V: [2x2 double]
r: 2
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 2
A_cond: 4.580233e+00
S =
class: factorization_svd
singular value decomposition: A = U*S*V'
A: [3x2 double]
Factors:
U: [3x3 double]
S: [2x1 double]
V: [2x2 double]
r: 2
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 2
A_cond: 4.580233e+00
error: 5.24545e-16
----------Dense LDL factorization:
factorize: strategy ldl, A has size 6-by-6, full.
factorize: try LDL ... OK.
F =
class: factorization_ldl_dense
dense LDL factorization: A(p,p) = L*D*L'
A: [6x6 double]
Factors:
L: [6x6 double]
D: [6x6 double]
p: [1 4 3 6 5 2]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 6
A_condest: 3.116758e+00
S =
class: factorization_ldl_dense
dense LDL factorization: A(p,p) = L*D*L'
A: [6x6 double]
Factors:
L: [6x6 double]
D: [6x6 double]
p: [1 4 3 6 5 2]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 6
A_condest: 3.116758e+00
error: 4.60596e-17
----------Sparse LDL factorization:
factorize: strategy ldl, A has size 6-by-6, sparse with 18 nonzeros.
factorize: try LDL ... OK.
F =
class: factorization_ldl_sparse
sparse LDL factorization: P'*A*P = L*D*L'
A: [6x6 double]
Factors:
L: [6x6 double]
D: [6x6 double]
P: [6x6 double]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 6
A_condest: 3.364501e+00
S =
class: factorization_ldl_sparse
sparse LDL factorization: P'*A*P = L*D*L'
A: [6x6 double]
Factors:
L: [6x6 double]
D: [6x6 double]
P: [6x6 double]
is_inverse: 1
is_ctrans: 0
alpha: 1
A_rank: 6
A_condest: 3.364501e+00
error: 9.21191e-17
----------Dense QR and QR' with scalar A and sparse b:
F =
class: factorization_qr_dense
dense economy QR factorization: A = Q*R
A: [1x1 double]
Factors:
Q: 1
R: 3.1416
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 1
A_condest: 1
F =
class: factorization_qrt_dense
dense economy QR factorization: A' = Q*R
A: [1x1 double]
Factors:
Q: 1
R: 3.1416
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 1
A_condest: 1
All disp tests passed, max error: 6.24741e-12
Testing error handling (error messages are expected)
Expected error: [Matrix must be 2D.]
factorize: strategy gunk, A has size 4-by-4, full.
Expected error: [unrecognized strategy.]
Expected error: [COD is not designed for sparse matrices. Use COD_SPARSE instead.]
Expected error: [RQ is not designed for sparse matrices.]
Expected error: [B\F where F=inverse(A) requires the explicit computation of the inverse.
This is ill-advised, so it is never done automatically.
To force it, use B\double(F) instead of B\F.
]
Expected error: [F/B where F=inverse(A) requires the explicit computation of the inverse.
This is ill-advised, so it is never done automatically.
To force it, use double(F)/B instead of F/B.
]
Expected error: [COD_SPARSE is not designed for full matrices. Use COD instead.]
factorize: strategy default, A has size 3-by-3, full.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'logical'.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'char'.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'char'.
factorize: try COD ... failed.
factorize: First argument must be single or double.
Expected error: [First argument must be single or double.]
factorize: strategy default, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'char'.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'logical'.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'logical'.
factorize: try COD ... failed.
factorize: matrix type not supported
Expected error: [matrix type not supported]
factorize: strategy symmetric, A has size 3-by-3, full.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'logical'.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'char'.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'char'.
factorize: try COD ... failed.
factorize: First argument must be single or double.
Expected error: [First argument must be single or double.]
factorize: strategy symmetric, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'char'.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'logical'.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'logical'.
factorize: try COD ... failed.
factorize: matrix type not supported
Expected error: [matrix type not supported]
factorize: strategy qr, A has size 3-by-3, full.
factorize: try QR of A ... failed.
factorize: First argument must be single or double.
Expected error: [First argument must be single or double.]
factorize: strategy qr, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try QR of A ... failed.
factorize: A must be double
Expected error: [A must be double]
factorize: strategy lu, A has size 3-by-3, full.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'char'.
Expected error: [Undefined function or method 'lu' for input arguments of type 'char'.]
factorize: strategy lu, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try LU ... failed.
factorize: Undefined function or method 'lu' for input arguments of type 'logical'.
Expected error: [Undefined function or method 'lu' for input arguments of type 'logical'.]
factorize: strategy ldl, A has size 3-by-3, full.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'char'.
Expected error: [Undefined function or method 'ldl' for input arguments of type 'char'.]
factorize: strategy ldl, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try LDL ... failed.
factorize: Undefined function or method 'ldl' for input arguments of type 'logical'.
Expected error: [Undefined function or method 'ldl' for input arguments of type 'logical'.]
factorize: strategy chol, A has size 3-by-3, full.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'logical'.
Expected error: [Undefined function or method 'chol' for input arguments of type 'logical'.]
factorize: strategy chol, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try CHOL ... failed.
factorize: Undefined function or method 'chol' for input arguments of type 'char'.
Expected error: [Undefined function or method 'chol' for input arguments of type 'char'.]
factorize: strategy svd, A has size 3-by-3, full.
factorize: try SVD ... failed.
factorize: Undefined function or method 'svd' for input arguments of type 'logical'.
Expected error: [Undefined function or method 'svd' for input arguments of type 'logical'.]
factorize: strategy svd, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try SVD ... failed.
factorize: Undefined function or method 'svd' for input arguments of type 'logical'.
Expected error: [Undefined function or method 'svd' for input arguments of type 'logical'.]
factorize: strategy cod, A has size 3-by-3, full.
factorize: try COD ... failed.
factorize: First argument must be single or double.
Expected error: [First argument must be single or double.]
factorize: strategy cod, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try COD ... failed.
factorize: matrix type not supported
Expected error: [matrix type not supported]
factorize: strategy qr, A has size 3-by-4, sparse with 12 nonzeros.
factorize: try QR of A' ... failed.
factorize: A must be double
Expected error: [A must be double]
factorize: strategy ldl, A has size 3-by-3, full.
factorize: try LDL ... failed.
factorize: Matrix is singular to working precision.
factorize: strategy ldl, A has size 3-by-2, full.
factorize: try LDL ... failed.
factorize: Matrix must be square.
factorize: strategy ldl, A has size 2-by-3, full.
factorize: try LDL ... failed.
factorize: Matrix must be square.
factorize: strategy ldl, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try LDL ... failed.
factorize: Matrix is singular to working precision.
factorize: strategy ldl, A has size 3-by-2, sparse with 0 nonzeros.
factorize: try LDL ... failed.
factorize: Matrix must be square.
factorize: strategy ldl, A has size 2-by-3, sparse with 0 nonzeros.
factorize: try LDL ... failed.
factorize: Matrix must be square.
factorize: strategy chol, A has size 3-by-3, full.
factorize: try CHOL ... failed.
factorize: Matrix must be positive definite.
factorize: strategy chol, A has size 3-by-2, full.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
factorize: strategy chol, A has size 2-by-3, full.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
factorize: strategy chol, A has size 3-by-3, sparse with 9 nonzeros.
factorize: try CHOL ... failed.
factorize: Matrix must be positive definite.
factorize: strategy chol, A has size 3-by-2, sparse with 0 nonzeros.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
factorize: strategy chol, A has size 2-by-3, sparse with 0 nonzeros.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
factorize: strategy lu, A has size 3-by-2, full.
factorize: try LU ... failed.
factorize: LU for rectangular matrices not supported. Use QR.
Expected error: [LU for rectangular matrices not supported. Use QR.]
factorize: strategy lu, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try LU ... failed.
factorize: LU for rectangular matrices not supported. Use QR.
Expected error: [LU for rectangular matrices not supported. Use QR.]
factorize: strategy ldl, A has size 3-by-2, full.
factorize: try LDL ... failed.
factorize: Matrix must be square.
Expected error: [Matrix must be square.]
factorize: strategy ldl, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try LDL ... failed.
factorize: Matrix must be square.
Expected error: [Matrix must be square.]
factorize: strategy chol, A has size 3-by-2, full.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
Expected error: [Matrix must be square.]
factorize: strategy chol, A has size 3-by-2, sparse with 6 nonzeros.
factorize: try CHOL ... failed.
factorize: Matrix must be square.
Expected error: [Matrix must be square.]
Expected error: [QR(A) method requires m>=n.]
Expected error: [QR of A requires m >= n.]
Expected error: [QR(A') method requires m<=n.]
Expected error: [QR of A' requires m < n.]
factorize: strategy ldl, A has size 2-by-2, full.
factorize: try LDL ... failed.
factorize: Matrix is singular to working precision.
Expected error: [Matrix is singular to working precision.]
factorize: strategy ldl, A has size 2-by-2, sparse with 0 nonzeros.
factorize: try LDL ... failed.
factorize: Matrix is singular to working precision.
Expected error: [Matrix is singular to working precision.]
factorize: strategy chol, A has size 2-by-2, full.
factorize: try CHOL ... failed.
factorize: Matrix must be positive definite.
Expected error: [Matrix must be positive definite.]
factorize: strategy chol, A has size 2-by-2, sparse with 0 nonzeros.
factorize: try CHOL ... failed.
factorize: Matrix must be positive definite.
Expected error: [Matrix must be positive definite.]
factorize: strategy default, A has size 3-by-2, full.
factorize: try COD ... OK.
Expected error: [Cell contents reference from a non-cell array object.]
Expected error: [Improper index matrix reference.]
Expected error: [Reference to non-existent field 'L'.]
Expected error: [Reference to non-existent field 'junk'.]
factorize: strategy default, A has size 2-by-2, full.
factorize: try LU ... OK.
Expected error: [Undefined function or method 'cholupdate' for input arguments of type 'factorization_lu_dense'.]
Expected error: [Undefined function or method 'choldowndate' for input arguments of type 'factorization_lu_dense'.]
Expected error: [Matrix must be square.]
Expected error: [A is rectangular. Use the 2 norm.]
Expected error: [unrecognized kind]
Expected error: [Third argument must be '+' or '-'.]
All error-handing tests passed
----- Test functions:
norm(A,1), exact: 0
MATLAB normest1(A) 0
norm (inv(A),1) exact: 0
MATLAB normest1 (inv (A)): -1
normest1 (inverse (F)): 0
cond (A,1), exact: -1
MATLAB condest(A): 0
condest(F): 0
condest(inverse(A)): 0
cond (A,2), exact: -1
cond (F,2), exact: -1
rankest 0 0
cheap condest: 0
K =
A: []
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 0
A_cond: []
kind: 'dense LDL factorization: A(p,p) = L*D*L''
K =
A: []
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 0
A_cond: []
kind: 'dense LDL factorization: A(p,p) = L*D*L''
norm(A,1), exact: 3.07802
MATLAB normest1(A) 3.07802
norm (inv(A),1) exact: 1.94889e+06
MATLAB normest1 (inv (A)): 1.94889e+06
normest1 (inverse (F)): 1.94889e+06
cond (A,1), exact: -1
MATLAB condest(A): 5.99871e+06
condest(F): 5.99871e+06
condest(inverse(A)): 5.99871e+06
cond (A,2), exact: -1
cond (F,2), exact: -1
rankest 3 3
K =
A: [3x3 double]
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
A_cond: []
kind: 'dense Cholesky factorization: A = R'*R'
K =
A: [3x3 double]
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 3
A_cond: []
kind: 'dense Cholesky factorization: A = R'*R'
norm(A,1), exact: 1.99749
MATLAB normest1(A) 1.99749
norm (inv(A),1) exact: 1785.44
MATLAB normest1 (inv (A)): 1785.44
normest1 (inverse (F)): 1785.44
cond (A,1), exact: 3566.41
MATLAB condest(A): 3566.41
condest(F): 3566.41
condest(inverse(A)): 3566.41
cond (A,2), exact: 2050.35
cond (F,2), exact: 2050.35
rankest 3 3
K =
A: [3x3 double]
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 3
A_cond: 2.0503e+03
kind: 'singular value decomposition: A = U*S*V''
K =
A: [3x3 double]
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 3
A_cond: 2.0503e+03
kind: 'singular value decomposition: A = U*S*V''
norm(A,1), exact: 6.43078
MATLAB normest1(A) 6.43078
norm (inv(A),1) exact: 14.3894
MATLAB normest1 (inv (A)): 14.3894
normest1 (inverse (F)): 14.3894
cond (A,1), exact: -1
MATLAB condest(A): 92.5354
condest(F): 92.5354
condest(inverse(A)): 92.5354
cond (A,2), exact: -1
cond (F,2), exact: -1
rankest 10 10
cheap condest: 2.49707
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 10
A_cond: []
kind: 'dense LU factorization: A(p,:) = L*U'
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 10
A_cond: []
kind: 'dense LU factorization: A(p,:) = L*U'
Methods for class factorization_svd:
abs isa mldivide rankest
cond isempty mldivide_subclass size
condest isfield mrdivide struct
ctranspose isfloat mrdivide_subclass subsref
disp isnumeric mtimes svd
double isreal norm uminus
end isscalar null uplus
error_check issingle orth
factorization_svd issparse pinv
inverse isvector rank
norm(A,1), exact: 32.5678
MATLAB normest1(A) 32.5678
norm (inv(A),1) exact: 0.0679415
MATLAB normest1 (inv (A)): 0.0652449
normest1 (inverse (F)): 0.0652449
cond (A,1), exact: 2.2127
MATLAB condest(A): 2.12488
condest(F): 2.12488
condest(inverse(A)): 2.12488
cond (A,2), exact: 1.70306
cond (F,2), exact: 1.70306
rankest 10 10
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 10
A_cond: 1.7031
kind: 'singular value decomposition: A = U*S*V''
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 10
A_cond: 1.7031
kind: 'singular value decomposition: A = U*S*V''
Methods for class factorization_chol_dense:
abs isempty mrdivide
cholupdate isfield mrdivide_subclass
condest isfloat mtimes
ctranspose isnumeric rankest
disp isreal size
double isscalar struct
end issingle subsref
error_check issparse uminus
factorization_chol_dense isvector uplus
inverse mldivide
isa mldivide_subclass
norm(A,1), exact: 32.5678
MATLAB normest1(A) 32.5678
norm (inv(A),1) exact: 0.0679415
MATLAB normest1 (inv (A)): 0.0652449
normest1 (inverse (F)): 0.0652449
cond (A,1), exact: -1
MATLAB condest(A): 2.12488
condest(F): 2.12488
condest(inverse(A)): 2.12488
cond (A,2), exact: -1
cond (F,2), exact: -1
rankest 10 10
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 0
is_ctrans: 0
alpha: 1
A_rank: 10
A_cond: []
kind: 'dense Cholesky factorization: A = R'*R'
K =
A: [10x10 double]
Factors: [1x1 struct]
is_inverse: 1
is_ctrans: 1
alpha: 1
A_rank: 10
A_cond: []
kind: 'dense Cholesky factorization: A = R'*R'
........................................................................
test_functions, max error: 1.38512e-10
Testing accuracy:
factorize: strategy ldl, A has size 4-by-4, full.
factorize: try LDL ... OK.
..please wait
test 1 of 14 ..........................................................
test 2 of 14 ..........................................................
test 3 of 14 ..........................................................
test 4 of 14 ..........................................................
test 5 of 14 ..........................................................
test 6 of 14 ........................................................
test 7 of 14 ..........................................................
test 8 of 14 ........................................................
test 9 of 14 ..........................................................
test 10 of 14 ........................................................
test 11 of 14 ..........................................................
test 12 of 14 ........................................................
test 13 of 14 ..........................................................
test 14 of 14 ........................................................
.
err so far: 2.92744e-12
please wait .........................................................
max error is OK: 8.56286e-09
................
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
....................................
.........
test_all_svd error so far: 1.99577e-14
Testing on gallery ('randsvd',50) matrices:
..
Final test_all_svd error: 9.05166e-10
test COD, COD_SPARSE, and RQ: error 1.07415e-15
Performance comparisons of 4 methods:
backslash: A\b, or L\b (and related) for solve times.
linsolve: a built-in MATLAB function
factorize: the factorization object
inv: x=inv(A)*b, the explicit inverse (ack!)
Run times are in seconds.
Time relative to best time is in parentheses (lower is better).
------------------ For unsymmetric matrices:
Compare factorization times:
n 50 tbest 0.000231 :
backslash ( 1.04)
linsolve ( 1.00)
factorize ( 5.57)
inv ( 1.50)
n 100 tbest 0.000829 :
backslash ( 1.11)
linsolve ( 1.00)
factorize ( 2.36)
inv ( 1.96)
n 500 tbest 0.049129 :
backslash ( 1.05)
linsolve ( 1.00)
factorize ( 1.09)
inv ( 2.41)
n 1000 tbest 0.332374 :
backslash ( 1.04)
linsolve ( 1.01)
factorize ( 1.00)
inv ( 2.51)
Compare solve times:
n 50 tbest 0.000013 :
backslash ( 2.53)
linsolve ( 2.94)
factorize (30.20)
inv ( 1.00)
n 100 tbest 0.000023 :
backslash ( 3.04)
linsolve ( 2.46)
factorize (18.41)
inv ( 1.00)
n 500 tbest 0.000423 :
backslash ( 4.33)
linsolve ( 1.78)
factorize ( 3.21)
inv ( 1.00)
n 1000 tbest 0.002432 :
backslash ( 2.74)
linsolve ( 1.32)
factorize ( 1.48)
inv ( 1.00)
Break-even values K for inv vs the other methods
(# of solves must exceed K for inv(A)*b to be faster):
n 50
# solves vs backslash 5.2
# solves vs linsolve: 4.4
# solves vs factorize: 1.0
n 100
# solves vs backslash 14.8
# solves vs linsolve: 23.5
# solves vs factorize: 1.0
n 500
# solves vs backslash 47.3
# solves vs linsolve: 210.7
# solves vs factorize: 69.1
n 1000
# solves vs backslash 115.7
# solves vs linsolve: 645.9
# solves vs factorize: 431.0
------------------ For positive definite matrices:
Compare factorization times:
n 50 tbest 0.000172 :
backslash ( 1.10)
linsolve ( 1.00)
factorize ( 5.59)
inv ( 1.75)
n 100 tbest 0.000536 :
backslash ( 1.17)
linsolve ( 1.00)
factorize ( 2.42)
inv ( 2.29)
n 500 tbest 0.023547 :
backslash ( 1.25)
linsolve ( 1.12)
factorize ( 1.00)
inv ( 3.90)
n 1000 tbest 0.145861 :
backslash ( 1.27)
linsolve ( 1.18)
factorize ( 1.00)
inv ( 5.11)
Compare solve times:
n 50 tbest 0.000013 :
backslash ( 3.15)
linsolve ( 2.71)
factorize (29.95)
inv ( 1.00)
n 100 tbest 0.000024 :
backslash ( 3.30)
linsolve ( 2.22)
factorize (17.60)
inv ( 1.00)
n 500 tbest 0.000440 :
backslash ( 3.33)
linsolve ( 1.00)
factorize ( 2.07)
inv ( 1.01)
n 1000 tbest 0.002613 :
backslash ( 2.49)
linsolve ( 1.00)
factorize ( 1.19)
inv ( 1.05)
Break-even values K for inv vs the other methods
(# of solves must exceed K for inv(A)*b to be faster):
n 50
# solves vs backslash 3.9
# solves vs linsolve: 5.6
# solves vs factorize: 1.0
n 100
# solves vs backslash 11.0
# solves vs linsolve: 23.9
# solves vs factorize: 1.0
n 500
# solves vs backslash 61.0
# solves vs linsolve: Inf
# solves vs factorize: 146.1
n 1000
# solves vs backslash 148.4
# solves vs linsolve: Inf
# solves vs factorize: 1616.2
Schur complement, S=A-B*inv(D)*C or A-B(D\C),
where A, B, C, and D are square and unsymmetric.
"inverse" means S=A-B*inverse(D)*C, which does not actually
use the inverse, but uses the factorization object instead.
n 50 tbest 0.000482 :
backslash ( 1.01)
linsolve ( 1.00)
factorize ( 3.45)
inv ( 4.01)
n 100 tbest 0.002334 :
backslash ( 1.05)
linsolve ( 1.00)
factorize ( 1.70)
inv ( 1.81)
n 500 tbest 0.234306 :
backslash ( 1.00)
linsolve ( 1.02)
factorize ( 1.05)
inv ( 1.10)
n 1000 tbest 1.736168 :
backslash ( 1.00)
linsolve ( 1.03)
factorize ( 1.24)
inv ( 1.02)
All tests passed, maximum error OK: 8.56286e-09
diary off
|