r8sd_test 17-Jul-2016 17:54:23 R8SD_TEST MATLAB version Test the R8SD library. R8SD_CG_TEST R8SD_CG applies the conjugate gradient method to a symmetric positive definite linear system stored by diagonals. Matrix order N = 100 Number of diagonals is 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 ...... .............. 100 231 Solution: 1 11 2 21 3 31 4 41 5 51 6 61 7 71 8 81 ...... .............. 100 110 Maximum residual = 2.41585e-13 Second attempt at solution: 1 11 2 21 3 31 4 41 5 51 6 61 7 71 8 81 ...... .............. 100 110 Maximum residual of second attempt = 5.68434e-14 R8SD_DIF2_TEST R8SD_DIF2 sets up a R8SD second difference matrix. Matrix order N = 5 Matrix diagonals NDIAG = 2 The R8SD matrix: Col: 1 2 3 4 5 Row --- 1 2 -1 0 0 0 2 -1 2 -1 0 0 3 0 -1 2 -1 0 4 0 0 -1 2 -1 5 0 0 0 -1 2 R8SD_INDICATOR_TEST R8SD_INDICATOR sets up a 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 R8SD_MV_TEST R8SD_MV computes b=A*x, where A is an R8SD matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 The R8SD 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 The vector x: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 The product b=A*x 1: 721 2: 2140 3: 4367 4: 7506 5: 11655 6: 16814 7: 22983 8: 21241 9: 27407 10: 23260 R8SD_PRINT_TEST R8SD_PRINT prints an R8SD matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 The R8SD 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 R8SD_PRINT_SOME_TEST R8SD_PRINT_SOME prints some of an R8SD matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 Rows 2-8, Cols 3-7: Col: 3 4 5 6 7 Row --- 2 203 0 205 0 0 3 303 304 0 306 0 4 304 404 405 0 407 5 0 405 505 506 0 6 306 0 506 606 607 7 0 407 0 607 707 8 0 0 508 0 708 R8SD_RANDOM_TEST R8SD_RANDOM randomizes an R8SD matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 The R8SD matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0.829509 0 2 0.956318 0.561695 0.415307 0 0.0661187 3 0 0.415307 0.257578 0.109957 0 4 0.829509 0 0.109957 0.633966 0.0617272 5 0 0.0661187 0 0.0617272 0.401306 6 0 0 0.043829 0 0.754673 7 0 0 0 0.449539 0 8 0 0 0 0 0.797287 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.043829 0 0 0 0 4 0 0.449539 0 0 0 5 0.754673 0 0.797287 0 0 6 0.00183837 0.897504 0 0.350752 0 7 0.897504 0.0945448 0.0136169 0 0.859097 8 0 0.0136169 0.840847 0.123104 0 9 0.350752 0 0.123104 0.00751236 0.260303 10 0 0.859097 0 0.260303 0.912484 R8SD_RES_TEST R8SD_RES computes a residual r=b-A*x Matrix order N = 10 Number of diagonals is 2 The R8SD matrix: Col: 1 2 3 4 5 Row --- 1 0.218418 0.956318 0 0 0 2 0.956318 0.829509 0.561695 0 0 3 0 0.561695 0.415307 0.0661187 0 4 0 0 0.0661187 0.257578 0.109957 5 0 0 0 0.109957 0.043829 6 0 0 0 0 0.633966 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 0.633966 0 0 0 0 6 0.0617272 0.449539 0 0 0 7 0.449539 0.401306 0.754673 0 0 8 0 0.754673 0.797287 0.00183837 0 9 0 0 0.00183837 0.897504 0.350752 10 0 0 0 0.350752 0.0945448 The vector x: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 The product b=A*x 1: 2.13105 2: 4.30042 3: 2.63379 4: 1.77845 5: 4.46277 6: 6.68696 7: 11.5438 8: 11.6776 9: 11.5998 10: 4.10222 The defective vector x2: 1: 1.00136 2: 2.08591 3: 3.08408 4: 4.01231 5: 5.00075 6: 6.02603 7: 7.09125 8: 8.01137 9: 9.03516 10: 10.0823 Residual r=b-A*x2: 1: -0.0824544 2: -0.119795 3: -0.08399 4: -0.00881306 5: -0.0178889 6: -0.0431027 7: -0.0568981 8: -0.0779897 9: -0.0604427 10: -0.0201134 R8SD_TO_R8GE_TEST R8SD_TO_R8GE converts an R8SD matrix to R8GE format. Matrix order N = 10 Matrix diagonals NDIAG = 3 The R8SD 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 The R8GE 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 R8SD_ZEROS_TEST R8SD_ZEROS zeros an R8SD matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The R8SD matrix: Col: 1 2 3 4 5 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 0 0 0 0 0 R8SD_TEST Normal end of execution. 17-Jul-2016 17:54:23 diary off