15 June 2018 08:04:44 AM BLAS1_Z_TEST: C version Test the BLAS1_Z library. TEST01 ZABS1 returns the L1 norm of a complex number. Real Imaginary Part Part ZABS1(Z) 2.249298 -0.633337 2.882635 -4.215983 -1.721400 5.937383 2.948136 1.300451 4.248587 1.955698 1.617000 3.572698 -0.697329 -0.780678 1.478006 -1.180331 0.387297 1.567628 0.092996 -3.166071 3.259068 4.464248 0.051568 4.515817 -2.802325 3.818976 6.621301 1.531783 0.131376 1.663159 TEST02 ZABS2 returns the L2 norm of a complex number. Real Imaginary Part Part ZABS2(Z 2.249298 -0.633337 2.336762 -4.215983 -1.721400 4.553870 2.948136 1.300451 3.222216 1.955698 1.617000 2.537606 -0.697329 -0.780678 1.046769 -1.180331 0.387297 1.242248 0.092996 -3.166071 3.167437 4.464248 0.051568 4.464546 -2.802325 3.818976 4.736835 1.531783 0.131376 1.537407 TEST03 ZAXPY adds a multiple of one complex vector to another. X = 0 2.000000 -1.000000 1 -4.000000 -2.000000 2 3.000000 1.000000 3 2.000000 2.000000 4 -1.000000 -1.000000 Y = 0 -1.000000 0.000000 1 0.000000 -3.000000 2 4.000000 0.000000 3 -3.000000 4.000000 4 -2.000000 0.000000 The scalar multiplier is: 0.500000 -1.000000 A * X + Y = 0 -1.000000 -2.500000 1 -4.000000 0.000000 2 6.500000 -2.500000 3 0.000000 3.000000 4 -3.500000 0.500000 TEST04 ZCOPY copies one complex vector into another. X = 0 10.000000 1.000000 1 20.000000 2.000000 2 30.000000 3.000000 3 40.000000 4.000000 4 50.000000 5.000000 5 60.000000 6.000000 6 70.000000 7.000000 7 80.000000 8.000000 8 90.000000 9.000000 9 100.000000 10.000000 Y = 0 20.000000 2.000000 1 40.000000 4.000000 2 60.000000 6.000000 3 80.000000 8.000000 4 100.000000 10.000000 5 120.000000 12.000000 6 140.000000 14.000000 7 160.000000 16.000000 8 180.000000 18.000000 9 200.000000 20.000000 A = 10.000000 1.000000 10.000000 2.000000 10.000000 3.000000 10.000000 4.000000 10.000000 5.000000 20.000000 1.000000 20.000000 2.000000 20.000000 3.000000 20.000000 4.000000 20.000000 5.000000 30.000000 1.000000 30.000000 2.000000 30.000000 3.000000 30.000000 4.000000 30.000000 5.000000 40.000000 1.000000 40.000000 2.000000 40.000000 3.000000 40.000000 4.000000 40.000000 5.000000 50.000000 1.000000 50.000000 2.000000 50.000000 3.000000 50.000000 4.000000 50.000000 5.000000 ZCOPY ( 5, X, 1, Y, 1 ) 0 10.000000 1.000000 1 20.000000 2.000000 2 30.000000 3.000000 3 40.000000 4.000000 4 50.000000 5.000000 5 120.000000 12.000000 6 140.000000 14.000000 7 160.000000 16.000000 8 180.000000 18.000000 9 200.000000 20.000000 ZCOPY ( 3, X, 2, Y, 3 ) 0 10.000000 1.000000 1 40.000000 4.000000 2 60.000000 6.000000 3 30.000000 3.000000 4 100.000000 10.000000 5 120.000000 12.000000 6 50.000000 5.000000 7 160.000000 16.000000 8 180.000000 18.000000 9 200.000000 20.000000 ZCOPY ( 5, X, 1, A, 1 ) A = 10.000000 1.000000 10.000000 2.000000 10.000000 3.000000 10.000000 4.000000 10.000000 5.000000 20.000000 2.000000 20.000000 2.000000 20.000000 3.000000 20.000000 4.000000 20.000000 5.000000 30.000000 3.000000 30.000000 2.000000 30.000000 3.000000 30.000000 4.000000 30.000000 5.000000 40.000000 4.000000 40.000000 2.000000 40.000000 3.000000 40.000000 4.000000 40.000000 5.000000 50.000000 5.000000 50.000000 2.000000 50.000000 3.000000 50.000000 4.000000 50.000000 5.000000 ZCOPY ( 5, X, 2, A, 5 ) A = 10.000000 1.000000 30.000000 3.000000 50.000000 5.000000 70.000000 7.000000 90.000000 9.000000 20.000000 1.000000 20.000000 2.000000 20.000000 3.000000 20.000000 4.000000 20.000000 5.000000 30.000000 1.000000 30.000000 2.000000 30.000000 3.000000 30.000000 4.000000 30.000000 5.000000 40.000000 1.000000 40.000000 2.000000 40.000000 3.000000 40.000000 4.000000 40.000000 5.000000 50.000000 1.000000 50.000000 2.000000 50.000000 3.000000 50.000000 4.000000 50.000000 5.000000 TEST05 ZDOTC computes the conjugated dot product of two complex vectors. X = 0 2.000000 -1.000000 1 -4.000000 -2.000000 2 3.000000 1.000000 3 2.000000 2.000000 4 -1.000000 -1.000000 The square of the norm of X, computed as ZDOTC(X,X) = (45.000000, 0.000000) Y = 0 -1.000000 0.000000 1 0.000000 -3.000000 2 4.000000 0.000000 3 -3.000000 4.000000 4 -2.000000 0.000000 The dot product X.Y* is (20.000000, 19.000000) TEST06 ZDOTU computes the unconjugated dot product of two complex vectors. X = 0 2.000000 -1.000000 1 -4.000000 -2.000000 2 3.000000 1.000000 3 2.000000 2.000000 4 -1.000000 -1.000000 The unconjugated dot product ( X dot X ) (which is NOT the square of the norm of X!): ZDOTU(X,X) = (23.000000, 28.000000) Y = 0 -1.000000 0.000000 1 0.000000 -3.000000 2 4.000000 0.000000 3 -3.000000 4.000000 4 -2.000000 0.000000 The dot product ( X dot Y ) is (-8.000000, 21.000000) TEST07 ZMACH computes several machine-dependent complex arithmetic parameters. ZMACH(1) = machine epsilon = 2.220446e-16 ZMACH(2) = a tiny value = 2.983336e-153 ZMACH(3) = a huge value = 3.351952e+152 TEST08 ZSCAL multiplies a complex scalar times a vector. X = 0 10.000000 1.000000 1 20.000000 2.000000 2 30.000000 3.000000 3 40.000000 4.000000 4 50.000000 5.000000 5 60.000000 6.000000 ZSCAL ( N, (5.000000, 0.000000), X, 1 ) 0 50.000000 5.000000 1 100.000000 10.000000 2 150.000000 15.000000 3 200.000000 20.000000 4 250.000000 25.000000 5 300.000000 30.000000 ZSCAL ( 3, (-2.000000, 1.000000), X, 2 ) 0 -21.000000 8.000000 1 20.000000 2.000000 2 -63.000000 24.000000 3 40.000000 4.000000 4 -105.000000 40.000000 5 60.000000 6.000000 TEST09 ZSIGN1 ( C1, C2 ) transfers the sign of complex C2 to the ZABS1 magnitude of C1. C1 C2 C3 -------------------- -------------------- -------------------- ( 2.249298 -0.633337) (-4.215983 -1.721400) (-2.046885 -0.835750) ( 2.948136 1.300451) ( 1.955698 1.617000) ( 2.325680 1.922907) (-0.697329 -0.780678) (-1.180331 0.387297) (-1.112852 0.365155) ( 0.092996 -3.166071) ( 4.464248 0.051568) ( 3.221851 0.037217) (-2.802325 3.818976) ( 1.531783 0.131376) ( 6.098271 0.523029) ( 2.504022 -3.899654) ( 1.752354 0.082775) ( 6.114831 0.288844) ( 2.174944 -1.333114) (-1.004736 1.353553) (-1.494588 2.013469) (-0.487299 4.509404) (-3.851225 -1.571537) (-3.548639 -1.448064) (-4.445906 1.328276) (-3.899357 -2.755801) (-3.383180 -2.391002) ( 0.156801 -2.167782) ( 1.245447 2.893713) ( 0.699452 1.625131) TEST10 ZSIGN2 ( C1, C2 ) transfers the sign of complex C2 to the ZABS2 magnitude of C1. C1 C2 C3 -------------------- -------------------- -------------------- ( 2.249298 -0.633337) (-4.215983 -1.721400) (-2.163380 -0.883315) ( 2.948136 1.300451) ( 1.955698 1.617000) ( 2.483318 2.053244) (-0.697329 -0.780678) (-1.180331 0.387297) (-0.994595 0.326352) ( 0.092996 -3.166071) ( 4.464248 0.051568) ( 3.167226 0.036586) (-2.802325 3.818976) ( 1.531783 0.131376) ( 4.719508 0.404777) ( 2.504022 -3.899654) ( 1.752354 0.082775) ( 4.629212 0.218669) ( 2.174944 -1.333114) (-1.004736 1.353553) (-1.520478 2.048346) (-0.487299 4.509404) (-3.851225 -1.571537) (-4.199476 -1.713646) (-4.445906 1.328276) (-3.899357 -2.755801) (-3.789283 -2.678008) ( 0.156801 -2.167782) ( 1.245447 2.893713) ( 0.859241 1.996390) TEST11 ZDROT carries out a Givens rotation on a complex vector. X and Y 0 (10.000000 1.000000) (20.000000 2.000000) 1 (20.000000 2.000000) (40.000000 4.000000) 2 (30.000000 3.000000) (60.000000 6.000000) 3 (40.000000 4.000000) (80.000000 8.000000) 4 (50.000000 5.000000) (100.000000 10.000000) 5 (60.000000 6.000000) (120.000000 12.000000) ZDROT ( N, X, 1, Y, 1, 0.500000, 0.866025 ) 0 (22.320508 2.232051) ( 1.339746 0.133975) 1 (44.641016 4.464102) ( 2.679492 0.267949) 2 (66.961524 6.696152) ( 4.019238 0.401924) 3 (89.282032 8.928203) ( 5.358984 0.535898) 4 (111.602540 11.160254) ( 6.698730 0.669873) 5 (133.923048 13.392305) ( 8.038476 0.803848) TEST12 ZDSCAL multiplies a real scalar times a complex vector. X = 0 10.000000 1.000000 1 20.000000 2.000000 2 30.000000 3.000000 3 40.000000 4.000000 4 50.000000 5.000000 5 60.000000 6.000000 ZDSCAL ( N, 5.000000, X, 1 ) 0 50.000000 5.000000 1 100.000000 10.000000 2 150.000000 15.000000 3 200.000000 20.000000 4 250.000000 25.000000 5 300.000000 30.000000 ZDSCAL ( 3, -2.000000, X, 2 ) 0 -20.000000 -2.000000 1 20.000000 2.000000 2 -60.000000 -6.000000 3 40.000000 4.000000 4 -100.000000 -10.000000 5 60.000000 6.000000 TEST13 ZROTG generates a complex Givens rotation ( C S ) * ( A ) = ( R ) ( -S C ) ( B ) ( 0 ) A = ( 0.449860. -0.126667 ) B = ( -0.843197. -0.344280 ) C = 0.456540 S = ( -0.701707. 0.546973 ) R = ( 0.985367. -0.277451 ) C *A+S*B = ( 0.985367. -0.277451 ) -conjg(S)*A+C*B = ( 0.000000. 0.000000 ) A = ( 0.589627. 0.260090 ) B = ( 0.391140. 0.323400 ) C = 0.785623 S = ( 0.595383. -0.168271 ) R = ( 0.750522. 0.331062 ) C *A+S*B = ( 0.750522. 0.331062 ) -conjg(S)*A+C*B = ( 0.000000. 0.000000 ) A = ( -0.139466. -0.156136 ) B = ( -0.236066. 0.077459 ) C = 0.644375 S = ( 0.306229. 0.700717 ) R = ( -0.216436. -0.242305 ) C *A+S*B = ( -0.216436. -0.242305 ) -conjg(S)*A+C*B = ( 0.000000. 0.000000 ) A = ( 0.018599. -0.633214 ) B = ( 0.892850. 0.010314 ) C = 0.578631 S = ( 0.014528. -0.815460 ) R = ( 0.032144. -1.094331 ) C *A+S*B = ( 0.032144. -1.094331 ) -conjg(S)*A+C*B = ( -0.000000. -0.000000 ) A = ( -0.560465. 0.763795 ) B = ( 0.306357. 0.026275 ) C = 0.951156 S = ( -0.160698. 0.263588 ) R = ( -0.589246. 0.803018 ) C *A+S*B = ( -0.589246. 0.803018 ) -conjg(S)*A+C*B = ( -0.000000. -0.000000 ) TEST14 ZSWAP swaps two complex vectors. X and Y 0 10.000000 1.000000 20.000000 2.000000 1 20.000000 2.000000 40.000000 4.000000 2 30.000000 3.000000 60.000000 6.000000 3 40.000000 4.000000 80.000000 8.000000 4 50.000000 5.000000 100.000000 10.000000 ZSWAP ( N, X, 1, Y, 1 ) X and Y 0 20.000000 2.000000 10.000000 1.000000 1 40.000000 4.000000 20.000000 2.000000 2 60.000000 6.000000 30.000000 3.000000 3 80.000000 8.000000 40.000000 4.000000 4 100.000000 10.000000 50.000000 5.000000 ZSWAP ( 3, X, 2, Y, 1 ) X and Y 0 20.000000 2.000000 10.000000 1.000000 1 20.000000 2.000000 30.000000 3.000000 2 40.000000 4.000000 50.000000 5.000000 3 40.000000 4.000000 80.000000 8.000000 4 60.000000 6.000000 100.000000 10.000000 TEST15 IZAMAX returns the index of the entry of maximum magnitude in a complex vector. The entries and ZABS1 magnitudes: 0 2.000000 -1.000000 3.000000 1 -4.000000 -2.000000 6.000000 2 3.000000 1.000000 4.000000 3 2.000000 2.000000 4.000000 4 -1.000000 -1.000000 2.000000 The index of maximum magnitude = 2 Note that this is a 1-based index. Note that the L1 norm is used. TEST16 DZASUM adds the absolute values of elements of a complex vector. X = 0 ( 2.0 -1.0 ) 1 ( -4.0 -2.0 ) 2 ( 3.0 1.0 ) 3 ( 2.0 2.0 ) 4 ( -1.0 -1.0 ) 5 ( -1.0 0.0 ) 6 ( 0.0 -3.0 ) 7 ( 4.0 0.0 ) DZASUM ( NX, X, 1 ) = 27.000000 DZASUM ( NX/2, X, 2 ) = 12.000000 DZASUM ( 2, X, NX/2 ) = 5.000000 Demonstrate with a matrix A: ( -3.0 4.0 ) ( -1.0 1.0 ) ( 0.0 -2.0 ) ( -1.0 2.0 ) ( 2.0 0.0 ) ( 0.0 5.0 ) ( 1.0 3.0 ) ( 2.0 -4.0 ) ( 3.0 -4.0 ) ( -4.0 -2.0 ) ( -3.0 3.0 ) ( 0.0 -1.0 ) ( 2.0 0.0 ) ( -4.0 1.0 ) ( -3.0 3.0 ) ( 0.0 -1.0 ) ( 2.0 -1.0 ) ( -4.0 -3.0 ) ( -1.0 -2.0 ) ( -2.0 4.0 ) DZASUM ( MA, A[1,2], 1 ) = 25.000000 DZASUM ( NA, A[2,1], MA ) = 17.000000 TEST17 DZNRM2 returns the Euclidean norm of a complex vector. The vector X: 0 2.000000 -1.000000 1 -4.000000 -2.000000 2 3.000000 1.000000 3 2.000000 2.000000 4 -1.000000 -1.000000 The L2 norm of X is 6.708204 BLAS1_Z_TEST: Normal end of execution. 15 June 2018 08:04:44 AM