09 February 2020 11:57:22 AM BLAS1_D_TEST: C++ version Test the BLAS1_D library. DASUM_TEST DASUM adds the absolute values of elements of a vector. X = 1 -2 2 4 3 -6 4 8 5 -10 6 12 7 -14 8 16 9 -18 10 20 DASUM ( NX, X, 1 ) = 110 DASUM ( NX/2, X, 2 ) = 50 DASUM ( 2, X, NX/2 ) = 14 Demonstrate with a matrix A: 11 -12 13 -14 -21 22 -23 24 31 -32 33 -34 -41 42 -43 44 51 -52 53 -54 DASUM(MA,A(1,2),1) = 160 DASUM(NA,A(2,1),LDA) = 90 DAXPY_TEST DAXPY adds a multiple of vector X to vector Y. X = 1 1 2 2 3 3 4 4 5 5 6 6 Y = 1 100 2 200 3 300 4 400 5 500 6 600 DAXPY ( N, 1, X, 1, Y, 1 ) Y = 1 101 2 202 3 303 4 404 5 505 6 606 DAXPY ( N, -2, X, 1, Y, 1 ) Y = 1 98 2 196 3 294 4 392 5 490 6 588 DAXPY ( 3, 3, X, 2, Y, 1 ) Y = 1 103 2 209 3 315 4 400 5 500 6 600 DAXPY ( 3, -4, X, 1, Y, 2 ) Y = 1 96 2 200 3 292 4 400 5 488 6 600 DCOPY_TEST DCOPY copies one vector into another. X = 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Y = 1 10 2 20 3 30 4 40 5 50 6 60 7 70 8 80 9 90 10 100 A = 11 12 13 14 15 21 22 23 24 25 31 32 33 34 35 41 42 43 44 45 51 52 53 54 55 DCOPY ( 5, X, 1, Y, 1 ) 1 1 2 2 3 3 4 4 5 5 6 60 7 70 8 80 9 90 10 100 DCOPY ( 3, X, 2, Y, 3 ) 1 1 2 20 3 30 4 3 5 50 6 60 7 5 8 80 9 90 10 100 DCOPY ( 5, X, 1, A, 1 ) A = 1 12 13 14 15 2 22 23 24 25 3 32 33 34 35 4 42 43 44 45 5 52 53 54 55 DCOPY ( 5, X, 2, A, 5 ) A = 1 3 5 7 9 21 22 23 24 25 31 32 33 34 35 41 42 43 44 45 51 52 53 54 55 DDOT_TEST DDOT computes the dot product of vectors. Dot product of X and Y is -55 Product of row 2 of A and X is 85 Product of column 2 of A and X is 85 Matrix product computed with DDOT: 50 30 10 -10 -30 60 35 10 -15 -40 70 40 10 -20 -50 80 45 10 -25 -60 90 50 10 -30 -70 DNRM2_TEST DNRM2 computes the Euclidean norm of a vector. X = 1 1 2 2 3 3 4 4 5 5 The 2-norm of X is 7.4162 The 2-norm of row 2 of A is 11.619 The 2-norm of column 2 of A is 11.619 DROT_TEST DROT carries out a Givens rotation. X and Y 1 1 -11 2 2 -8 3 3 -3 4 4 4 5 5 13 6 6 24 DROT ( N, X, 1, Y, 1, 0.5,0.866025 ) 1 -9.02628 -6.36603 2 -5.9282 -5.73205 3 -1.09808 -4.09808 4 5.4641 -1.4641 5 13.7583 2.16987 6 23.7846 6.80385 DROT ( N, X, 1, Y, 1, 0.0905357,-0.995893 ) 1 11.0454 0 2 8.14822 1.2675 3 3.25929 2.71607 4 -3.62143 4.34572 5 -12.4939 6.15643 6 -23.3582 8.14822 DROTG_TEST DROTG generates a real Givens rotation ( C S ) * ( A ) = ( R ) ( -S C ) ( B ) ( 0 ) A = 0.218418 B = 0.956318 C = 0.222661 S = 0.974896 R = 0.980943 Z = 4.49112 C*A+S*B = 0.980943 -S*A+C*B = 0 A = 0.829509 B = 0.561695 C = 0.828025 S = 0.560691 R = 1.00179 Z = 0.560691 C*A+S*B = 1.00179 -S*A+C*B = 0 A = 0.415307 B = 0.0661187 C = 0.987563 S = 0.157224 R = 0.420537 Z = 0.157224 C*A+S*B = 0.420537 -S*A+C*B = 0 A = 0.257578 B = 0.109957 C = 0.919705 S = 0.392611 R = 0.280066 Z = 0.392611 C*A+S*B = 0.280066 -S*A+C*B = 0 A = 0.043829 B = 0.633966 C = 0.06897 S = 0.997619 R = 0.635479 Z = 14.4991 C*A+S*B = 0.635479 -S*A+C*B = 6.93889e-18 DSCAL_TEST DSCAL multiplies a vector by a scalar. X = 1 1 2 2 3 3 4 4 5 5 6 6 DSCAL ( N, 5, X, 1 ) 1 5 2 10 3 15 4 20 5 25 6 30 DSCAL ( 3, -2, X, 2 ) 1 -2 2 2 3 -6 4 4 5 -10 6 6 DSWAP_TEST DSWAP swaps two vectors. X and Y: 1 1 100 2 2 200 3 3 300 4 4 400 5 5 500 6 6 600 DSWAP ( N, X, 1, Y, 1 ) X and Y: 1 100 1 2 200 2 3 300 3 4 400 4 5 500 5 6 600 6 DSWAP ( 3, X, 2, Y, 1 ) X and Y: 1 100 1 2 2 3 3 200 5 4 4 400 5 300 500 6 6 600 IDAMAX_TEST IDAMAX returns the index of maximum magnitude; The vector X: 1 2 2 -2 3 5 4 1 5 -3 6 4 7 0 8 -4 9 3 10 -1 11 -5 The index of maximum magnitude = 3 BLAS1_D_TEST: Normal end of execution. 09 February 2020 11:57:22 AM