Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 07-Oct-2025 22:27:15 linpack_d_test MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test linpack_d. TEST01 For double precision, general storage, DCHDC computes the Cholesky decomposition. The number of equations is N = 4 The matrix A: 2.000000 -1.000000 0.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 2.000000 Decompose the matrix. The Cholesky factor U: 1.414214 -0.707107 0.000000 0.000000 0.000000 1.224745 -0.816497 0.000000 0.000000 0.000000 1.154701 -0.866025 0.000000 0.000000 0.000000 1.118034 The product U' * U: 2.000000 -1.000000 0.000000 0.000000 -1.000000 2.000000 -1.000000 0.000000 0.000000 -1.000000 2.000000 -1.000000 0.000000 0.000000 -1.000000 2.000000 TEST02 For double precision, general storage, DCHEX can shift columns in a Cholesky factorization. The number of equations is N = 5 The matrix A: 2.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 0.000000 2.000000 The vector Z: 1.000000 2.000000 3.000000 4.000000 5.000000 Decompose the matrix. The Cholesky factor U: 1.414214 -0.707107 0.000000 0.000000 0.000000 0.000000 1.224745 -0.816497 0.000000 0.000000 0.000000 0.000000 1.154701 -0.866025 0.000000 0.000000 0.000000 0.000000 1.118034 -0.894427 0.000000 0.000000 0.000000 0.000000 1.095445 Right circular shift columns K = 1 through L = 3 Left circular shift columns K+1 = 2 through L = 3 The shifted Cholesky factor U: 1.414214 -0.707107 0.000000 -0.707107 0.000000 0.000000 -1.224745 0.816497 0.408248 -0.000000 0.000000 0.000000 1.154701 -0.288675 0.000000 0.000000 0.000000 0.000000 1.118034 -0.894427 0.000000 0.000000 0.000000 0.000000 1.095445 The shifted vector Z: 1.294789 -2.170197 2.759306 4.000000 5.000000 The shifted product U' * U: 2.000000 -1.000000 0.000000 -1.000000 0.000000 -1.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 -1.000000 2.000000 0.000000 0.000000 -1.000000 0.000000 0.000000 2.000000 -1.000000 0.000000 0.000000 0.000000 -1.000000 2.000000 TEST03 For double precision, general storage, DCHUD updates a Cholesky decomposition. In this example, we use DCHUD to solve a least squares problem R * b = z. The number of equations is P = 20 Solution vector # 1 (Should be (1,2,3...,n)) 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 16 16.000000 17 17.000000 18 18.000000 19 19.000000 20 20.000000 TEST04 For a general banded matrix, DGBCO estimates the reciprocal condition number. The matrix size is N = 10 The bandwidth of the matrix is 3 Estimate the condition. Estimated reciprocal condition = 0.023302 TEST05 For a general banded matrix, DGBFA factors the matrix, DGBSL solves a factored linear system. The matrix size is N = 10 The bandwidth of the matrix is 3 Factor the matrix. Solve the linear system. The first and last 5 entries of the solution: (All should be 1): 1 1.000000 2 1.000000 3 1.000000 4 1.000000 5 1.000000 ...... .............. 6 1.000000 7 1.000000 8 1.000000 9 1.000000 10 1.000000 TEST06 For a general banded matrix, DGBFA factors the matrix, DGBDI computes the determinant as det = MANTISSA * 10^EXPONENT Find the determinant of the -1,2,-1 matrix for N = 2, 4, 8, 16, 32, 64, 128. (For this matrix, det ( A ) = N + 1.) The bandwidth of the matrix is 3 N Mantissa Exponent 2 3.000000 0.000000 4 5.000000 0.000000 8 9.000000 0.000000 16 1.700000 1.000000 32 3.300000 1.000000 64 6.500000 1.000000 128 1.290000 2.000000 TEST07 For a general banded matrix, DGBFA factors the matrix, DGBSL solves a factored linear system. The matrix size is N = 100 The bandwidth of the matrix is 51 Factor the matrix. Solve the linear system. The first and last 5 entries of the solution: (All should be 1): 1 1.000000 2 1.000000 3 1.000000 4 1.000000 5 1.000000 ...... .............. 96 1.000000 97 1.000000 98 1.000000 99 1.000000 100 1.000000 TEST08 For a general matrix, DGECO computes the LU factors and computes its reciprocal condition number; DGESL solves a factored linear system. The matrix size is N = 3 Factor the matrix. The reciprocal matrix condition number = 0.024645 Solve the linear system. Solution returned by DGESL (Should be (1,1,1)) 1.000000 1.000000 1.000000 Call DGESL for a new right hand side for the same, factored matrix. Solve a linear system. Solution returned by DGESL (should be (1,0,0)) 1.000000 0.000000 0.000000 Call DGESL for transposed problem. Call DGESL to solve a transposed linear system. Solution returned by DGESL (should be (-1,0,1)) -1.000000 -0.000000 1.000000 TEST09 For a general matrix, DGEFA computes the LU factors; DGEDI computes the inverse and determinant of a factored matrix. The matrix size is N = 3 Factor the matrix Get the inverse and determinant The determinant = 2.700000 * 10 ^ 1.000000 The inverse matrix: -1.777778 0.888889 -0.111111 1.555556 -0.777778 0.222222 -0.111111 0.222222 -0.111111 TEST10 For a general matrix, DGEFA computes the LU factors; DGESL solves a factored linear system; The number of equations is N = 3 The matrix A: 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 The right hand side B is 6.000000 15.000000 15.000000 Factor the matrix Solve the linear system. DGESL returns the solution: (Should be (1,1,1)) 1.000000 1.000000 1.000000 TEST11 For a general matrix, DGEFA computes the LU factors; DGESL solves a factored linear system; The matrix size is N = 100 Factor the matrix Solve the linear system. The first and last five entries of the solution: (All of them should be 1.) 1 1.000000 2 1.000000 3 1.000000 4 1.000000 5 1.000000 ...... .............. 96 1.000000 97 1.000000 98 1.000000 99 1.000000 100 1.000000 dgtsl_test For a general tridiagonal matrix, DGTSL factors and solves a linear system. The matrix size is N = 100 Factor the matrix and solve the system. The first and last 5 entries of the solution: (Should be 1,2,3,4,5,...,n,n-1): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 96 96.000000 97 97.000000 98 98.000000 99 99.000000 100 100.000000 TEST13 For a positive definite symmetric band matrix, DPBCO estimates the reciprocal condition number. The matrix size is N = 10 Estimate the condition. Reciprocal condition = 0.020492 TEST14 For a positive definite symmetric band matrix, DPBDI computes the determinant as det = MANTISSA * 10**EXPONENT Find the determinant of the -1,2,-1 matrix for N = 2, 4, 8, 16, 32, 64, 128. (For this matrix, det ( A ) = N + 1.) The bandwidth of the matrix is 3 N Mantissa Exponent 2 3.000000 0.000000 4 5.000000 0.000000 8 9.000000 0.000000 16 1.700000 1.000000 32 3.300000 1.000000 64 6.500000 1.000000 128 1.290000 2.000000 TEST15 For a positive definite symmetric band matrix, DPBFA computes the LU factors. DPBSL solves a factored linear system. The matrix size is N = 10 Factor the matrix. Solve the linear system. The first and last 5 entries of the solution: (All should be 1): 1 1.000000 2 1.000000 3 1.000000 4 1.000000 5 1.000000 ...... .............. 6 1.000000 7 1.000000 8 1.000000 9 1.000000 10 1.000000 TEST16 For a positive definite symmetric matrix, DPOCO estimates the reciprocal condition number. The matrix size is N = 5 Estimate the condition. Reciprocal condition = 0.067568 TEST17 For a positive definite symmetric matrix, DPOFA computes the LU factors, DPODI computes the inverse or determinant. The matrix size is N = 5 Factor the matrix. Get the determinant and inverse. Determinant = 6.000000 * 10 ^ 0.000000 First row of inverse: 0.833333 0.666667 0.500000 0.333333 0.166667 TEST18 For a positive definite symmetric matrix, DPOFA computes the LU factors. DPOSL solves a factored linear system. The matrix size is N = 20 Factor the matrix. Solve the linear system. The first and last five entries of the solution: (Should be 1,2,3,4,5,...,n-1,n.) 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 16 16.000000 17 17.000000 18 18.000000 19 19.000000 20 20.000000 TEST19 For a positive definite symmetric packed matrix, DPPCO estimates the reciprocal condition number. The matrix size is N = 5 Estimate the condition number. Reciprocal condition number = 0.067568 TEST20 For a positive definite symmetric packed matrix, DPPFA factors the matrix. DPPDI computes the inverse or determinant. The matrix size is N = 5 Factor the matrix. Get the determinant and inverse. Determinant = 6.000000 * 10 ^ 0.000000 Inverse: 0.833333 0.666667 0.500000 0.333333 0.166667 0.666667 1.333333 1.000000 0.666667 0.333333 0.500000 1.000000 1.500000 1.000000 0.500000 0.333333 0.666667 1.000000 1.333333 0.666667 0.166667 0.333333 0.500000 0.666667 0.833333 TEST21 For a positive definite symmetric packed matrix, DPPFA factors the matrix. DPPSL solves a factored linear system. The matrix size is N = 20 Factor the matrix. Solve the linear system. The first and last five entries of the solution: (Should be 1,2,3,4,5,...,n-1,n.) 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 16 16.000000 17 17.000000 18 18.000000 19 19.000000 20 20.000000 TEST22 For a positive definite symmetric tridiagonal matrix, DPTSL factors and solves a linear system. The matrix size is N = 20 Factor the matrix and solve the system. The first and last five entries of the solution: (Should be 1,2,3,4,5,...,n-1,n): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 16 16.000000 17 17.000000 18 18.000000 19 19.000000 20 20.000000 DQRDC_TEST DQRDC computes the QR decomposition of a rectangular matrix, but does not return Q and R explicitly. Show how Q and R can be recovered using SQRSL. The original matrix A: 1.000000 1.000000 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 1.000000 Decompose the matrix. The packed matrix A which describes Q and R: -1.414214 -0.707107 -0.707107 0.707107 1.224745 0.408248 0.000000 -0.816497 1.154701 The QRAUX vector, containing some additional information defining Q: 1.707107 1.577350 0.000000 The R factor: -1.414214 -0.707107 -0.707107 0.000000 1.224745 0.408248 0.000000 0.000000 1.154701 The Q factor: -0.707107 0.408248 -0.577350 -0.707107 -0.408248 0.577350 0.000000 0.816497 0.577350 The product Q * R: 1.000000 1.000000 -0.000000 1.000000 -0.000000 1.000000 0.000000 1.000000 1.000000 DQRSL_TEST DQRSL solves a rectangular linear system A*x=b in the least squares sense after A has been factored by DQRDC. The matrix A: 1.000000 1.000000 1.000000 1.000000 2.000000 4.000000 1.000000 3.000000 9.000000 1.000000 4.000000 16.000000 1.000000 5.000000 25.000000 Decompose the matrix. X X(expected): -3.02 -3.02 4.49143 4.49143 -0.728571 -0.728571 TEST24 For a symmetric indefinite matrix, DSICO estimates the reciprocal condition number. The matrix size is N = 100 Estimate the condition. Estimated reciprocal condition = 0.000245 TEST25 For a symmetric indefinite matrix, DSIFA factors the matrix, DSISL solves a factored linear system, The matrix size is N = 100 Factor the matrix. Solve the linear system. The first and last five entries of the solution: (Should be 1,2,3,4,5,...,n-1,n): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 96 96.000000 97 97.000000 98 98.000000 99 99.000000 100 100.000000 TEST26 For a symmetric indefinite packed matrix, DSPCO estimates the reciprocal condition number. The matrix size is N = 100 Estimate the condition. Estimated reciprocal condition = 0.000245 TEST27 For a symmetric indefinite packed matrix, DSPFA factors the matrix, DSPSL solves a factored linear system. The matrix size is N = 100 Factor the matrix. Solve the linear system. The first and last five entries of the solution: (Should be 1,2,3,4,5,...,n-1,n): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 ...... .............. 96 96.000000 97 97.000000 98 98.000000 99 99.000000 100 100.000000 DSVDC_TEST For an MxN matrix A in general storage, DSVDC computes the singular value decomposition: A = U * S * V' Matrix rows M = 6 Matrix columns N = 4 The matrix A: 0.422886 0.638531 0.407619 0.105629 0.094229 0.033604 0.819981 0.610959 0.598524 0.068806 0.718359 0.778802 0.470924 0.319600 0.968649 0.423453 0.695949 0.530864 0.531334 0.090823 0.699888 0.654446 0.325146 0.266471 Decompose the matrix. Singular values: 1 2.382548 2 0.997278 3 0.416611 4 0.231277 Left Singular Vector Matrix U: -0.320296 0.390989 -0.321583 -0.464113 -0.188164 -0.624753 -0.356934 -0.555769 -0.310810 -0.398150 0.540530 0.128137 -0.471880 -0.373522 0.688950 0.085912 -0.149641 -0.365219 -0.491547 -0.172795 -0.442925 0.340567 -0.575335 0.292135 -0.394700 0.391779 -0.074848 0.592247 0.564789 -0.124002 -0.387209 0.464091 0.351489 -0.389811 -0.005605 0.599300 Right Singular Vector Matrix V: -0.515704 0.406616 0.557836 0.507477 -0.364744 0.663567 -0.287183 -0.586658 -0.660625 -0.374002 -0.589403 0.276226 -0.405692 -0.504446 0.508870 -0.567450 The product U * S * V' (should equal A): 0.422886 0.638531 0.407619 0.105629 0.094229 0.033604 0.819981 0.610959 0.598524 0.068806 0.718359 0.778802 0.470924 0.319600 0.968649 0.423453 0.695949 0.530864 0.531334 0.090823 0.699888 0.654446 0.325146 0.266471 TEST29 For a triangular matrix, DTRCO computes the LU factors and computes its reciprocal condition number. The matrix size is N = 5 Lower triangular matrix A: 0.153657 0.000000 0.000000 0.000000 0.000000 0.281005 0.440085 0.000000 0.000000 0.000000 0.527143 0.457424 0.875372 0.000000 0.000000 0.518052 0.943623 0.637709 0.957694 0.000000 0.240707 0.676122 0.289065 0.671808 0.695140 Estimate the condition: The reciprocal condition number = 0.040584 Upper triangular matrix A: 0.067993 0.254790 0.224040 0.667833 0.844392 0.000000 0.344462 0.780520 0.675332 0.006715 0.000000 0.000000 0.602170 0.386771 0.915991 0.000000 0.000000 0.000000 0.001151 0.462449 0.000000 0.000000 0.000000 0.000000 0.424349 Estimate the condition: The reciprocal condition number = 0.000052 TEST30 For a triangular matrix, DTRDI computes the determinant or inverse. The matrix size is N = 5 Lower triangular matrix A: 0.460916 0.000000 0.000000 0.000000 0.000000 0.770160 0.322472 0.000000 0.000000 0.000000 0.784739 0.471357 0.035763 0.000000 0.000000 0.175874 0.721758 0.473486 0.152721 0.000000 0.341125 0.607389 0.191745 0.738427 0.242850 The determinant = 1.971430 * 10 ^ -4.000000 The inverse matrix: 2.169591 0.000000 0.000000 0.000000 0.000000 -5.181636 3.101046 0.000000 0.000000 0.000000 125.609025 13.180121 27.962069 0.000000 0.000000 -210.619770 6.187347 3.100329 6.547879 0.000000 1631.902164 5.746512 2.229281 3.040676 4.117775 a = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Upper triangular matrix A: 0.917424 0.269062 0.765500 0.188662 0.287498 0.000000 0.091113 0.576209 0.683363 0.546593 0.000000 0.000000 0.425729 0.644443 0.647618 0.000000 0.000000 0.000000 0.679017 0.635787 0.000000 0.000000 0.000000 0.000000 0.945174 The determinant = 2.283906 * 10 ^ -2.000000 The inverse matrix: 1.090008 -3.218836 2.396649 0.661970 -0.557532 0.000000 10.975326 -14.854728 3.052778 1.777694 0.000000 0.000000 2.348913 -2.229312 -0.109854 0.000000 0.000000 0.000000 1.472718 -0.990647 0.000000 0.000000 0.000000 0.000000 1.058006 TEST31 For a triangular matrix, DTRSL solves a linear system. The matrix size is N = 5 For a lower triangular matrix A, solve A * x = b The solution (should be 1,2,3,4,5): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 For a lower triangular matrix A, solve A' * x = b The solution (should be 1,2,3,4,5): 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 For an upper triangular matrix A, solve A * x = b The solution (should be 1,2,3,4,5): 1 14.068348 2 -7.657959 3 -2.810382 4 1.756904 5 15.195986 For an upper triangular matrix A, solve A' * x = b The solution (should be 1,2,3,4,5): 1 12.283040 2 1.940087 3 5.496014 4 -7.108147 5 7.403604 linpack_d_test Normal end of execution. 07-Oct-2025 22:27:16