26 August 2022 06:16:15 PM r8sd_test(): C++ version test r8sd(). r8sd_CG_test 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: 0: 11 1: 20 2: 30 3: 40 4: 50 5: 60 6: 70 7: 80 ........ .............. 99: 231 Solution: 0: 11 1: 21 2: 31 3: 41 4: 51 5: 61 6: 71 7: 81 ........ .............. 99: 110 Maximum residual = 2.84217e-13 Second attempt at solution: 0: 11 1: 21 2: 31 3: 41 4: 51 5: 61 6: 71 7: 81 ........ .............. 99: 110 Maximum residual of second attempt = 5.68434e-14 r8sd_DIF2_test r8sd_DIF2 sets up an r8sd second difference matrix. Matrix order N = 5 Matrix diagonals NDIAG = 2 The r8sd second difference 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 an r8sd indicator matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The r8sd indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 12 22 23 0 25 3 0 23 33 34 0 4 14 0 34 44 45 5 0 25 0 45 55 r8sd_MV_test r8sd_MV computes b=A*x, where A is an r8sd matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The r8sd indicator matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 12 22 23 0 25 3 0 23 33 34 0 4 14 0 34 44 45 5 0 25 0 45 55 The vector x: 1 1 2 2 3 3 4 4 5 5 The product b=A*x: 1 91 2 250 3 281 4 517 5 505 r8sd_PRINT_test r8sd_PRINT prints an r8sd matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The r8sd matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 12 22 23 0 25 3 0 23 33 34 0 4 14 0 34 44 45 5 0 25 0 45 55 r8sd_PRINT_SOME_test r8sd_PRINT_SOME prints some of an r8sd matrix. Matrix order N = 10 Matrix diagonals NDIAG = 3 Rows 1-7, Cols 2-6: Col: 2 3 4 5 6 Row --- 1 102 0 104 0 0 2 202 203 0 205 0 3 203 303 304 0 306 4 0 304 404 405 0 5 205 0 405 505 506 6 0 306 0 506 606 7 0 0 407 0 607 r8sd_RANDOM_test r8sd_RANDOM randomizes an r8sd matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The random 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.043829 0.633966 5 0 0.0661187 0 0.633966 0.0617272 r8sd_RES_test r8sd_RES computes a residual R=b-A*x Matrix order N = 10 Matrix diagonals NDIAG = 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 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 = 5 Matrix diagonals NDIAG = 3 The r8sd matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 12 22 23 0 25 3 0 23 33 34 0 4 14 0 34 44 45 5 0 25 0 45 55 The R8GE matrix: Col: 1 2 3 4 5 Row --- 1 11 12 0 14 0 2 12 22 23 0 25 3 0 23 33 34 0 4 14 0 34 44 45 5 0 25 0 45 55 r8sd_ZEROS_test r8sd_ZEROS zeros an r8sd matrix. Matrix order N = 5 Matrix diagonals NDIAG = 3 The r8sd zero 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. 26 August 2022 06:16:15 PM