>> blas1_c_test 15-May-2007 08:23:48 BLAS1_C_PRB: Tests for the MATLAB version using single precision complex arithmetic of the BLAS1, the Level 1 Basic Linear Algebra Subprograms. TEST01 CABS1 returns the L1 norm of a complex number. Real Imaginary Part Part CABS1(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 CABS2 returns the L2 norm of a complex number. Real Imaginary Part Part CABS2(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 CAXPY adds a multiple of one complex vector to another. X = 1 2.000000 0.000000 2 0.000000 -1.000000 3 -4.000000 0.000000 4 0.000000 -2.000000 5 3.000000 0.000000 Y = 1 -1.000000 0.000000 2 0.000000 0.000000 3 0.000000 0.000000 4 0.000000 -3.000000 5 4.000000 0.000000 The scalar multiplier is: ( 0.500000 -1.000000 ) A * X + Y = 1 0.000000 -2.000000 2 -1.000000 -0.500000 3 -2.000000 4.000000 4 -2.000000 -4.000000 5 5.500000 -3.000000 TEST04 CCOPY copies one complex vector into another. X = 1 10.000000 1.000000 2 20.000000 2.000000 3 30.000000 3.000000 4 40.000000 4.000000 5 50.000000 5.000000 6 60.000000 6.000000 7 70.000000 7.000000 8 80.000000 8.000000 9 90.000000 9.000000 10 100.000000 10.000000 Y = 1 20.000000 2.000000 2 40.000000 4.000000 3 60.000000 6.000000 4 80.000000 8.000000 5 100.000000 10.000000 6 120.000000 12.000000 7 140.000000 14.000000 8 160.000000 16.000000 9 180.000000 18.000000 10 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 Y = CCOPY ( 5, X, 1, Y, 1 ) 1 10.000000 1.000000 2 20.000000 2.000000 3 30.000000 3.000000 4 40.000000 4.000000 5 50.000000 5.000000 6 120.000000 12.000000 7 140.000000 14.000000 8 160.000000 16.000000 9 180.000000 18.000000 10 200.000000 20.000000 Y = CCOPY ( 3, X, 2, Y, 3 ) 1 10.000000 1.000000 2 40.000000 4.000000 3 60.000000 6.000000 4 30.000000 3.000000 5 100.000000 10.000000 6 120.000000 12.000000 7 50.000000 5.000000 8 160.000000 16.000000 9 180.000000 18.000000 10 200.000000 20.000000 A(1:5,1) = CCOPY ( 5, X, 1, A(1:5,1), 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 A(1,1:5) = CCOPY ( 5, X, 2, A(1,1:5), 1 ) 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 CDOTC computes the conjugated dot product of two complex vectors. X = 1 2.000000 -1.000000 2 -4.000000 -2.000000 3 3.000000 1.000000 4 2.000000 2.000000 5 -1.000000 -1.000000 The square of the norm of X, computed as CDOTC(X,X) = 45.000000 0.000000 Y = 1 -1.000000 0.000000 2 0.000000 -3.000000 3 4.000000 0.000000 4 -3.000000 4.000000 5 -2.000000 0.000000 The dot product X.Y* is 20.000000 -19.000000 TEST06 CDOTU computes the unconjugated dot product of two complex vectors. X = 1 2.000000 -1.000000 2 -4.000000 -2.000000 3 3.000000 1.000000 4 2.000000 2.000000 5 -1.000000 -1.000000 The unconjugated dot product ( X dot X ) (which is NOT the square of the norm of X!): CDOTU(X,X) = 23.000000 X = 1 -1.000000 0.000000 2 0.000000 -3.000000 3 4.000000 0.000000 4 -3.000000 4.000000 5 -2.000000 0.000000 The dot product ( X dot Y ) is -8.000000 TEST07 CMACH computes several machine-dependent complex arithmetic parameters. Warning: Divide by zero. > In cmach at 86 In blas1_c_test07 at 19 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 88 In blas1_c_test07 at 19 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 92 In blas1_c_test07 at 19 In blas1_c_test at 28 CMACH(1) = machine epsilon = 0.000000 Warning: Divide by zero. > In cmach at 86 In blas1_c_test07 at 20 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 88 In blas1_c_test07 at 20 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 92 In blas1_c_test07 at 20 In blas1_c_test at 28 CMACH(2) = a tiny value = 0.000000 Warning: Divide by zero. > In cmach at 86 In blas1_c_test07 at 21 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 88 In blas1_c_test07 at 21 In blas1_c_test at 28 Warning: Divide by zero. > In cmach at 92 In blas1_c_test07 at 21 In blas1_c_test at 28 CMACH(3) = a huge value = Inf TEST08 CROTG 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 -conj(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 -conj(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 -conj(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 -conj(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 -conj(S)*A+C*B = 0.000000 0.000000 TEST09 CSCAL multiplies a complex scalar times a vector. X = 1 10.000000 1.000000 2 20.000000 2.000000 3 30.000000 3.000000 4 40.000000 4.000000 5 50.000000 5.000000 6 60.000000 6.000000 CSCAL ( N, ( 5.000000 0.000000), X, 1 ) 1 50.000000 5.000000 2 100.000000 10.000000 3 150.000000 15.000000 4 200.000000 20.000000 5 250.000000 25.000000 6 300.000000 30.000000 CSCAL ( 3, ( -2.000000 1.000000), X, 2 ) 1 -21.000000 8.000000 2 20.000000 2.000000 3 -63.000000 24.000000 4 40.000000 4.000000 5 -105.000000 40.000000 6 60.000000 6.000000 TEST10 CSIGN1 ( C1, C2 ) transfers the sign of complex C2 to the CABS1 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.494589 2.013470 -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 TEST11 CSIGN2 ( C1, C2 ) transfers the sign of complex C2 to the CABS2 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 TEST12 CSROT carries out a Givens rotation on a complex vector. X and Y 1 10.000000 1.000000 20.000000 2.000000 2 20.000000 2.000000 40.000000 4.000000 3 30.000000 3.000000 60.000000 6.000000 4 40.000000 4.000000 80.000000 8.000000 5 50.000000 5.000000 100.000000 10.000000 6 60.000000 6.000000 120.000000 12.000000 CSROT ( N, X, 1, Y, 1, 0.500000, 0.866025 ) 1 22.320508 2.232051 1.339746 0.133975 2 44.641016 4.464102 2.679492 0.267949 3 66.961524 6.696152 4.019238 0.401924 4 89.282032 8.928203 5.358984 0.535898 5 111.602540 11.160254 6.698730 0.669873 6 133.923048 13.392305 8.038476 0.803848 TEST13 CSSCAL multiplies a real scalar times a complex vector. X = 1 10.000000 1.000000 2 20.000000 2.000000 3 30.000000 3.000000 4 40.000000 4.000000 5 50.000000 5.000000 6 60.000000 6.000000 X = CSSCAL ( N, 5.000000, X, 1 ) 1 50.000000 5.000000 2 100.000000 10.000000 3 150.000000 15.000000 4 200.000000 20.000000 5 250.000000 25.000000 6 300.000000 30.000000 X = CSSCAL ( 3, -2.000000, X, 2 ) 1 -20.000000 -2.000000 2 20.000000 2.000000 3 -60.000000 -6.000000 4 40.000000 4.000000 5 -100.000000 -10.000000 6 60.000000 6.000000 TEST14 CSWAP swaps two complex vectors. X and Y 1 10.000000 1.000000 20.000000 2.000000 2 20.000000 2.000000 40.000000 4.000000 3 30.000000 3.000000 60.000000 6.000000 4 40.000000 4.000000 80.000000 8.000000 5 50.000000 5.000000 100.000000 10.000000 [ X, Y ] = CSWAP ( N, X, 1, Y, 1 ) X and Y 1 20.000000 2.000000 10.000000 1.000000 2 40.000000 4.000000 20.000000 2.000000 3 60.000000 6.000000 30.000000 3.000000 4 80.000000 8.000000 40.000000 4.000000 5 100.000000 10.000000 50.000000 5.000000 [ X, Y ] = CSWAP ( 3, X, 2, Y, 1 ) X and Y 1 20.000000 2.000000 10.000000 1.000000 2 20.000000 2.000000 30.000000 3.000000 3 40.000000 4.000000 50.000000 5.000000 4 40.000000 4.000000 80.000000 8.000000 5 60.000000 6.000000 100.000000 10.000000 TEST15 ICAMAX returns the index of the entry of maximum magnitude in a complex vector. The entries and CABS1 magnitudes: 1 2.000000 -1.000000 3.000000 2 -4.000000 -2.000000 6.000000 3 3.000000 1.000000 4.000000 4 2.000000 2.000000 4.000000 5 -1.000000 -1.000000 2.000000 The index of maximum magnitude = 2 TEST16 SCASUM adds the absolute values of elements of a complex vector. X = 1 2.000000 -1.000000 2 -4.000000 -2.000000 3 3.000000 1.000000 4 2.000000 2.000000 5 -1.000000 -1.000000 6 -1.000000 0.000000 7 0.000000 -3.000000 8 4.000000 0.000000 SCASUM ( NX, X, 1 ) = 27.000000 SCASUM ( NX/2, X, 2 ) = 12.000000 SCASUM ( 2, X, NX/2 ) = 5.000000 Demonstrate with a matrix A: -3.000000 4.000000 2.000000 0.000000 3.000000 -4.000000 2.000000 0.000000 2.000000 -1.000000 -1.000000 1.000000 0.000000 5.000000 -4.000000 -2.000000 -4.000000 1.000000 -4.000000 -3.000000 0.000000 -2.000000 1.000000 3.000000 -3.000000 3.000000 -3.000000 3.000000 -1.000000 -2.000000 -1.000000 2.000000 2.000000 -4.000000 0.000000 -1.000000 0.000000 -1.000000 -2.000000 4.000000 SCASUM ( MA, A(1:MA,2), 1 ) = 18.000000 SCASUM ( NA, A(2,1:NA), 1 ) = 16.000000 TEST17 SCNRM2 returns the Euclidean norm of a complex vector. The vector X: 1 2.000000 -1.000000 2 -4.000000 -2.000000 3 3.000000 1.000000 4 2.000000 2.000000 5 -1.000000 -1.000000 The L2 norm of X is 6.708204 BLAS1_C_PRB: Normal end of execution. 15-May-2007 08:23:54 >>