25 February 2013 09:30:00 AM LINPLUS_PRB C++ version Test the LINPLUS library. TEST019 C8VEC_UNITY returns the N complex roots of unity. Roots of unity: Real Imaginary Part Part 1 1 0 Roots of unity: Real Imaginary Part Part 1 1 0 2 -1 1.22465e-16 Roots of unity: Real Imaginary Part Part 1 1 0 2 -0.5 0.866025 3 -0.5 -0.866025 Roots of unity: Real Imaginary Part Part 1 1 0 2 6.12323e-17 1 3 -1 1.22465e-16 4 -1.83697e-16 -1 Roots of unity: Real Imaginary Part Part 1 1 0 2 0.309017 0.951057 3 -0.809017 0.587785 4 -0.809017 -0.587785 5 0.309017 -0.951057 TEST0192 For a matrix in the R8CC format, (double precision compressed column sparse) R8CC_WRITE writes the matrix to 3 files. Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 The COL vector: 1 1 2 4 3 6 4 8 5 10 6 13 The ROW vector: 1 1 2 2 3 4 4 1 5 2 6 3 7 5 8 4 9 5 10 1 11 2 12 5 The R8CC matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 15 2 21 22 0 0 25 3 0 0 33 0 0 4 41 0 0 44 0 5 0 0 53 54 55 TEST0193 For a matrix in the R8CC format, (double precision compressed column sparse) R8CC_READ_SIZE reads the sizes of the data; R8CC_READ reads the data. Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 Index base (0/1) = 1 The COL vector: 1 1 2 4 3 6 4 8 5 10 6 13 The ROW vector: 1 1 2 2 3 4 4 1 5 2 6 3 7 5 8 4 9 5 10 1 11 2 12 5 The R8CC matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 15 2 21 22 0 0 25 3 0 0 33 0 0 4 41 0 0 44 0 5 0 0 53 54 55 FILE_DELETE: Deleting old version of "r8cc_a.txt". FILE_DELETE: Deleting old version of "r8cc_col.txt". FILE_DELETE: Deleting old version of "r8cc_row.txt". TEST0194 For a compressed banded matrix, R8VEC_TO_R8CB converts a real vector to an R8CB matrix. R8CB_TO_R8VEC converts an R8CB matrix to a real vector. Matrix rows M = 5 Matrix columns N = 8 Lower bandwidth ML = 2 Upper bandwidth MU = 1 The R8CB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 2 21 22 23 3 31 32 33 34 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 5 56 1 1 1 0 2 1 2 11 3 1 3 21 4 1 4 31 1 2 5 12 2 2 6 22 3 2 7 32 4 2 8 42 1 3 9 23 2 3 10 33 3 3 11 43 4 3 12 53 1 4 13 34 2 4 14 44 3 4 15 54 4 4 16 0 1 5 17 45 2 5 18 55 3 5 19 0 4 5 20 0 1 6 21 56 2 6 22 0 3 6 23 0 4 6 24 0 1 7 25 0 2 7 26 0 3 7 27 0 4 7 28 0 1 8 29 0 2 8 30 0 3 8 31 0 4 8 32 0 The recovered R8CB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 2 21 22 23 3 31 32 33 34 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 5 56 TEST0195 For a general banded matrix, R8VEC_TO_R8GB converts a real vector to an R8GB matrix. R8GB_TO_R8VEC converts an R8GB matrix to a real vector. Matrix rows M = 5 Matrix columns N = 8 Lower bandwidth ML = 2 Upper bandwidth MU = 1 The R8GB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 3 0 4 0 0 5 56 0 0 1 1 1 0 2 1 2 0 3 1 3 0 4 1 4 11 5 1 5 21 6 1 6 31 1 2 7 0 2 2 8 0 3 2 9 12 4 2 10 22 5 2 11 32 6 2 12 42 1 3 13 0 2 3 14 0 3 3 15 23 4 3 16 33 5 3 17 43 6 3 18 53 1 4 19 0 2 4 20 0 3 4 21 34 4 4 22 44 5 4 23 54 6 4 24 0 1 5 25 0 2 5 26 0 3 5 27 45 4 5 28 55 5 5 29 0 6 5 30 0 1 6 31 0 2 6 32 0 3 6 33 56 4 6 34 0 5 6 35 0 6 6 36 0 1 7 37 0 2 7 38 0 3 7 39 0 4 7 40 0 5 7 41 0 6 7 42 0 1 8 43 0 2 8 44 0 3 8 45 0 4 8 46 0 5 8 47 0 6 8 48 0 The recovered R8GB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 3 0 4 0 0 5 56 0 0 TEST0196 For a general matrix, R8VEC_TO_R8GE converts a real vector to an R8GE matrix. R8GE_TO_R8VEC converts an R8GE matrix to a real vector. Matrix rows M = 4 Matrix columns N = 6 The R8GE indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 21 22 23 24 25 3 31 32 33 34 35 4 41 42 43 44 45 Col: 6 Row --- 1 16 2 26 3 36 4 46 1 1 1 11 2 1 2 21 3 1 3 31 4 1 4 41 1 2 5 12 2 2 6 22 3 2 7 32 4 2 8 42 1 3 9 13 2 3 10 23 3 3 11 33 4 3 12 43 1 4 13 14 2 4 14 24 3 4 15 34 4 4 16 44 1 5 17 15 2 5 18 25 3 5 19 35 4 5 20 45 1 6 21 16 2 6 22 26 3 6 23 36 4 6 24 46 The recovered R8GE indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 21 22 23 24 25 3 31 32 33 34 35 4 41 42 43 44 45 Col: 6 Row --- 1 16 2 26 3 36 4 46 TEST02 R83_CR_FA factors a real tridiagonal matrix; R83_CR_SL solves a factored system. Matrix order N = 5 Demonstrate multiple system solution method. Solve linear system number #1. Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 Solve linear system number #2. Solution: 1: 1 2: 1 3: 1 4: 1 5: 1 TEST03: For a real tridiagonal matrix, using CYCLIC REDUCTION, R83_CR_FA factors; R83_CR_SL solves. Matrix order N = 10 The matrix is NOT symmetric. The matrix: Col: 1 2 3 4 5 Row --- 1: 4 2 2: 1 8 3 3: 2 12 4 4: 3 16 5 5: 4 20 6: 5 Col: 6 7 8 9 10 Row --- 5: 6 6: 24 7 7: 6 28 8 8: 7 32 9 9: 8 36 10 10: 9 40 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 TEST035 For a real tridiagonal system, R83_GS_SL solves a linear system using Gauss-Seidel iteration. Matrix order N = 100 Iterations per call = 1000 Solving A * x = b. Current estimated solution: 1: 0.252679 2: 0.506519 3: 0.762101 4: 1.02001 5: 1.28081 6: 1.5451 7: 1.81345 8: 2.08644 9: 2.36465 10: 2.64866 Current estimated solution: 1: 0.69813 2: 1.39684 3: 2.09641 4: 2.79714 5: 3.4993 6: 4.20319 7: 4.90908 8: 5.61725 9: 6.32799 10: 7.04156 Current estimated solution: 1: 0.884923 2: 1.77007 3: 2.65555 4: 3.54147 5: 4.42794 6: 5.31508 7: 6.20299 8: 7.09178 9: 7.98155 10: 8.87242 Solving A' * x = b. Current estimated solution: 1: 0.252679 2: 0.506519 3: 0.762101 4: 1.02001 5: 1.28081 6: 1.5451 7: 1.81345 8: 2.08644 9: 2.36465 10: 2.64866 Current estimated solution: 1: 0.69813 2: 1.39684 3: 2.09641 4: 2.79714 5: 3.4993 6: 4.20319 7: 4.90908 8: 5.61725 9: 6.32799 10: 7.04156 Current estimated solution: 1: 0.884923 2: 1.77007 3: 2.65555 4: 3.54147 5: 4.42794 6: 5.31508 7: 6.20299 8: 7.09178 9: 7.98155 10: 8.87242 TEST037 R83_INDICATOR sets up an S3 indicator matrix. Matrix order N = 10 The S3 indicator matrix: Col: 1 2 3 4 5 Row --- 1: 101 102 2: 201 202 203 3: 302 303 304 4: 403 404 405 5: 504 505 6: 605 Col: 6 7 8 9 10 Row --- 5: 506 6: 606 607 7: 706 707 708 8: 807 808 809 9: 908 909 910 10: 1009 1010 TEST04 For a real tridiagonal system, R83_JAC_SL solves a linear system using Jacobi iteration. Matrix order N = 100 Iterations per call = 1000 Solving A * x = b. The right hand side: 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 7: 0 8: 0 9: 0 10: 0 Current estimated solution: 1: 0.0310821 2: 0.0621642 3: 0.0943947 4: 0.126625 5: 0.161175 6: 0.195725 7: 0.233812 8: 0.271898 9: 0.314805 10: 0.357712 Current estimated solution: 1: 0.281638 2: 0.563275 3: 0.847221 4: 1.13117 5: 1.41973 6: 1.70829 7: 2.00376 8: 2.29924 9: 2.60392 10: 2.90861 Current estimated solution: 1: 0.537777 2: 1.07555 3: 1.61505 4: 2.15455 5: 2.69748 6: 3.2404 7: 3.78847 8: 4.33653 9: 4.89141 10: 5.4463 Solving A' * x = b. The right hand side: 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 7: 0 8: 0 9: 0 10: 0 Current estimated solution: 1: 0.0310821 2: 0.0621642 3: 0.0943947 4: 0.126625 5: 0.161175 6: 0.195725 7: 0.233812 8: 0.271898 9: 0.314805 10: 0.357712 Current estimated solution: 1: 0.281638 2: 0.563275 3: 0.847221 4: 1.13117 5: 1.41973 6: 1.70829 7: 2.00376 8: 2.29924 9: 2.60392 10: 2.90861 Current estimated solution: 1: 0.537777 2: 1.07555 3: 1.61505 4: 2.15455 5: 2.69748 6: 3.2404 7: 3.78847 8: 4.33653 9: 4.89141 10: 5.4463 TEST05 For a tridiagonal matrix that can be factored with no pivoting, R83_NP_FA factors, R83_NP_DET computes the determinant. Matrix order N = 10 The S3 matrix: Col: 1 2 3 4 5 Row --- 1: 0.633966 0.218418 2: 0.0136169 0.0617272 0.956318 3: 0.859097 0.449539 0.829509 4: 0.840847 0.401306 0.561695 5: 0.123104 0.754673 6: 0.00751236 Col: 6 7 8 9 10 Row --- 5: 0.415307 6: 0.797287 0.0661187 7: 0.260303 0.00183837 0.257578 8: 0.912484 0.897504 0.109957 9: 0.113664 0.350752 0.043829 10: 0.351629 0.0945448 The factored S3 matrix: Col: 1 2 3 4 5 Row --- 1: 0.633966 0.218418 2: 0.0214789 0.0570358 0.956318 3: 15.0624 -13.9549 0.829509 4: -0.0602546 0.451288 0.561695 5: 0.272783 0.601452 6: 0.0124904 Col: 6 7 8 9 10 Row --- 5: 0.415307 6: 0.7921 0.0661187 7: 0.328624 -0.0198898 0.257578 8: -45.8769 12.7144 0.109957 9: 0.00893981 0.349769 0.043829 10: 1.00532 0.0504828 R83_NP_DET computes determinant = 0.000484425 R8GE_NP_DET computes determinant = 0.000484425 TEST06 For a tridiagonal matrix that can be factored with no pivoting, R83_NP_FA factors; R83_NP_SL solves a factored system. Matrix order N = 10 The tridiagonal matrix: Col: 1 2 3 4 5 Row --- 1: 0.633966 0.218418 2: 0.0136169 0.0617272 0.956318 3: 0.859097 0.449539 0.829509 4: 0.840847 0.401306 0.561695 5: 0.123104 0.754673 6: 0.00751236 Col: 6 7 8 9 10 Row --- 5: 0.415307 6: 0.797287 0.0661187 7: 0.260303 0.00183837 0.257578 8: 0.912484 0.897504 0.109957 9: 0.113664 0.350752 0.043829 10: 0.351629 0.0945448 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to A'*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST07 R83_NP_FS factors and solves a tridiagonal linear system. Matrix order N = 10 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST08 R83_NP_ML computes A*x or A'*x where A has been factored by R83_FA. Matrix order N = 10 A*x and PLU*x: 1 1.0708 1.0708 2 3.00602 3.00602 3 6.38485 6.38485 4 6.93624 6.93624 5 6.75763 6.75763 6 5.28411 5.28411 7 3.63531 3.63531 8 14.557 14.557 9 4.50437 4.50437 10 4.11011 4.11011 A'*x and (PLU)'*x 1 1.36015 1.36015 2 4.09187 4.09187 3 4.38885 4.38885 4 4.68297 4.68297 5 8.34647 8.34647 6 8.62729 8.62729 7 11.4774 11.4774 8 14.795 14.795 9 14.3003 14.3003 10 2.87766 2.87766 TEST09 R83P_DET, determinant of a tridiagonal periodic matrix. Matrix order N = 12 The periodic tridiagonal matrix: Col: 1 2 3 4 5 Row --- 1 0.956318 0.561695 2 0.829509 0.415307 0.257578 3 0.0661187 0.109957 0.633966 4 0.043829 0.0617272 0.401306 5 0.449539 0.754673 6 0.797287 7 8 9 10 11 12 0.218418 Col: 6 7 8 9 10 Row --- 5 0.00183837 6 0.897504 0.0945448 7 0.350752 0.0136169 0.840847 8 0.859097 0.123104 0.260303 9 0.00751236 0.912484 0.351629 10 0.113664 0.822887 11 0.267132 Col: 11 12 Row --- 1 0.597917 2 3 4 5 6 7 8 9 10 0.692066 11 0.561662 0.453794 12 0.861216 0.911977 R83P_DET computes the determinant = -4.19241e-05 R8GE_DET computes the determinant = -4.19241e-05 TEST10 R83P_FA factors a tridiagonal periodic system. R83P_SL solves a tridiagonal periodic system. Matrix order N = 10 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to A'*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST105 R83P_INDICATOR sets up an S3P indicator matrix. Matrix order N = 10 The S3P indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 2 201 202 203 3 302 303 304 4 403 404 405 5 504 505 6 605 7 8 9 10 1001 Col: 6 7 8 9 10 Row --- 1 110 2 3 4 5 506 6 606 607 7 706 707 708 8 807 808 809 9 908 909 910 10 1009 1010 TEST11 R83P_ML computes A*x or A'*X where A has been factored by R83P_FA. Matrix order N = 10 A*x and PLU*x 1 4.75103 4.75103 2 2.43286 2.43286 3 2.99797 2.99797 4 2.38493 2.38493 5 5.58255 5.58255 6 10.0333 10.0333 7 8.92661 8.92661 8 9.34124 9.34124 9 11.7887 11.7887 10 9.47027 9.47027 A'*x and (PLU)'*x 1 9.20476 9.20476 2 4.0715 4.0715 3 4.25034 4.25034 4 4.68854 4.68854 5 5.55404 5.55404 6 6.3739 6.3739 7 11.2175 11.2175 8 12.6837 12.6837 9 17.7342 17.7342 10 14.8961 14.8961 TEST115 R85_INDICATOR sets up an R85 indicator matrix. Matrix order N = 10 The R85 indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 103 2 201 202 203 204 3 301 302 303 304 305 4 402 403 404 405 5 503 504 505 6 604 605 7 705 Col: 6 7 8 9 10 Row --- 4 406 5 506 507 6 606 607 608 7 706 707 708 709 8 806 807 808 809 810 9 907 908 909 910 10 1008 1009 1010 TEST12 R85_NP_FS factors and solves a pentadiagonal linear system, with no pivoting. Matrix order N = 10 The pentadiagonal matrix: Col: 1 2 3 4 5 Row --- 1 0.350752 0.043829 0.218418 2 0.351629 0.0945448 0.633966 0.956318 3 0.188955 0.822887 0.0136169 0.0617272 0.829509 4 0.761492 0.267132 0.859097 0.449539 5 0.396988 0.692066 0.840847 6 0.185314 0.561662 7 0.574366 Col: 6 7 8 9 10 Row --- 4 0.561695 5 0.401306 0.415307 6 0.123104 0.754673 0.0661187 7 0.861216 0.00751236 0.797287 0.257578 8 0.367027 0.453794 0.260303 0.00183837 0.109957 9 0.617205 0.911977 0.912484 0.897504 10 0.361529 0.597917 0.113664 Right hand side: 1 1.62087 2 5.74755 3 4.58067 4 10.1064 5 15.8815 6 13.9567 7 15.8424 8 19.8832 9 16.0093 10 10.0938 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST13 For a border banded matrix: R8BB_FA factors; R8BB_PRINT prints; R8BB_RANDOM randomizes; R8BB_SL solves. Matrix order N = 10 Matrix suborder N1 = 8 Matrix suborder N2 = 2 Lower bandwidth ML = 1 Upper bandwidth MU = 1 The border-banded matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.829509 0 0 0 2 0.956318 0.561695 0.0661187 0 0 3 0 0.415307 0.257578 0.043829 0 4 0 0 0.109957 0.633966 0.449539 5 0 0 0 0.0617272 0.401306 6 0 0 0 0 0.754673 7 0 0 0 0 0 8 0 0 0 0 0 9 0.396988 0.574366 0.617205 0.21293 0.117707 10 0.185314 0.367027 0.361529 0.714471 0.299329 Col: 6 7 8 9 10 Row --- 1 0 0 0 0.123104 0.692066 2 0 0 0 0.00751236 0.561662 3 0 0 0 0.260303 0.861216 4 0 0 0 0.912484 0.453794 5 0.797287 0 0 0.113664 0.911977 6 0.00183837 0.350752 0 0.351629 0.597917 7 0.897504 0.0945448 0.859097 0.822887 0.188955 8 0 0.0136169 0.840847 0.267132 0.761492 9 0.825003 0.0618618 0.0882833 0.745303 0.899373 10 0.82466 0.710781 0.777994 0.308675 0.763537 The right hand side vector: 1 9.90604 2 7.9623 3 12.7335 4 17.8637 5 17.1799 6 15.3835 7 22.2151 8 16.8412 9 26.6284 10 32.9193 The FACTORED border-banded matrix: Col: 1 2 3 4 5 Row --- 1 0.956318 0.561695 0.0661187 0 0 2 -0.228395 0.701221 -0.0151012 0 0 3 0 -0.592263 0.266522 0.043829 0 4 0 0 -0.412562 0.615884 0.449539 5 0 0 0 -0.100225 0.754673 6 0 0 0 0 -0.47206 7 0 0 0 0 0 8 0 0 0 0 0 9 0.396988 0.574366 0.617205 0.21293 0.117707 10 0.185314 0.367027 0.361529 0.714471 0.299329 Col: 6 7 8 9 10 Row --- 1 0 0 0 0.125967 0.0710759 2 0 0 0 -0.181574 -0.853023 3 0 0 0 -0.39304 -2.27612 4 0 0 0 -1.90868 1.80997 5 0.00183837 0.350752 0 0.758046 -3.00525 6 0.897504 0.0945448 0.859097 -0.376345 0.228679 7 -0.887371 -0.249472 -0.762338 -2.63153 4.76017 8 0 0.0545828 0.799237 -0.275079 -0.982712 9 0.825003 0.0618618 0.0882833 -3.40831 2.84183 10 0.82466 0.710781 0.777994 -0.107477 -0.844588 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST14 For a border banded matrix: R8BB_FA factors; R8BB_SL solves. Matrix order N = 10 Matrix suborder N1 = 0 Matrix suborder N2 = 10 Lower bandwidth ML = 0 Upper bandwidth MU = 0 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST15 For a border banded matrix: R8BB_FA factors; R8BB_SL solves. Matrix order N = 10 Matrix suborder N1 = 10 Matrix suborder N2 = 0 Lower bandwidth ML = 1 Upper bandwidth MU = 1 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST151 R8BB_INDICATOR sets up an R8BB indicator matrix. Matrix order N = 8 Matrix suborder N1 = 6 Matrix suborder N2 = 2 Lower bandwidth ML = 1 Upper bandwidth MU = 1 The R8BB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 0 2 21 22 23 0 0 3 0 32 33 34 0 4 0 0 43 44 45 5 0 0 0 54 55 6 0 0 0 0 65 7 71 72 73 74 75 8 81 82 83 84 85 Col: 6 7 8 Row --- 1 0 17 18 2 0 27 28 3 0 37 38 4 0 47 48 5 56 57 58 6 66 67 68 7 76 77 78 8 86 87 88 TEST152 R8BLT_INDICATOR sets up an R8BLT indicator matrix. Matrix order N = 6 Lower bandwidth ML = 2 The R8BLT indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 2 21 22 3 31 32 33 4 42 43 44 5 53 54 55 6 64 65 Col: 6 Row --- 6 66 TEST153 For a band matrix in lower triangular storage, R8BLT_RANDOM sets a random value; R8BLT_SL solves systems; R8BLT_MXV computes A*x; R8BLT_VXM computes A'*x; Matrix order N = 10 Lower bandwidth ML = 3 The R8BLT matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 2 0.956318 0.829509 3 0.561695 0.415307 0.0661187 4 0.257578 0.109957 0.043829 0.633966 5 0.0617272 0.449539 0.401306 0.754673 6 0.797287 0.00183837 0.897504 7 0.0945448 0.0136169 8 0.123104 Col: 6 7 8 9 10 Row --- 6 0.350752 7 0.859097 0.840847 8 0.00751236 0.260303 0.912484 9 0.113664 0.351629 0.822887 0.267132 10 0.692066 0.561662 0.861216 0.453794 The right hand side: 1 0.218418 2 2.61534 3 1.59067 4 3.14484 5 6.85066 6 8.99125 7 11.4868 8 9.78258 9 12.1307 10 21.6266 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 The right hand side: 1 4.84645 2 3.6534 3 7.40509 4 5.21524 5 10.2385 6 9.20127 7 18.0537 8 20.3225 9 11.0163 10 4.53794 Solution to A'*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST154 For a real block Toeplitz matrix, R8BTO_INDICATOR sets up an indicator matrix. Block order M = 2 Block number L = 3 Matrix order N = 6 The block Toeplitz matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 21 22 23 24 25 3 31 32 11 12 13 4 41 42 21 22 23 5 51 52 31 32 11 6 61 62 41 42 21 Col: 6 Row --- 1 16 2 26 3 14 4 24 5 12 6 22 TEST155 For a real block Toeplitz matrix, R8BTO_MXV computes A * x. R8BTO_VXM computes A'* x. Block order M = 2 Block number L = 3 Matrix order N = 6 The block Toeplitz matrix: Col: 1 2 3 4 5 Row --- 1 1 2 3 4 5 2 5 5 6 6 7 3 7 8 1 2 3 4 8 8 5 5 6 5 9 0 7 8 1 6 9 9 8 8 5 Col: 6 Row --- 1 6 2 7 3 4 4 6 5 2 6 5 The 'vector' x: Col: 1 2 3 Row --- 1 11 12 13 2 21 22 23 The product A*x: Col: 1 2 3 Row --- 1 380 432 418 2 616 642 740 The product A'*x: Col: 1 2 3 Row --- 1 700 556 498 2 606 592 534 TEST1565 R8BUT_INDICATOR sets up an SBUT indicator matrix. Matrix order N = 6 Upper bandwidth MU = 2 The R8BUT indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 2 22 23 24 3 33 34 35 4 44 45 5 55 6 Col: 6 Row --- 6 66 TEST1566 For a band matrix in upper triangular storage, R8BUT_RANDOM sets a random value; R8BUT_SL solves systems; R8BUT_MXV computes matrix-vector products; R8BUT_VXM computes vector-matrix products; Matrix order N = 10 Upper bandwidth MU = 3 The R8BUT matrix: Col: 1 2 3 4 5 Row --- 1 0.260303 0.00183837 0.109957 0.218418 2 0.912484 0.897504 0.043829 0.956318 3 0.113664 0.350752 0.633966 4 0.351629 0.0945448 5 0.822887 6 7 8 Col: 6 7 8 9 10 Row --- 6 0.267132 0.859097 0.401306 0.0661187 7 0.692066 0.840847 0.754673 0.257578 8 0.561662 0.123104 0.797287 9 0.861216 0.00751236 10 0.453794 The right hand side: 1 1.46752 2 9.47438 3 9.89089 4 6.18147 5 10.6654 6 11.422 7 20.9391 8 13.5741 9 7.82607 10 4.53794 Solution to the untransposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 The right hand side: 1 0.260303 2 1.82681 3 2.24596 4 2.76485 5 8.30715 6 4.40631 7 14.4935 8 14.8636 9 14.4152 10 12.7869 Solution to the transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST157 R8CB_INDICATOR sets up an R8CB indicator matrix. Matrix rows M = 8 Matrix columns N = 10 Lower bandwidth ML = 2 Upper bandwidth MU = 3 The R8CB indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 103 104 2 201 202 203 204 205 3 301 302 303 304 305 4 402 403 404 405 5 503 504 505 6 604 605 7 705 Col: 6 7 8 9 10 Row --- 3 306 4 406 407 5 506 507 508 6 606 607 608 609 7 706 707 708 709 710 8 806 807 808 809 810 TEST16 For a compact band matrix, no pivoting: R8CB_NP_FA factors; R8CB_DET computes the determinant; Matrix order N = 10 Lower bandwidth ML = 2 Upper bandwidth MU = 3 The compact band matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.561695 0.109957 0.401306 2 0.956318 0.415307 0.043829 0.754673 0.0945448 3 0.829509 0.0661187 0.633966 0.797287 0.0136169 4 0.257578 0.0617272 0.00183837 0.859097 5 0.449539 0.897504 0.840847 6 0.350752 0.123104 7 0.00751236 Col: 6 7 8 9 10 Row --- 3 0.260303 4 0.912484 0.692066 5 0.113664 0.561662 0.188955 6 0.351629 0.861216 0.761492 0.617205 7 0.822887 0.453794 0.396988 0.361529 0.299329 8 0.267132 0.911977 0.185314 0.21293 0.825003 9 0.597917 0.574366 0.714471 0.82466 10 0.367027 0.117707 0.0618618 R8CB_DET computes the determinant = 0.0183588 R8GE_DET computes the determinant = 0.0183588 TEST17 For a compact band matrix, no pivoting: R8CB_NP_FA factors; R8CB_NP_SL solves. Matrix order N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 2 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to A'x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST18 For a compact band matrix: R8CB_ML computes A*x or A'*X where A has been factored by R8CB_FA. Matrix order N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 2 A*x and PLU*x 1 2.07579 2.07579 2 5.3883 5.3883 3 5.18076 5.18076 4 8.02059 8.02059 5 8.06762 8.06762 6 12.7308 12.7308 7 8.52067 8.52067 8 15.4017 15.4017 9 20.7578 20.7578 10 13.7301 13.7301 A'*x and (PLU)'*x 1 1.71194 1.71194 2 2.49071 2.49071 3 3.53774 3.53774 4 7.10439 7.10439 5 6.80503 6.80503 6 14.9862 14.9862 7 18.7469 18.7469 8 7.88328 7.88328 9 12.7733 12.7733 10 2.65418 2.65418 TEST19 For a compressed border banded matrix: R8CBB_RANDOM randomly generates; R8CBB_PRINT prints; R8CBB_FA factors (no pivoting); R8CBB_SL solves. Matrix order N = 10 Matrix suborder N1 = 8 Matrix suborder N2 = 2 Lower bandwidth ML = 1 Upper bandwidth MU = 1 The R8CBB matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.829509 0 0 0 2 0.956318 0.561695 0.0661187 0 0 3 0 0.415307 0.257578 0.043829 0 4 0 0 0.109957 0.633966 0.449539 5 0 0 0 0.0617272 0.401306 6 0 0 0 0 0.754673 7 0 0 0 0 0 8 0 0 0 0 0 9 0.396988 0.574366 0.617205 0.21293 0.117707 10 0.185314 0.367027 0.361529 0.714471 0.299329 Col: 6 7 8 9 10 Row --- 1 0 0 0 0.123104 0.692066 2 0 0 0 0.00751236 0.561662 3 0 0 0 0.260303 0.861216 4 0 0 0 0.912484 0.453794 5 0.797287 0 0 0.113664 0.911977 6 0.00183837 0.350752 0 0.351629 0.597917 7 0.897504 0.0945448 0.859097 0.822887 0.188955 8 0 0.0136169 0.840847 0.267132 0.761492 9 0.825003 0.0618618 0.0882833 0.745303 0.899373 10 0.82466 0.710781 0.777994 0.308675 0.763537 The factored R8CBB matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.829509 0 0 0 2 -4.37838 -3.07021 0.0661187 0 0 3 0 0.13527 0.266522 0.043829 0 4 0 0 -0.412562 0.615884 0.449539 5 0 0 0 -0.100225 0.356251 6 0 0 0 0 -2.11838 7 0 0 0 0 0 8 0 0 0 0 0 9 0.396988 0.574366 0.617205 0.21293 0.117707 10 0.185314 0.367027 0.361529 0.714471 0.299329 Col: 6 7 8 9 10 Row --- 1 0 0 0 0.125967 0.0710759 2 0 0 0 -0.181574 -0.853023 3 0 0 0 -0.39304 -2.27612 4 0 0 0 -1.90868 1.80997 5 0.797287 0 0 0.758046 -3.00525 6 -1.68711 0.350752 0 -0.376345 0.228679 7 0.531976 0.281136 0.859097 -2.63153 4.76017 8 0 -0.0484352 0.799237 -0.275079 -0.982712 9 0.825003 0.0618618 0.0882833 -0.366315 -0.539156 10 0.82466 0.710781 0.777994 -9.30432 7.85831 The right hand side vector b: 1 9.90604 2 7.9623 3 12.7335 4 17.8637 5 17.1799 6 15.3835 7 22.2151 8 16.8412 9 26.6284 10 32.9193 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST193 R8CBB_INDICATOR sets up an R8CBB indicator matrix. Matrix order N = 8 Matrix suborder N1 = 6 Matrix suborder N2 = 2 Lower bandwidth ML = 1 Upper bandwidth MU = 1 The R8CBB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 0 2 21 22 23 0 0 3 0 32 33 34 0 4 0 0 43 44 45 5 0 0 0 54 55 6 0 0 0 0 65 7 71 72 73 74 75 8 81 82 83 84 85 Col: 6 7 8 Row --- 1 0 17 18 2 0 27 28 3 0 37 38 4 0 47 48 5 56 57 58 6 66 67 68 7 76 77 78 8 86 87 88 TEST195 R8CI_EVAL finds the eigenvalues of a real circulant system. Matrix order N = 5 The circulant matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0.829509 0.561695 0.415307 2 0.415307 0.218418 0.956318 0.829509 0.561695 3 0.561695 0.415307 0.218418 0.956318 0.829509 4 0.829509 0.561695 0.415307 0.218418 0.956318 5 0.956318 0.829509 0.561695 0.415307 0.218418 The eigenvalues: Real Imaginary Part Part 1 -0.461343 -0.0632919 2 -0.461343 0.0632919 3 -0.483235 -0.671949 4 -0.483235 0.671949 5 2.98125 0 TEST197 R8CI_INDICATOR sets up an R8CI indicator matrix. Matrix order N = 5 The circulant matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 15 11 12 13 14 3 14 15 11 12 13 4 13 14 15 11 12 5 12 13 14 15 11 TEST20 R8CI_SL solves a circulant system. Matrix order N = 10 The circulant matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0.829509 0.561695 0.415307 2 0.633966 0.218418 0.956318 0.829509 0.561695 3 0.043829 0.633966 0.218418 0.956318 0.829509 4 0.109957 0.043829 0.633966 0.218418 0.956318 5 0.257578 0.109957 0.043829 0.633966 0.218418 6 0.0661187 0.257578 0.109957 0.043829 0.633966 7 0.415307 0.0661187 0.257578 0.109957 0.043829 8 0.561695 0.415307 0.0661187 0.257578 0.109957 9 0.829509 0.561695 0.415307 0.0661187 0.257578 10 0.956318 0.829509 0.561695 0.415307 0.0661187 Col: 6 7 8 9 10 Row --- 1 0.0661187 0.257578 0.109957 0.043829 0.633966 2 0.415307 0.0661187 0.257578 0.109957 0.043829 3 0.561695 0.415307 0.0661187 0.257578 0.109957 4 0.829509 0.561695 0.415307 0.0661187 0.257578 5 0.956318 0.829509 0.561695 0.415307 0.0661187 6 0.218418 0.956318 0.829509 0.561695 0.415307 7 0.633966 0.218418 0.956318 0.829509 0.561695 8 0.043829 0.633966 0.218418 0.956318 0.829509 9 0.109957 0.043829 0.633966 0.218418 0.956318 10 0.257578 0.109957 0.043829 0.633966 0.218418 Solution to A*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to A'*x=b: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST21 For a general banded matrix, R8GB_DET computes the determinant. Matrix rows M = 10 Matrix columns N = 10 Lower bandwidth ML = 3 Upper bandwidth MU = 2 The banded matrix: Col: 1 2 3 4 5 Row --- 1 0 0 0 0.00183837 0.123104 2 0 0 0.633966 0.897504 0.00751236 3 0 0 0.0617272 0.350752 0.260303 4 0 0.415307 0.449539 0.0945448 0.912484 5 0 0.0661187 0.401306 0.0136169 0.113664 6 0.218418 0.257578 0.754673 0.859097 0 7 0.956318 0.109957 0.797287 0 0 8 0.829509 0.043829 0 0 0 9 0.561695 0 0 0 0.351629 10 0 0 0 0.840847 0.822887 Col: 6 7 8 9 10 Row --- 1 0.267132 0.188955 0.361529 0 95.1079 2 0.692066 0.761492 0 0 4.03652e-321 3 0.561662 0.396988 0 0 0.218418 4 0.861216 0 0 0 0.956318 5 0 0 0 0.825003 0.829509 6 0 0 0.21293 0.82466 0.561695 7 0 0.185314 0.714471 0.0618618 0 8 0.453794 0.574366 0.117707 0 0 9 0.911977 0.367027 0.299329 0 0 10 0.597917 0.617205 0 0 0 R8GB_DET computes the determinant = 0.00240436 R8GE_DET computes the determinant = 0.00240436 TEST22 For a general banded matrix, R8GB_FA computes the PLU factors. R8GB_SL solves a factored linear system. Matrix rows M = 5 Matrix columns N = 5 Lower bandwidth ML = 1 Upper bandwidth MU = 2 The banded matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.829509 0.0661187 0 2 0.956318 0.561695 0.257578 0.633966 0 3 0.415307 0.109957 0.0617272 0.754673 4 0.043829 0.449539 0.797287 5 0.401306 0.00183837 Solution: 1 1 2 2 3 3 4 4 5 5 Right hand side of transposed system: 1 2.13105 2 3.19882 3 1.08646 4 5.2578 5 5.46236 Solution to transposed system: 1 1 2 2 3 3 4 4 5 5 TEST23 For a general banded matrix, R8GB_FA factors, using LINPACK conventions; R8GB_TRF factors, using LAPACK conventions; Matrix rows M = 5 Matrix columns N = 5 Lower bandwidth ML = 1 Upper bandwidth MU = 1 The R8GB_FA factors: Col: 1 2 3 4 5 Row --- 1 0.956318 0.561695 0.0661187 2 -0.228395 0.701221 -0.0151012 0 3 -0.592263 0.266522 0.043829 0 4 -0.412562 0.615884 0.449539 5 -0.100225 0.356251 The R8GB_TRF factors: Col: 1 2 3 4 5 Row --- 1 0.956318 0.561695 0.0661187 2 0.228395 0.701221 -0.0151012 0 3 0.592263 0.266522 0.043829 0 4 0.412562 0.615884 0.449539 5 0.100225 0.356251 TEST235 For a general banded matrix, R8GB_INDICATOR sets up an indicator matrix. Matrix rows M = 10 Matrix columns N = 8 Lower bandwidth ML = 3 Upper bandwidth MU = 2 The banded matrix in R8GE format: Col: 1 2 3 4 5 Row --- 1 -1 -6 -10 -13 -15 2 -2 -7 -11 -14 0 3 -3 -8 -12 0 0 4 -4 -9 13 24 35 5 -5 12 23 34 45 6 11 22 33 44 55 7 21 32 43 54 65 8 31 42 53 64 75 9 41 52 63 74 85 Col: 6 7 8 Row --- 1 0 0 0 2 0 0 0 3 0 0 0 4 46 57 68 5 56 67 78 6 66 77 88 7 76 87 98 8 86 97 108 9 96 107 -16 The R8GB indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 0 0 2 21 22 23 24 0 3 31 32 33 34 35 4 41 42 43 44 45 5 52 53 54 55 6 63 64 65 7 74 75 8 85 Col: 6 7 8 Row --- 1 0 2 0 0 3 0 0 0 4 46 0 0 5 56 57 0 6 66 67 68 7 76 77 78 8 86 87 88 9 96 97 98 10 107 108 TEST24 For a general banded matrix, R8GB_ML computes A*x or A'*X where A has been factored by R8GB_FA. Matrix rows M = 10 Matrix columns N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 2 A*x and PLU*x 1 2.07579 2.07579 2 5.3883 5.3883 3 5.18076 5.18076 4 8.02059 8.02059 5 8.06762 8.06762 6 12.7308 12.7308 7 8.52067 8.52067 8 15.4017 15.4017 9 20.7578 20.7578 10 13.7301 13.7301 A'*x and (PLU)'*x 1 1.71194 1.71194 2 2.49071 2.49071 3 3.53774 3.53774 4 7.10439 7.10439 5 6.80503 6.80503 6 14.9862 14.9862 7 18.7469 18.7469 8 7.88328 7.88328 9 12.7733 12.7733 10 2.65418 2.65418 TEST25 For a general banded matrix, R8GB_PRINT prints the matrix. Matrix rows M = 8 Matrix columns N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 3 The banded matrix: Col: 1 2 3 4 5 Row --- 1 101 102 103 104 0 2 201 202 203 204 205 3 302 303 304 305 4 403 404 405 5 504 505 6 605 Col: 6 7 8 9 10 Row --- 2 0 3 306 0 4 406 407 0 5 506 507 508 0 6 606 607 608 609 0 7 706 707 708 709 710 8 807 808 809 810 TEST26 For a general banded matrix, R8GB_NZ_NUM counts the nonzero entries. Matrix rows M = 10 Matrix columns N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 2 The R8GB matrix: Col: 1 2 3 4 5 Row --- 1 0 0.829509 0 0 2 0.956318 0.561695 0 0.633966 0 3 0.415307 0 0 0.754673 4 0 0.449539 0.797287 5 0.401306 0 6 0.897504 Col: 6 7 8 9 10 Row --- 3 0 4 0.350752 0 5 0 0.840847 0 6 0 0 0.912484 0 7 0.859097 0 0 0 0 8 0 0.351629 0.692066 0.453794 9 0.822887 0.561662 0.911977 10 0.861216 0.597917 Nonzero entries = 22 TEST265 R8GB_TO_R8GE copies a R8GB matrix to a R8GE matrix. R8GE_TO_R8GB copies a R8GE matrix to a R8GB matrix. Matrix rows M = 5 Matrix columns N = 8 Lower bandwidth ML = 2 Upper bandwidth MU = 1 The R8GB matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 3 0 4 0 0 5 56 0 0 The R8GE matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 0 42 43 44 45 5 0 0 53 54 55 Col: 6 7 8 Row --- 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 56 0 0 The recovered R8GB matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 3 0 4 0 0 5 56 0 0 TEST2655 R8GB_TO_R8S3 copies a R8GB matrix to a R8S3 matrix. Matrix rows M = 5 Matrix columns N = 8 Lower bandwidth ML = 2 Upper bandwidth MU = 1 The R8GB matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 42 43 44 45 5 53 54 55 Col: 6 7 8 Row --- 3 0 4 0 0 5 56 0 0 Nonzeros NZ_NUM = 17 The R8S3 matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 0 2 21 22 23 0 0 3 31 32 33 34 0 4 0 42 43 44 45 5 0 0 53 54 55 Col: 6 7 8 Row --- 5 56 0 0 TEST27 For a general banded matrix, R8GB_TRF computes the PLU factors. R8GB_TRS solves a factored linear system. Matrix rows M = 10 Matrix columns N = 10 Lower bandwidth ML = 1 Upper bandwidth MU = 2 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST275 For a general diagonal matrix: R8GD_INDICATOR sets up an indicator matrix; Matrix order N = 10 Number of diagonals NDIAG = 4 The offset vector: 1 -2 2 0 3 1 4 9 The R8GD indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 0 0 2 0 202 203 0 0 3 301 0 303 304 0 4 0 402 0 404 405 5 0 0 503 0 505 6 0 0 0 604 0 7 0 0 0 0 705 8 0 0 0 0 0 9 0 0 0 0 0 10 0 0 0 0 0 Col: 6 7 8 9 10 Row --- 1 0 0 0 0 110 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 0 0 5 506 0 0 0 0 6 606 607 0 0 0 7 0 707 708 0 0 8 806 0 808 809 0 9 0 907 0 909 910 10 0 0 1008 0 1010 TEST28 For a general diagonal matrix: R8GD_MXV computes A * x; R8GD_PRINT prints it; R8GD_RANDOM randomly generates one; R8GD_VXM computes A'*x; Matrix order N = 10 Number of diagonals NDIAG = 4 The offset vector: 1 -2 2 0 3 1 4 9 The raw matrix: Col: 1 2 3 4 Row --- 1 0 0.218418 0.956318 0.829509 2 0 0.561695 0.415307 0 3 0.0661187 0.257578 0.109957 0 4 0.043829 0.633966 0.0617272 0 5 0.449539 0.401306 0.754673 0 6 0.797287 0.00183837 0.897504 0 7 0.350752 0.0945448 0.0136169 0 8 0.859097 0.840847 0.123104 0 9 0.00751236 0.260303 0.912484 0 10 0.113664 0.351629 0 0 The general diagonal matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0 0 2 0 0.561695 0.415307 0 0 3 0.0661187 0 0.257578 0.109957 0 4 0 0.043829 0 0.633966 0.0617272 5 0 0 0.449539 0 0.401306 6 0 0 0 0.797287 0 7 0 0 0 0 0.350752 8 0 0 0 0 0 9 0 0 0 0 0 10 0 0 0 0 0 Col: 6 7 8 9 10 Row --- 1 0 0 0 0 0.829509 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 0 0 5 0.754673 0 0 0 0 6 0.00183837 0.897504 0 0 0 7 0 0.0945448 0.0136169 0 0 8 0.859097 0 0.840847 0.123104 0 9 0 0.00751236 0 0.260303 0.912484 10 0 0 0.113664 0 0.351629 A * x: 1 10.4261 2 2.36931 3 1.27868 4 2.93216 5 7.88319 6 9.48271 7 2.52451 8 12.9893 9 11.5202 10 4.4256 A' * x: 1 0.416775 2 2.25502 3 3.85104 4 7.64945 5 4.70871 6 10.6572 7 6.11445 8 7.95874 9 3.32756 10 12.5581 TEST285 For a matrix in general storage, R8GE_CO estimates the condition number. Matrix order N = 4 The L1 condition number is 10 The R8GE_CO estimate is 7 TEST29 R8GE_DET, determinant of a general matrix. Matrix order N = 4 R8GE_DET computes the determinant = 112 Correct determinant = 112 TEST295 For a matrix in general storage, R8GE_DILU returns the DILU factors. Matrix rows M = 9 Matrix columns N = 9 Matrix A: Col: 1 2 3 4 5 Row --- 1 4 -1 0 -1 0 2 -1 4 -1 0 -1 3 0 -1 4 -1 0 4 -1 0 -1 4 -1 5 0 -1 0 -1 4 6 0 0 -1 0 -1 7 0 0 0 -1 0 8 0 0 0 0 -1 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 -1 0 0 0 4 0 -1 0 0 5 -1 0 -1 0 6 4 -1 0 -1 7 -1 4 -1 0 8 0 -1 4 -1 9 -1 0 -1 4 DILU factor of A: 1 0.25 2 0.266667 3 0.267857 4 0.287179 5 0.290179 6 0.290532 7 0.292202 8 0.292601 9 0.292666 TEST30 R8GE_FA factors a general linear system, R8GE_SL solves a factored system. Matrix order N = 5 Random matrix A: Col: 1 2 3 4 5 Row --- 1 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 0.956318 0.257578 0.449539 0.897504 0.840847 3 0.829509 0.109957 0.401306 0.350752 0.123104 4 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 0.415307 0.633966 0.797287 0.0136169 0.260303 Solution: 1 1 2 2 3 3 4 4 5 5 Solution: 1 1 2 1 3 1 4 1 5 1 Solution of transposed system: 1 1 2 2 3 3 4 4 5 5 TEST31 For a matrix in general storage, R8GE_FA computes the LU factors, R8GE_SL solves a factored system. Matrix order N = 5 The matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 0.956318 0.257578 0.449539 0.897504 0.840847 3 0.829509 0.109957 0.401306 0.350752 0.123104 4 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 0.415307 0.633966 0.797287 0.0136169 0.260303 The compressed LU factors: Col: 0 1 2 3 4 Row 0: 0.956318 0.257578 0.449539 0.897504 0.840847 1: -0.228395 0.522106 0.602062 -0.376149 -0.104858 2: -0.867399 0.217324 0.614552 -0.510026 -0.507943 3: -0.587352 0.20582 -0.231419 -0.391459 -0.511487 4: -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 The pivot vector P: 1 2 2 5 3 4 4 4 5 5 Solution: 1 1 2 2 3 3 4 4 5 5 TEST315 For a matrix in general storage, R8GE_ILU returns the ILU factors. Matrix rows M = 9 Matrix columns N = 9 Matrix A: Col: 1 2 3 4 5 Row --- 1 4 -1 0 -1 0 2 -1 4 -1 0 -1 3 0 -1 4 -1 0 4 -1 0 -1 4 -1 5 0 -1 0 -1 4 6 0 0 -1 0 -1 7 0 0 0 -1 0 8 0 0 0 0 -1 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 -1 0 0 0 4 0 -1 0 0 5 -1 0 -1 0 6 4 -1 0 -1 7 -1 4 -1 0 8 0 -1 4 -1 9 -1 0 -1 4 Factor L: Col: 1 2 3 4 5 Row --- 1 1 0 0 0 0 2 -0.25 1 0 0 0 3 0 -0.266667 1 0 0 4 -0.25 0 -0.267857 1 0 5 0 -0.266667 0 -0.287179 1 6 0 0 -0.267857 0 -0.290179 7 0 0 0 -0.287179 0 8 0 0 0 0 -0.290179 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 6 1 0 0 0 7 -0.290532 1 0 0 8 0 -0.292202 1 0 9 -0.290532 0 -0.292601 1 Factor U: Col: 1 2 3 4 5 Row --- 1 4 -1 0 -1 0 2 0 3.75 -1 0 -1 3 0 0 3.73333 -1 0 4 0 0 0 3.48214 -1 5 0 0 0 0 3.44615 6 0 0 0 0 0 7 0 0 0 0 0 8 0 0 0 0 0 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 -1 0 0 0 4 0 -1 0 0 5 -1 0 -1 0 6 3.44196 -1 0 -1 7 0 3.42229 -1 0 8 0 0 3.41762 -1 9 0 0 0 3.41687 Product L*U: Col: 1 2 3 4 5 Row --- 1 4 -1 0 -1 0 2 -1 4 -1 0.25 -1 3 0 -1 4 -1 0.266667 4 -1 0.25 -1 4 -1 5 0 -1 0.266667 -1 4 6 0 0 -1 0.267857 -1 7 0 0 0 -1 0.287179 8 0 0 0 0 -1 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 -1 0 0 0 4 0.267857 -1 0 0 5 -1 0.287179 -1 0 6 4 -1 0.290179 -1 7 -1 4 -1 0.290532 8 0.290179 -1 4 -1 9 -1 0.290532 -1 4 TEST317 For a matrix in general storage, R8GE_INDICATOR sets up an indicator matrix. Matrix rows M = 7 Matrix columns N = 5 The R8GE indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 21 22 23 24 25 3 31 32 33 34 35 4 41 42 43 44 45 5 51 52 53 54 55 6 61 62 63 64 65 7 71 72 73 74 75 TEST32 For a matrix in general storage, R8GE_NP_FA computes the LU factors without pivoting, R8GE_NP_SL solves factored systems. Matrix order N = 10 Solution: 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9: 1 10: 1 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Solution of transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST33 For a matrix in general storage, R8GE_NP_FA computes LU factors without pivoting, R8GE_NP_INVERSE computes the inverse. Matrix order N = 5 The random matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 0.956318 0.257578 0.449539 0.897504 0.840847 3 0.829509 0.109957 0.401306 0.350752 0.123104 4 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 0.415307 0.633966 0.797287 0.0136169 0.260303 The inverse matrix: Col: 1 2 3 4 5 Row --- 1 0.625209 -1.0222 2.84978 -0.868794 -0.0840984 2 -0.471548 -0.149728 0.892032 -2.1207 1.67928 3 -0.274368 0.546937 -1.95265 2.05705 0.00285593 4 -1.39029 1.75848 -1.70625 0.283212 -0.293107 5 1.06404 0.228349 -0.649235 0.235691 -0.107439 The product: Col: 1 2 3 4 5 Row --- 1 1 -6.10623e-16 0 -5.55112e-17 0 2 9.76996e-15 1 1.11022e-16 -2.77556e-17 -4.16334e-17 3 3.747e-15 -9.15934e-16 1 -1.73472e-17 6.07153e-17 4 3.64292e-15 -8.3592e-16 -4.04191e-16 1 6.98226e-17 5 2.4758e-14 -4.20497e-15 -1.22125e-15 -6.17562e-16 1 TEST34 For a matrix in general storage, R8GE_FS_NEW factors and solves a linear system. Matrix order N = 10 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST345 For a matrix in general storage, R8GE_FSS_NEW factors and solves multiple linear systems. Matrix order N = 10 Number of systems NB = 3 Solutions: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 2 2: 1 3 3 3: 1 4 1 4: 1 5 2 5: 1 6 3 6: 1 7 1 7: 1 8 2 8: 1 9 3 9: 1 10 1 TEST35 R8GE_INVERSE inverts a general matrix. Matrix order N = 4 Matrix A: Col: 1 2 3 4 Row --- 1 5 3 3 3 2 3 5 3 3 3 3 3 5 3 4 3 3 3 5 Inverse matrix B: Col: 1 2 3 4 Row --- 1 0.392857 -0.107143 -0.107143 -0.107143 2 -0.107143 0.392857 -0.107143 -0.107143 3 -0.107143 -0.107143 0.392857 -0.107143 4 -0.107143 -0.107143 -0.107143 0.392857 Product matrix: Col: 1 2 3 4 Row --- 1 1 -1.11022e-16 0 0 2 3.33067e-16 1 0 0 3 4.44089e-16 -1.11022e-16 1 0 4 4.44089e-16 -1.11022e-16 1.11022e-16 1 TEST36 R8GE_ML computes A*x or A'*X where A has been factored by R8GE_FA. Matrix order N = 10 A*x and PLU*x 1 32.6597 32.6597 2 30.7617 30.7617 3 20.173 20.173 4 24.1126 24.1126 5 30.7597 30.7597 6 32.7342 32.7342 7 28.0252 28.0252 8 28.3091 28.3091 9 28.7501 28.7501 10 17.3141 17.3141 A'*x and (PLU)'*x 1 29.518 29.518 2 34.2533 34.2533 3 29.9813 29.9813 4 25.9818 25.9818 5 28.7133 28.7133 6 28.373 28.373 7 33.4872 33.4872 8 26.6124 26.6124 9 24.8414 24.8414 10 26.539 26.539 TEST37 For a matrix in general storage, R8GE_NP_ML computes A*x or A'*X where A has been factored by R8GE_NP_FA. Matrix order N = 10 A*x and PLU*x 1 32.6597 32.6597 2 30.7617 30.7617 3 20.173 20.173 4 24.1126 24.1126 5 30.7597 30.7597 6 32.7342 32.7342 7 28.0252 28.0252 8 28.3091 28.3091 9 28.7501 28.7501 10 17.3141 17.3141 A'*x and (PLU)'*x 1 29.518 29.518 2 34.2533 34.2533 3 29.9813 29.9813 4 25.9818 25.9818 5 28.7133 28.7133 6 28.373 28.373 7 33.4872 33.4872 8 26.6124 26.6124 9 24.8414 24.8414 10 26.539 26.539 TEST38 For a matrix in general storage, R8GE_MU computes A*x or A'*X where A has been factored by R8GE_TRF. Matrix rows M = 5 Matrix columns N = 3 A*x and PLU*x 1 0.535837 0.535837 2 2.82009 2.82009 3 2.25334 2.25334 4 2.91337 2.91337 5 4.0751 4.0751 Matrix rows M = 5 Matrix columns N = 3 A'*x and (PLU)'*x 1 3.29537 3.29537 2 4.24167 4.24167 3 6.82191 6.82191 Matrix rows M = 3 Matrix columns N = 5 A*x and PLU*x 1 5.9938 5.9938 2 8.7752 8.7752 3 5.78077 5.78077 Matrix rows M = 3 Matrix columns N = 5 A'*x and (PLU)'*x 1 1.84787 1.84787 2 2.65991 2.65991 3 3.22133 3.22133 4 4.06077 4.06077 5 3.50791 3.50791 TEST39 For a matrix in general storage, R8GE_POLY computes the characteristic polynomial. Matrix order N = 12 I, P(I), True P(I) 1 1 1 2 -23 -23 3 231 231 4 -1330 -1330 5 4845 4845 6 -11628 -11628 7 18564 18564 8 -19448 -19448 ...... .............. .............. 13 1 1 TEST385 For a matrix in general storage, R8GE_PLU returns the PLU factors of a matrix. Matrix rows M = 5 Matrix columns N = 4 Matrix A: Col: 1 2 3 4 Row --- 1 0.218418 0.0661187 0.0617272 0.00183837 2 0.956318 0.257578 0.449539 0.897504 3 0.829509 0.109957 0.401306 0.350752 4 0.561695 0.043829 0.754673 0.0945448 5 0.415307 0.633966 0.797287 0.0136169 Factor P: Col: 1 2 3 4 5 Row --- 1 0 0 0 0 1 2 1 0 0 0 0 3 0 0 0 1 0 4 0 0 1 0 0 5 0 1 0 0 0 Factor L: Col: 1 2 3 4 5 Row --- 1 1 0 0 0 0 2 0.434277 1 0 0 0 3 0.587352 -0.20582 1 0 0 4 0.867399 -0.217324 0.231419 1 0 5 0.228395 0.0139612 -0.0803036 0 1 Factor U: Col: 1 2 3 4 Row --- 1 0.956318 0.257578 0.449539 0.897504 2 0 0.522106 0.602062 -0.376149 3 0 0 0.614552 -0.510026 4 0 0 0 -0.391459 5 0 0 0 -0.238853 Product P*L*U: Col: 1 2 3 4 Row --- 1 0.218418 0.0661187 0.0617272 0.00183837 2 0.956318 0.257578 0.449539 0.897504 3 0.829509 0.109957 0.401306 0.350752 4 0.561695 0.043829 0.754673 0.0945448 5 0.415307 0.633966 0.797287 0.0136169 TEST39 For a matrix in general storage, R8GE_POLY computes the characteristic polynomial. Matrix order N = 12 I, P(I), True P(I) 1 1 1 2 -23 -23 3 231 231 4 -1330 -1330 5 4845 4845 6 -11628 -11628 7 18564 18564 8 -19448 -19448 ...... .............. .............. 13 1 1 TEST40 For a matrix in general storage, R8GE_SL_IT applies one step of iterative refinement to an R8GE_SL solution. Matrix order N = 6 i, x, b-A*x 1 0.166667 -1.13687e-13 2 0.142857 6.36646e-12 3 0.125 -1.45519e-11 4 0.111111 0 5 0.1 -5.82077e-11 6 0.0909091 1.45519e-11 Iterative refinement step 1 i, x, b-A*x 1 0.166667 -1.13687e-13 2 0.142857 -1.81899e-12 3 0.125 -1.45519e-11 4 0.111111 5.82077e-11 5 0.1 -2.91038e-11 6 0.0909091 2.18279e-11 Iterative refinement step 2 i, x, b-A*x 1 0.166667 2.84217e-14 2 0.142857 -9.09495e-13 3 0.125 0 4 0.111111 0 5 0.1 0 6 0.0909091 -1.45519e-11 Iterative refinement step 3 i, x, b-A*x 1 0.166667 -2.84217e-14 2 0.142857 9.09495e-13 3 0.125 -1.45519e-11 4 0.111111 -2.91038e-11 5 0.1 0 6 0.0909091 -7.27596e-12 Iterative refinement step 4 i, x, b-A*x 1 0.166667 5.68434e-14 2 0.142857 3.63798e-12 3 0.125 2.18279e-11 4 0.111111 1.16415e-10 5 0.1 -2.91038e-11 6 0.0909091 7.27596e-12 Iterative refinement step 5 i, x, b-A*x 1 0.166667 -8.52651e-14 2 0.142857 -6.36646e-12 3 0.125 -1.45519e-11 4 0.111111 -5.82077e-11 5 0.1 5.82077e-11 6 0.0909091 7.27596e-12 TEST41 For a matrix in general storage, R8GE_TRF computes the LU factors, R8GE_TRS solves a factored system. Matrix rows M = 5 Matrix columns N = 5 Solution: 1 1 2 2 3 3 4 4 5 5 Solution to transposed system: 1 1 2 2 3 3 4 4 5 5 TEST42 For a matrix in general storage, R8GE_NP_TRF factors without pivoting, R8GE_NP_TRS solves factored systems. R8GE_NP_TRM computes A*X for factored A. Matrix rows M = 10 Matrix columns N = 10 Solution: 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution of transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST422 For a matrix in the R8CC format, (double precision Harwell-Boeing Unsymmetric Assembled) R8CC_GET gets an entry; R8CC_IJK gets K from (I,J) R8CC_INC increments an entry; R8CC_KIJ gets (I,J) from K; R8CC_SET sets an entry; Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 The COLPTR vector: 1 1 2 4 3 6 4 8 5 10 6 13 The ROWIND vector: 1 1 2 2 3 4 4 1 5 2 6 3 7 5 8 4 9 5 10 1 11 2 12 5 The initial R8CC matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.561695 0 0 0.633966 2 0.956318 0.415307 0 0 0.0617272 3 0 0 0.0661187 0 0 4 0.829509 0 0 0.109957 0 5 0 0 0.257578 0.043829 0.449539 R8CC_IJK locates some (I,J) entries. I J K 3 4 -1 4 1 3 5 2 -1 1 1 1 5 5 12 1 1 1 2 5 11 1 2 4 5 2 -1 4 3 -1 5 3 7 5 3 7 1 4 -1 2 1 2 3 2 -1 4 2 -1 2 4 -1 1 2 4 5 5 12 1 4 -1 R8CC_KIJ locates some K entries. K I J 2 2 1 10 1 5 9 5 4 4 1 2 11 2 5 10 1 5 10 1 5 5 2 2 12 5 5 7 5 3 1 1 1 7 5 3 1 1 1 5 2 2 4 1 2 11 2 5 1 1 1 1 1 1 2 2 1 2 2 1 R8CC_SET sets 10 entries at random. I J K NEW_VALUE 2 2 5 101 2 1 2 102 4 1 3 103 4 1 3 104 4 4 8 105 1 5 10 106 4 4 8 107 4 1 3 108 1 5 10 109 5 4 9 110 R8CC_INC increments 10 entries at random. I J K NEW_VALUE 3 3 6 21.0661 2 5 11 22.0617 5 5 12 23.4495 2 5 11 46.0617 5 3 7 25.2576 1 1 1 26.2184 3 3 6 48.0661 1 2 4 28.5617 2 5 11 75.0617 5 4 9 140 R8CC_GET retrieves 10 entries. I J K VALUE 2 2 5 101 2 1 2 102 1 5 10 109 5 5 12 23.4495 5 4 9 140 3 3 6 48.0661 4 4 8 107 2 2 5 101 5 3 7 25.2576 1 5 10 109 The final R8CC matrix: Col: 1 2 3 4 5 Row --- 1 26.2184 28.5617 0 0 109 2 102 101 0 0 75.0617 3 0 0 48.0661 0 0 4 108 0 0 107 0 5 0 0 25.2576 140 23.4495 TEST423 R8CC_INDICATOR sets up an SHBUA indicator matrix; Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 The R8CC indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 15 2 21 22 0 0 25 3 0 0 33 0 0 4 41 0 0 44 0 5 0 0 53 54 55 TEST425 R8CC_MXV multiplies an SHBUA matrix by a vector; R8CC_VXM multiplies a vector by an SHBUA matrix; Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 The R8CC matrix, in R8GE form: Col: 1 2 3 4 5 Row --- 1 0.218418 0.561695 0 0 0.633966 2 0.956318 0.415307 0 0 0.0617272 3 0 0 0.0661187 0 0 4 0.829509 0 0 0.109957 0 5 0 0 0.257578 0.043829 0.449539 The vector xn: 1 1 2 0 3 0 4 0 5 -1 The product A * xn: 1 -0.415547 2 0.89459 3 0 4 0.829509 5 -0.449539 The product A' * xm: 1 0.218418 2 0.561695 3 -0.257578 4 -0.043829 5 0.184427 TEST426 R8CC_PRINT prints an R8CC matrix. Matrix rows M = 5 Matrix columns N = 5 Nonzeros NZ_NUM = 12 The R8CC matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.561695 0 0 0.633966 2 0.956318 0.415307 0 0 0.0617272 3 0 0 0.0661187 0 0 4 0.829509 0 0 0.109957 0 5 0 0 0.257578 0.043829 0.449539 TEST428 For a matrix in lower triangular storage, R8LT_INDICATOR sets up an indicator matrix; Matrix rows M = 6 Matrix columns N = 5 The R8LT indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 2 21 22 3 31 32 33 4 41 42 43 44 5 51 52 53 54 55 6 61 62 63 64 65 TEST43 For a matrix in lower triangular storage, R8LT_SL solves systems; R8LT_MXV computes matrix-vector products; R8LT_VXM computes vector-matrix products; Matrix order N = 10 The lower triangular matrix: Col: 1 2 3 4 5 Row --- 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 7 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 Col: 6 7 8 9 10 Row --- 6 6 7 6 7 8 6 7 8 9 6 7 8 9 10 6 7 8 9 10 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to the transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST44 For a matrix in lower triangular storage, R8LT_DET computes the determinant. R8LT_INVERSE computes the inverse. R8LT_MXM computes matrix products. R8LT_RANDOM sets a random value. Matrix order N = 5 Matrix A: Col: 1 2 3 4 5 Row --- 1 0.218418 2 0.956318 0.829509 3 0.561695 0.415307 0.0661187 4 0.257578 0.109957 0.043829 0.633966 5 0.0617272 0.449539 0.401306 0.754673 0.797287 Determinant is 0.00605501 Inverse matrix B: Col: 1 2 3 4 5 Row --- 1 4.57837 2 -5.27827 1.20553 3 -5.74037 -7.57223 15.1243 4 -0.547837 0.314412 -1.04561 1.57737 5 6.02953 2.83407 -6.62294 -1.49306 1.25425 Product A * B: Col: 1 2 3 4 5 Row --- 1 1 2 0 1 3 0 0 1 4 5.55112e-17 0 1.11022e-16 1 5 0 0 0 0 1 TEST443 R8NCF_INDICATOR sets up a R8NCF indicator matrix; Matrix rows M = 7 Matrix columns N = 5 Matrix nonzeros = 15 The R8NCF indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 21 22 0 24 0 3 0 0 33 34 0 4 0 0 0 44 45 5 51 52 0 0 55 TEST445 R8PBL_INDICATOR sets up a R8PBL indicator matrix. Matrix order N = 9 Bandwidth MU = 3 The R8PBL indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 21 31 41 2 21 22 32 42 52 3 31 32 33 43 53 4 41 42 43 44 54 5 52 53 54 55 6 63 64 65 7 74 75 8 85 Col: 6 7 8 9 Row --- 3 63 4 64 74 5 65 75 85 6 66 76 86 96 7 76 77 87 97 8 86 87 88 98 9 96 97 98 99 TEST45 R8PBU_CG applies the conjugate gradient method to a symmetric positive definite banded linear system. Matrix order N = 50 Upper bandwidth MU = 1 The symmetric banded matrix: Col: 1 2 3 4 5 Row --- 1 2 -1 2 -1 2 -1 3 -1 2 -1 4 -1 2 -1 5 -1 2 6 -1 Col: 6 7 8 9 10 Row --- 5 -1 6 2 -1 7 -1 2 -1 8 -1 2 -1 9 -1 2 -1 10 -1 2 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Maximum residual = 5.68434e-14 TEST46 R8PBU_DET, determinant of a positive definite symmetric banded matrix. Matrix order N = 10 Upper bandwidth MU = 3 The R8PBU matrix: Col: 1 2 3 4 5 Row --- 1 2.53856 0.218418 0.956318 0.829509 2 0.218418 2.4318 0.561695 0.415307 0.0661187 3 0.956318 0.561695 2.15981 0.257578 0.109957 4 0.829509 0.415307 0.257578 3.59212 0.633966 5 0.0661187 0.109957 0.633966 5.05543 6 0.043829 0.0617272 0.401306 7 0.449539 0.754673 8 0.797287 Col: 6 7 8 9 10 Row --- 3 0.043829 4 0.0617272 0.449539 5 0.401306 0.754673 0.797287 6 2.23897 0.00183837 0.897504 0.350752 7 0.00183837 3.6943 0.0945448 0.0136169 0.859097 8 0.897504 0.0945448 4.31532 0.840847 0.123104 9 0.350752 0.0136169 0.840847 2.27576 0.00751236 10 0.859097 0.123104 0.00751236 1.45338 The factored R8PBU matrix: Col: 1 2 3 4 5 Row --- 1 1.59329 0.137087 0.600217 0.520628 2 0.137087 1.55339 0.308625 0.221411 0.0425643 3 0.600217 0.308625 1.30549 -0.0944052 0.074164 4 0.520628 0.221411 -0.0944052 1.80641 0.349611 5 0.0425643 0.074164 0.349611 2.21943 6 0.0335728 0.0359257 0.174034 7 0.248857 0.300829 8 0.35923 Col: 6 7 8 9 10 Row --- 3 0.0335728 4 0.0359257 0.248857 5 0.174034 0.300829 0.35923 6 1.48535 -0.0400285 0.562148 0.236141 7 -0.0400285 1.88156 0.0047726 0.0122607 0.456587 8 0.562148 0.0047726 1.96729 0.359907 0.0614676 9 0.236141 0.0122607 0.359907 1.44579 -0.0139773 10 0.456587 0.0614676 -0.0139773 1.11397 R8PBU_DET computes the determinant = 13158.4 R8GE_DET computes the determinant = 13158.4 TEST47 For a banded positive definite symmetric matrix, R8PBU_FA computes the LU factors. R8PBU_RANDOM sets a random value. R8PBU_SL solves a linear system. Matrix order N = 50 Upper bandwidth MU = 1 Solution: 1: 0.645589 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 TEST48 R8PBU_ML computes A*x where A has been factored by R8PBU_FA. Matrix order N = 10 Upper bandwidth MU = 3 A*x and PLU*x 1 9.16239 9.16239 2 8.75892 8.75892 3 10.4022 10.4022 4 23.4883 23.4883 5 42.344 42.344 6 26.1684 26.1684 7 40.9126 40.9126 8 53.3545 53.3545 9 29.4836 29.4836 10 21.5999 21.5999 TEST485 R8PBU_INDICATOR sets up an SPBU indicator matrix. Matrix order N = 9 Bandwidth MU = 3 The R8PBU indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 2 12 22 23 24 25 3 13 23 33 34 35 4 14 24 34 44 45 5 25 35 45 55 6 36 46 56 7 47 57 8 58 Col: 6 7 8 9 Row --- 3 36 4 46 47 5 56 57 58 6 66 67 68 69 7 67 77 78 79 8 68 78 88 89 9 69 79 89 99 TEST49 R8PBU_SOR, SOR routine for iterative solution of A*x=b. Matrix order N = 50 Upper bandwidth MU = 1 SOR iteration. Relaxation factor OMEGA = 0.25 Solution: 1: 0.00162299 2: 0.06731 3: 0.132722 4: 0.197589 5: 0.261647 6: 0.324632 7: 0.386286 8: 0.446356 9: 0.504596 10: 0.560767 Maximum error = 9.99603e-05 SOR iteration. Relaxation factor OMEGA = 0.75 Solution: 1: 0.00162268 2: 0.0673094 3: 0.132721 4: 0.197588 5: 0.261645 6: 0.32463 7: 0.386284 8: 0.446354 9: 0.504594 10: 0.560764 Maximum error = 9.99408e-05 SOR iteration. Relaxation factor OMEGA = 1 Solution: 1: 0.00162404 2: 0.0673122 3: 0.132725 4: 0.197593 5: 0.261652 6: 0.324638 7: 0.386293 8: 0.446365 9: 0.504605 10: 0.560777 Maximum error = 9.99855e-05 TEST50 R8PO_FA factors a positive definite symmetric linear system, R8PO_SL solves a factored system. Matrix order N = 10 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution: 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 TEST505 R8PO_FA factors a positive definite symmetric linear system, Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row --- 1 1 1 1 1 1 2 1 2 2 2 2 3 1 2 3 3 3 4 1 2 3 4 4 5 1 2 3 4 5 The factor R (an R8UT matrix): Col: 1 2 3 4 5 Row --- 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 4 1 1 5 1 The product R' * R: Col: 1 2 3 4 5 Row --- 1 1 1 1 1 1 2 1 2 2 2 2 3 1 2 3 3 3 4 1 2 3 4 4 5 1 2 3 4 5 TEST51 For a symmetric positive definite matrix factored by R8PO_FA, R8PO_DET computes the determinant; R8PO_INVERSE computes the inverse. Matrix order N = 4 Matrix A: Col: 1 2 3 4 Row --- 1 1 1 1 1 2 1 2 2 2 3 1 2 3 3 4 1 2 3 4 Matrix determinant = 1 Inverse matrix A_INV: Col: 1 2 3 4 Row --- 1 2 -1 0 -0 2 -1 2 -1 -0 3 0 -1 2 -1 4 -0 -0 -1 1 Product A * A_INV: Col: 1 2 3 4 Row --- 1 1 0 0 0 2 0 1 0 0 3 0 0 1 0 4 0 0 0 1 TEST515 For a positive definite symmetric matrix, R8PO_FA computes the Cholesky factor. R8PO_SL solves a factored linear system. R8PO_MXV multiplies unfactored A * x R8PO_ML multiplies factored A * x Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 Right hand side, computed by R8PO_MXV 1 0.56603 2 5.2015 3 6.20596 4 16.2555 5 17.0626 Solution (should be 1,2,3...) 1 1 2 2 3 3 4 4 5 5 Right hand side, computed by R8PO_ML 1 0.00215671 2 1.40451 3 3.9103 4 27.9858 5 41.125 Solution (should be 1,2,3...) 1 1 2 2 3 3 4 4 5 5 TEST517 R8PO_INDICATOR sets up an R8PO indicator matrix. Matrix order N = 5 The R8PO indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 12 22 23 24 25 3 13 23 33 34 35 4 14 24 34 44 45 5 15 25 35 45 55 TEST52 R8PO_RANDOM computes a random positive definite symmetric matrix. R8PO_TO_R8GE converts an R8PO matrix to R8GE format. Matrix order N = 5 The random R8PO matrix: Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 The random R8PO matrix (printed by R8GE_PRINT): Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0 0.268432 0.208725 0.350545 0.521707 3 0 0 0.488639 0.540951 0.426804 4 0 0 0 1.65848 1.45021 5 0 0 0 0 1.77774 The random R8GE matrix (printed by R8GE_PRINT): Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 TEST525 R8PP_FA factors an R8PP system, R8PP_SL solves an R8PP system. Matrix order N = 5 The R8PP matrix: Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 The desired solution: 1 1 2 2 3 3 4 4 5 5 The right hand side: 1 0.56603 2 5.2015 3 6.20596 4 16.2555 5 17.0626 The R8PP matrix has been factored. Solution: 1 1 2 2 3 3 4 4 5 5 TEST527 R8PP_INDICATOR sets up an R8PP indicator matrix. Matrix order N = 5 The R8PP indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 12 22 23 24 25 3 13 23 33 34 35 4 14 24 34 44 45 5 15 25 35 45 55 TEST53 R8PP_RANDOM, compute a random positive definite symmetric packed matrix. Matrix order N = 5 The matrix (printed by R8PP_PRINT): Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 The random R8PP matrix (printed by R8GE_PRINT): Col: 1 2 3 4 5 Row --- 1 0.00381025 0.0277488 0.0247715 0.0465839 0.0492143 2 0.0277488 0.268432 0.208725 0.350545 0.521707 3 0.0247715 0.208725 0.488639 0.540951 0.426804 4 0.0465839 0.350545 0.540951 1.65848 1.45021 5 0.0492143 0.521707 0.426804 1.45021 1.77774 TEST534 For a R8S3 matrix, R8S3_WRITE writes the matrix to a file. Matrix order N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of R8S3 matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 0 0 2 201 202 203 0 0 3 0 302 303 304 0 4 0 0 403 404 405 5 0 0 0 504 505 6 0 0 0 0 605 Col: 6 7 8 9 10 Row --- 5 506 0 0 0 0 6 606 607 0 0 0 7 706 707 708 0 0 8 0 807 808 809 0 9 0 0 908 909 910 10 0 0 0 1009 1010 R8S3_WRITE wrote the matrix data to "r8s3_matrix.txt". TEST535 For a R8S3 matrix, R8S3_READ reads a matrix from a file. R8S3_READ_SIZE reads the sizes of the matrix from a file. R8S3_READ_SIZE reports matrix size data: Matrix order N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of R8S3 matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 0 0 2 201 202 203 0 0 3 0 302 303 304 0 4 0 0 403 404 405 5 0 0 0 504 505 6 0 0 0 0 605 Col: 6 7 8 9 10 Row --- 5 506 0 0 0 0 6 606 607 0 0 0 7 706 707 708 0 0 8 0 807 808 809 0 9 0 0 908 909 910 10 0 0 0 1009 1010 Deleting the matrix data file "r8s3_matrix.txt" FILE_DELETE: Deleting old version of "r8s3_matrix.txt". TEST54 R8SD_CG applies the conjugate gradient method to a symmetric positive definite linear system stored by diagonals. Matrix order N = 100 Matrix diagonals NDIAG = 3 First 10 rows and columns of matrix. Col: 1 2 3 4 5 Row --- 1 4 -1 0 0 0 2 -1 4 -1 0 0 3 0 -1 4 -1 0 4 0 0 -1 4 -1 5 0 0 0 -1 4 6 0 0 0 0 -1 7 0 0 0 0 0 8 0 0 0 0 0 9 0 0 0 0 0 10 0 0 0 0 0 Col: 6 7 8 9 10 Row --- 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 0 0 5 -1 0 0 0 0 6 4 -1 0 0 0 7 -1 4 -1 0 0 8 0 -1 4 -1 0 9 0 0 -1 4 -1 10 0 0 0 -1 4 Right hand side: 1: 11 2: 20 3: 30 4: 40 5: 50 6: 60 7: 70 8: 80 9: 90 10: 211 Solution: 1: 11 2: 21 3: 31 4: 41 5: 51 6: 61 7: 71 8: 81 9: 91 10: 101 Maximum residual = 2.84217e-13 Second attempt at solution: 1: 11 2: 21 3: 31 4: 41 5: 51 6: 61 7: 71 8: 81 9: 91 10: 101 Maximum residual of second attempt = 5.68434e-14 TEST55 R8SD_CG is used for linear equation solving in a demonstration of inverse iteration to compute eigenvalues and eigenvectors of a symmetric matrix stored by diagonals. Matrix order N = 100 Matrix diagonals NDIAG = 3 Here are 25 of the smallest eigenvalues: I, J, eigenvalue(I,J): 1 1 0.162028 1 2 0.398507 1 3 0.771293 1 4 1.25018 1 5 1.79638 2 1 0.398507 2 2 0.634986 2 3 1.00777 2 4 1.48666 2 5 2.03286 3 1 0.771293 3 2 1.00777 3 3 1.38056 3 4 1.85945 3 5 2.40565 4 1 1.25018 4 2 1.48666 4 3 1.85945 4 4 2.33834 4 5 2.88454 5 1 1.79638 5 2 2.03286 5 3 2.40565 5 4 2.88454 5 5 3.43074 Lambda estimate = 0.162028 Converged on step 7 Lambda estimate = 0.771293 Converged on step 11 Lambda estimate = 0.398507 Converged on step 31 TEST555 R8SD_INDICATOR sets up an R8SD indicator matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 The R8SD indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 104 0 2 102 202 203 0 205 3 0 203 303 304 0 4 104 0 304 404 405 5 0 205 0 405 505 6 0 0 306 0 506 7 0 0 0 407 0 8 0 0 0 0 508 9 0 0 0 0 0 10 0 0 0 0 0 Col: 6 7 8 9 10 Row --- 1 0 0 0 0 0 2 0 0 0 0 0 3 306 0 0 0 0 4 0 407 0 0 0 5 506 0 508 0 0 6 606 607 0 609 0 7 607 707 708 0 710 8 0 708 808 809 0 9 609 0 809 909 910 10 0 710 0 910 1010 TEST56 R8SM_ML computes A*x or A'*X where A is a Sherman Morrison matrix. Matrix rows M = 7 Matrix columns N = 7 The Sherman Morrison matrix: Col: 1 2 3 4 5 Row --- 1 -0.523259 -0.519701 0.169118 0.505236 0.0487381 2 0.900681 -0.00340474 -0.0452836 0.0979281 0.20906 3 0.190252 0.0912587 0.356081 -0.281754 0.0248217 4 0.482296 -0.00568034 0.283504 0.224374 0.478787 5 -0.2844 -0.144488 -0.498077 0.595864 0.130874 6 -0.604187 -0.16776 -0.554103 -0.189652 -0.245859 7 -0.0200361 0.518989 0.62397 0.226007 0.622209 Col: 6 7 Row --- 1 0.134385 0.602509 2 0.154183 0.360426 3 0.361971 0.200264 4 0.347365 0.712898 5 -0.251987 0.103843 6 0.15544 0.286048 7 0.193524 0.819502 A*x and PLU*x 1 6.2332 6.2332 2 5.64311 5.64311 3 4.01178 4.01178 4 11.6874 11.6874 5 0.185197 0.185197 6 -1.65495 -1.65495 7 13.8026 13.8026 The Sherman Morrison matrix: Col: 1 2 3 4 5 Row --- 1 0.372211 0.04465 0.806618 0.931129 0.533214 2 -0.234486 -0.116704 0.580868 0.879274 0.123585 3 0.256648 0.260123 0.212966 0.507635 0.0397534 4 -0.460832 -0.492993 0.751566 -0.0487418 0.0681334 5 0.554236 -0.0477249 0.716446 0.448273 0.646527 6 -0.803782 -0.483181 0.429272 0.202573 -0.129083 7 -0.627499 0.0738779 0.840658 0.833144 -0.217538 Col: 6 7 Row --- 1 0.577074 0.266591 2 0.242808 0.325956 3 0.473955 0.296694 4 0.397568 -0.274456 5 -0.0348438 0.651523 6 0.222917 0.143123 7 0.392929 0.434966 A'*x and (PLU)'*x 1 -7.61416 -7.61416 2 -4.00093 -4.00093 3 17.656 17.656 4 13.3064 13.3064 5 2.10755 2.10755 6 7.98862 7.98862 7 7.87188 7.87188 TEST57 R8SM_SL implements the Sherman-Morrison method for solving a perturbed linear system. Matrix rows M = 5 Matrix columns N = 5 The Sherman-Morrison matrix A: Col: 1 2 3 4 5 Row --- 1 -0.413081 -0.446389 -0.724118 -0.412241 0.0269327 2 0.877654 0.193737 0.35165 0.845924 0.737188 3 0.586159 -0.0875398 0.0984781 0.191185 -0.197573 4 -0.0077973 -0.418356 0.0459899 -0.278876 -0.742942 5 0.230434 0.483928 0.567228 -0.107606 0.0166845 The right hand side vector B: 1 4.22168 2 0.424679 3 3.29472 4 0.199627 5 -1.97976 Solution to A' * X = B: 1 1 2 2 3 3 4 4 5 5 The Sherman-Morrison matrix A: Col: 1 2 3 4 5 Row --- 1 0.251659 0.319285 -0.0915133 0.0346037 0.292301 2 -0.0183719 0.214294 -0.364887 0.694459 0.889569 3 0.754919 0.612363 0.284029 0.0877659 0.763226 4 0.212156 0.225367 0.394769 0.763444 0.75299 5 0.169856 0.201542 0.788678 0.744086 0.406239 The right hand side vector B: 1 2.21561 2 6.54124 3 6.99893 4 8.66593 5 7.94651 Solution to A * X = B: 1 1 2 2 3 3 4 4 5 5 TEST5705 R8SP_IJ_TO_K returns the R8SP index of (I,J). Matrix rows M = 7 Matrix columns N = 5 Matrix nonzeros = 10 I J K 1 1 -1 1 2 1 1 3 -1 1 4 -1 1 5 2 2 1 3 2 2 -1 2 3 -1 2 4 -1 2 5 4 3 1 -1 3 2 -1 3 3 -1 3 4 -1 3 5 -1 4 1 5 4 2 6 4 3 7 4 4 -1 4 5 -1 5 1 -1 5 2 -1 5 3 -1 5 4 8 5 5 -1 6 1 -1 6 2 -1 6 3 -1 6 4 9 6 5 -1 7 1 10 7 2 -1 7 3 -1 7 4 -1 7 5 -1 TEST571 R8SP_INDICATOR sets up an R8SP indicator matrix; Matrix rows M = 7 Matrix columns N = 5 Matrix nonzeros NZ_NUM = 10 The R8SP indicator matrix: Col: 1 2 3 4 5 Row --- 1 0 12 0 0 15 2 21 0 0 0 25 4 41 42 43 0 0 5 0 0 0 54 0 6 0 0 0 64 0 7 71 0 0 0 0 TEST572 R8SP_MXV multiplies an R8SP matrix by a vector; R8SP_VXM multiplies a vector by an R8SP matrix; Matrix rows M = 7 Matrix columns N = 5 Matrix nonzeros NZ_NUM = 10 The R8SP matrix, in R8GE form: Col: 1 2 3 4 5 Row --- 1 0 0.218418 0 0 0.956318 2 0.829509 0 0 0 0.561695 3 0 0 0 0 0 4 0.415307 0.0661187 0.257578 0 0 5 0 0 0 0.109957 0 6 0 0 0 0.043829 0 7 0.633966 0 0 0 0 The vector x: 1 1 2 0 3 0 4 0 5 -1 The product A * x: 1 -0.956318 2 0.267814 3 0 4 0.415307 5 0 6 0 7 0.633966 The vector x: 1 1 2 0 3 0 4 0 5 0 6 0 7 -1 The product A' * x: 1 -0.633966 2 0.218418 3 0 4 0 5 0.956318 TEST5722 R8SP_PRINT prints a R8SP matrix; In this example, we have listed several matrix locations TWICE. R8SP_PRINT should compute the sum of these values. In particular, we want A(1,2) = 112 and A(3,4) = 234; Matrix rows M = 5 Matrix columns N = 7 Matrix nonzeros NZ_NUM = 12 The R8SP matrix: Col: 1 2 3 4 5 Row --- 1 0 112 0 14 0 2 21 0 0 24 0 3 0 0 0 234 0 4 0 0 0 0 45 5 51 52 0 0 0 Col: 6 7 Row --- 1 0 17 4 46 0 TEST5724 For a R8SP matrix, R8SP_WRITE writes the matrix to a file. Matrix number of rows M = 100 Matrix number of columns N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of R8SP matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 0 0 2 201 202 203 0 0 3 0 302 303 304 0 4 0 0 403 404 405 5 0 0 0 504 505 6 0 0 0 0 605 Col: 6 7 8 9 10 Row --- 5 506 0 0 0 0 6 606 607 0 0 0 7 706 707 708 0 0 8 0 807 808 809 0 9 0 0 908 909 910 10 0 0 0 1009 1010 R8SP_WRITE wrote the matrix data to "r8sp_matrix.txt". TEST5725 For a R8SP matrix, R8SP_READ reads a matrix from a file. R8SP_READ_SIZE reads the sizes of the matrix from a file. R8SP_READ_SIZE reports matrix size data: Matrix number of rows M = 100 Matrix number of columns N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of R8SP matrix: Col: 1 2 3 4 5 Row --- 1 101 102 0 0 0 2 201 202 203 0 0 3 0 302 303 304 0 4 0 0 403 404 405 5 0 0 0 504 505 6 0 0 0 0 605 Col: 6 7 8 9 10 Row --- 5 506 0 0 0 0 6 606 607 0 0 0 7 706 707 708 0 0 8 0 807 808 809 0 9 0 0 908 909 910 10 0 0 0 1009 1010 Deleting the matrix data file "r8sp_matrix.txt" FILE_DELETE: Deleting old version of "r8sp_matrix.txt". TEST573 R8SR_INDICATOR sets up an R8SR indicator matrix; Matrix order N = 5 The R8SR indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 15 2 0 22 0 0 25 3 31 0 33 0 0 4 41 0 0 44 0 5 0 52 53 0 55 TEST574 R8SR_MXV multiplies an R8SR matrix by a vector; R8SR_VXM multiplies a vector by an R8SR matrix; Matrix order N = 5 The R8SR matrix, in R8GE form: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0 0.829509 2 0 0.561695 0 0 0.415307 3 0.257578 0 0.0661187 0 0 4 0.043829 0 0 0.109957 0 5 0 0.0617272 0.449539 0 0.633966 The vector x: 1 1 2 0 3 0 4 0 5 -1 The product A * x: 1 -0.611091 2 -0.415307 3 0.257578 4 0.043829 5 -0.633966 The product A' * x: 1 0.218418 2 0.89459 3 -0.449539 4 0 5 0.195544 TEST5745 R8SR_PRINT prints an R8SR matrix. Matrix order N = 5 The R8SR matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0 0.829509 2 0 0.561695 0 0 0.415307 3 0.257578 0 0.0661187 0 0 4 0.043829 0 0 0.109957 0 5 0 0.0617272 0.449539 0 0.633966 TEST575 R8SR_RANDOM randomizes an R8SR matrix Matrix order N = 5 The R8SR matrix, in R8GE form: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0 0.829509 2 0 0.561695 0 0 0.415307 3 0.257578 0 0.0661187 0 0 4 0.043829 0 0 0.109957 0 5 0 0.0617272 0.449539 0 0.633966 TEST577 For a symmetric skyline storage matrix, R8SS_INDICATOR sets up an indicator matrix. Matrix order N = 9 The R8SS indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 12 22 23 24 25 3 13 23 33 34 35 4 14 24 34 44 45 5 15 25 35 45 55 6 16 26 36 46 56 7 17 27 37 47 57 8 18 28 38 48 58 9 19 29 39 49 59 Col: 6 7 8 9 Row --- 1 16 17 18 19 2 26 27 28 29 3 36 37 38 39 4 46 47 48 49 5 56 57 58 59 6 66 67 68 69 7 67 77 78 79 8 68 78 88 89 9 69 79 89 99 TEST58 For a symmetric skyline storage matrix, R8SS_MXV computes A*x, R8SS_PRINT prints it. Matrix order N = 9 Number of nonzero entries stored is 17 Diagonal storage indices: 1 1 2 2 3 4 4 7 5 10 6 13 7 14 8 16 9 17 The R8SS matrix: Col: 1 2 3 4 5 Row --- 1 11 0 0 0 0 2 0 22 23 24 0 3 0 23 33 34 35 4 0 24 34 44 45 5 0 0 35 45 55 6 0 0 0 46 56 7 0 0 0 0 0 8 0 0 0 0 0 9 0 0 0 0 0 Col: 6 7 8 9 Row --- 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 46 0 0 0 5 56 0 0 0 6 66 0 0 0 7 0 77 78 0 8 0 78 88 0 9 0 0 0 99 R8SS_MXV verse R8GE_MXV 1 11 11 2 209 209 3 456 456 4 827 827 5 896 896 6 860 860 7 1163 1163 8 1250 1250 9 891 891 TEST581 R8STO_INDICATOR sets up an R8STO indicator matrix. Matrix order N = 4 The R8STO indicator matrix: Col: 1 2 3 4 Row --- 1 11 12 13 14 2 12 11 12 13 3 13 12 11 12 4 14 13 12 11 TEST583 R8STO_INVERSE computes the inverse of a positive definite symmetric Toeplitz matrix. Matrix order N = 3 The symmetric Toeplitz matrix A: Col: 1 2 3 Row --- 1 4 2 0.8 2 2 4 2 3 0.8 2 4 The inverse matrix B: Col: 1 2 3 Row --- 1 0.334821 -0.178571 0.0223214 2 -0.178571 0.428571 -0.178571 3 0.0223214 -0.178571 0.334821 The product C = A * B: Col: 1 2 3 Row --- 1 1 2.77556e-17 0 2 4.16334e-17 1 0 3 2.77556e-17 0 1 TEST585 R8STO_YW_SL solves the Yule-Walker equations for a symmetric Toeplitz system. Matrix order N = 3 The symmetric Toeplitz matrix: Col: 1 2 3 Row --- 1 1 0.5 0.2 2 0.5 1 0.5 3 0.2 0.5 1 The right hand side, B: 1 -0.5 2 -0.2 3 -0.1 The computed solution, X: 1 -0.535714 2 0.0857143 3 -0.0357143 The product A*x: 1 -0.5 2 -0.2 3 -0.1 TEST587 R8STO_SL solves a positive definite symmetric Toeplitz system. Matrix order N = 3 The symmetric Toeplitz matrix A: Col: 1 2 3 Row --- 1 1 0.5 0.2 2 0.5 1 0.5 3 0.2 0.5 1 The right hand side vector b: 1 4 2 -1 3 3 The computed solution x: 1 6.33929 2 -6.71429 3 5.08929 The product vector A * x: 1 4 2 -1 3 3 TEST589 R8TO_INDICATOR sets up an R8TO indicator matrix. Matrix order N = 10 The R8TO indicator matrix: Col: 1 2 3 4 5 Row --- 1 101 102 103 104 105 2 201 101 102 103 104 3 301 201 101 102 103 4 401 301 201 101 102 5 501 401 301 201 101 6 601 501 401 301 201 7 701 601 501 401 301 8 801 701 601 501 401 9 901 801 701 601 501 10 1001 901 801 701 601 Col: 6 7 8 9 10 Row --- 1 106 107 108 109 110 2 105 106 107 108 109 3 104 105 106 107 108 4 103 104 105 106 107 5 102 103 104 105 106 6 101 102 103 104 105 7 201 101 102 103 104 8 301 201 101 102 103 9 401 301 201 101 102 10 501 401 301 201 101 TEST59 R8TO_SL solves a Toeplitz system. Matrix order N = 10 The Toeplitz matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0.829509 0.561695 0.415307 2 0.0617272 0.218418 0.956318 0.829509 0.561695 3 0.449539 0.0617272 0.218418 0.956318 0.829509 4 0.401306 0.449539 0.0617272 0.218418 0.956318 5 0.754673 0.401306 0.449539 0.0617272 0.218418 6 0.797287 0.754673 0.401306 0.449539 0.0617272 7 0.00183837 0.797287 0.754673 0.401306 0.449539 8 0.897504 0.00183837 0.797287 0.754673 0.401306 9 0.350752 0.897504 0.00183837 0.797287 0.754673 10 0.0945448 0.350752 0.897504 0.00183837 0.797287 Col: 6 7 8 9 10 Row --- 1 0.0661187 0.257578 0.109957 0.043829 0.633966 2 0.415307 0.0661187 0.257578 0.109957 0.043829 3 0.561695 0.415307 0.0661187 0.257578 0.109957 4 0.829509 0.561695 0.415307 0.0661187 0.257578 5 0.956318 0.829509 0.561695 0.415307 0.0661187 6 0.218418 0.956318 0.829509 0.561695 0.415307 7 0.0617272 0.218418 0.956318 0.829509 0.561695 8 0.449539 0.0617272 0.218418 0.956318 0.829509 9 0.401306 0.449539 0.0617272 0.218418 0.956318 10 0.754673 0.401306 0.449539 0.0617272 0.218418 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Solution to transposed system: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 TEST60 For an upper triangular matrix, R8UT_INVERSE computes the inverse. R8UT_DET computes the determinant. R8UT_MXM computes matrix products. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0.829509 0.561695 0.415307 2 0.0661187 0.257578 0.109957 0.043829 3 0.633966 0.0617272 0.449539 4 0.401306 0.754673 5 0.797287 Determinant is 0.00292934 The inverse matrix B: Col: 1 2 3 4 5 Row --- 1 4.57837 -66.2199 20.9143 8.51892 -18.6004 2 15.1243 -6.14495 -3.19883 5.66117 3 1.57737 -0.242625 -0.659722 4 2.49186 -2.35868 5 1.25425 The product A * B: Col: 1 2 3 4 5 Row --- 1 1 -1.77636e-15 2.22045e-16 2.22045e-16 8.88178e-16 2 1 0 0 4.85723e-17 3 1 0 0 4 1 1.11022e-16 5 1 TEST605 For an upper triangular matrix, R8UT_INDICATOR sets up an indicator matrix. Matrix rows M = 8 Matrix columns N = 5 The R8UT indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 13 14 15 2 22 23 24 25 3 33 34 35 4 44 45 5 55 6 7 8 TEST61 For an upper triangular matrix, R8UT_SL solves systems; R8UT_MXV computes matrix-vector products. R8UT_VXM computes vector-matrix products. Matrix order N = 10 The upper triangular matrix: Col: 1 2 3 4 5 Row --- 1 1 2 3 4 5 2 2 3 4 5 3 3 4 5 4 4 5 5 5 6 7 8 9 10 Col: 6 7 8 9 10 Row --- 6 6 7 8 9 10 7 7 8 9 10 8 8 9 10 9 9 10 10 10 Solution: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Solution to transposed system: 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 TEST62 R8VM_DET, determinant of a Vandermonde matrix. Matrix order N = 10 The Vandermonde matrix: Col: 1 2 3 4 5 Row --- 1 1 1 1 1 0.218418 0.956318 0.829509 0.561695 0.415307 0.0477066 0.914543 0.688086 0.315502 0.17248 0.01042 0.874594 0.570773 0.177216 0.0716322 0.00227592 0.836389 0.473462 0.0995414 0.0297493 0.000497102 0.799854 0.392741 0.0559119 0.0123551 0.000108576 0.764914 0.325782 0.0314055 0.00513117 2.3715e-05 0.731501 0.270239 0.0176403 0.00213101 5.17979e-06 0.699547 0.224166 0.00990848 0.000885023 1.13136e-06 0.668989 0.185948 0.00556555 0.000367556 Col: 6 7 8 9 10 Row --- 1 1 1 1 1 0.0661187 0.257578 0.109957 0.043829 0.633966 0.00437169 0.0663463 0.0120905 0.00192098 0.401913 0.00028905 0.0170893 0.00132943 8.41947e-05 0.254799 1.91116e-05 0.00440183 0.00014618 3.69017e-06 0.161534 1.26364e-06 0.00113381 1.60735e-05 1.61736e-07 0.102407 8.35501e-08 0.000292045 1.76739e-06 7.08874e-09 0.0649224 5.52423e-09 7.52244e-05 1.94337e-07 3.10693e-10 0.0411586 3.65255e-10 1.93761e-05 2.13686e-08 1.36173e-11 0.0260931 2.41502e-11 4.99086e-06 2.34963e-09 5.96834e-13 0.0165421 R8VM_DET computes the determinant = -4.22063e-25 R8GE_DET computes the determinant = -4.22063e-25 TEST63 R8VM_SL solves a Vandermonde system. Matrix order N = 5 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 Solution to transposed system: 1: 1 2: 2 3: 3 4: 4 5: 5 LINPLUS_PRB Normal end of execution. 25 February 2013 09:30:00 AM