r8sp_test 22-Sep-2015 13:10:16 R8SP_TEST MATLAB version: Test the R8SP library. R8SP_CG_TEST R8SP_CG applies CG to an R8SP matrix. Number of variables N = 10 Norm of residual ||Ax-b|| = 9.0291e-16 Norm of error ||x1-x2|| = 7.63436e-16 R8SP_DIAGONAL_TEST R8SP_DIAGONAL rearranges an R8SP matrix so that the diagonal is listed first. Matrix order M = 6 Matrix order N = 6 Matrix nonzeros NZ_NUM = 20 Before rearrangement: K ROW(K) COL(K) A(K) 1 1 5 15 2 3 6 36 3 4 2 42 4 6 2 62 5 5 3 53 6 2 4 24 7 6 4 64 8 3 5 35 9 1 1 11 10 2 6 26 11 4 4 44 12 6 6 66 13 5 5 55 14 4 1 41 15 4 6 46 16 3 3 33 17 6 1 61 18 2 2 22 19 3 1 31 20 4 3 43 After rearrangement: K ROW(K) COL(K) A(K) 1 1 1 11 2 2 2 22 3 3 3 33 4 4 4 44 5 5 5 55 6 6 6 66 7 6 4 64 8 3 5 35 9 1 5 15 10 2 6 26 11 6 2 62 12 2 4 24 13 5 3 53 14 4 1 41 15 4 6 46 16 4 2 42 17 6 1 61 18 3 6 36 19 3 1 31 20 4 3 43 R8SP_DIF2_TEST R8SP_DIF2 sets an R8SP matrix to the second difference. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: 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 R8SP_IJ_TO_K_TEST 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 R8SP_INDICATOR_TEST R8SP_INDICATOR sets an R8SP matrix to the indicator matrix. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: Col: 1 2 3 4 5 Row --- 1 11 12 0 0 0 2 0 22 0 24 0 3 0 32 33 0 35 4 41 0 0 44 45 5 51 0 53 0 55 R8SP_JAC_SL_TEST R8SP_JAC_SL uses Jacobi iteration to solve a linear system with an R8SP matrix. Matrix order M = 10 Matrix order N = 10 Matrix nonzeros NZ_NUM = 28 Iterations per = 25 Current solution estimate: 1: 0 2: -0 3: -0 4: 7.8646e+09 5: 4.76191e+10 6: -5.64244e+10 7: 8.99373e+09 8: 1.25094e+11 9: -1.21805e+11 10: -1.56246e+10 Current solution estimate: 1: 0 2: -0 3: -0 4: 5.49568e+21 5: 3.24111e+22 6: -3.62127e+22 7: 1.82047e+21 8: 5.02394e+22 9: -4.80269e+22 10: -6.12885e+21 Current solution estimate: 1: 0 2: -0 3: -0 4: 2.81772e+33 5: 1.65374e+34 6: -1.82681e+34 7: 5.18685e+32 8: 2.23053e+34 9: -2.11788e+34 10: -2.69745e+33 R8SP_MTV_TEST R8SP_MTV computes b=A'*x, where A is an R8SP matrix. Matrix order M = 5 Matrix order N = 4 Matrix nonzeros NZ_NUM = 11 x: 1: 1 2: 2 3: 3 4: 4 5: 5 b=A'*x: 1: 0 2: 0 3: 0 4: 0 R8SP_MV_TEST R8SP_MV computes b=A*x, where A is an R8SP matrix. Matrix order M = 5 Matrix order N = 4 Matrix nonzeros NZ_NUM = 11 x: 1: 1 2: 2 3: 3 4: 4 b=A*x: 1: 0 2: 0 3: 0 4: 5 5: -4 R8SP_PRINT_TEST R8SP_PRINT prints an R8SP matrix. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: 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 R8SP_PRINT_SOME_TEST R8SP_PRINT_SOME prints some of an R8SP matrix. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 Rows 2:4, Cols 3:5: Col: 3 4 5 Row --- 2 -1 0 0 3 2 -1 0 4 -1 2 -1 R8SP_RANDOM_TEST R8SP_RANDOM randomizes an R8SP matrix. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: Col: 1 2 3 4 5 Row --- 1 0.218418 0.0661187 0 0 0 2 0 0.956318 0 0.257578 0 3 0 0.109957 0.829509 0 0.043829 4 0.633966 0 0 0.561695 0.0617272 5 0.449539 0 0.401306 0 0.415307 R8SP_READ_TEST R8SP_READ_SIZE reads the size of an R8SP matrix. R8SP_READ reads the R8SP matrix from a file. Matrix order M = 100 Matrix order N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of recovered R8SP 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 6 0 0 0 0 -1 Col: 6 7 8 9 10 Row --- 5 -1 0 0 0 0 6 2 -1 0 0 0 7 -1 2 -1 0 0 8 0 -1 2 -1 0 9 0 0 -1 2 -1 10 0 0 0 -1 2 R8SP_RES_TEST R8SP_RES computes r=b-A*x, where A is an R8SP matrix. Matrix order M = 5 Matrix order N = 4 Matrix nonzeros NZ_NUM = 11 x: 1: 1 2: 2 3: 3 4: 4 r=b-A*x: 1: 0 2: 0 3: 0 4: 0 5: 0 R8SP_TO_R8GE_TEST R8SP_TO_R8GE converts an R8SP matrix to R8GE format. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: 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 R8GE matrix A: 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 R8SP_TO_R8NCF_TEST R8SP_TO_R8NCF converts an R8SP matrix to R8NCF format. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: 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 R8NCF matrix A: 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 R8SP_WRITE_TEST R8SP_WRITE writes an R8SP matrix to a file. Matrix order M = 100 Matrix order N = 100 Matrix nonzeros NZ_NUM = 298 Initial 10x10 block of R8SP 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 6 0 0 0 0 -1 Col: 6 7 8 9 10 Row --- 5 -1 0 0 0 0 6 2 -1 0 0 0 7 -1 2 -1 0 0 8 0 -1 2 -1 0 9 0 0 -1 2 -1 10 0 0 0 -1 2 Matrix data written to "r8sp_matrix.txt" . R8SP_ZEROS_TEST R8SP_ZEROS sets an R8SP matrix to the zero matrix. Matrix order M = 5 Matrix order N = 5 Matrix nonzeros NZ_NUM = 13 R8SP matrix A: Col: 1 2 3 4 5 Row --- R8SP_TEST Normal end of execution. 22-Sep-2015 13:10:16 diary off