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 factorize, inverse, test_performance, test_accuracy, test_disp,
test_errors
----------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