diff --git a/books/bookvol10.5.pamphlet b/books/bookvol10.5.pamphlet index 682a139..3c03006 100644 --- a/books/bookvol10.5.pamphlet +++ b/books/bookvol10.5.pamphlet @@ -380,7 +380,7 @@ stored in $DX(1+ (N-1)*|INCX|)$. )set message auto off )clear all ---S 1 of 155 +--S 1 of 166 t1:Complex DoubleFloat := complex(1.0,0) --R --R @@ -388,7 +388,7 @@ t1:Complex DoubleFloat := complex(1.0,0) --R Type: Complex(DoubleFloat) --E 1 ---S 2 of 155 +--S 2 of 166 dcabs1(t1) --R --R @@ -396,7 +396,7 @@ dcabs1(t1) --R Type: DoubleFloat --E 2 ---S 3 of 155 +--S 3 of 166 t2:Complex DoubleFloat := complex(1.0,1.0) --R --R @@ -404,7 +404,7 @@ t2:Complex DoubleFloat := complex(1.0,1.0) --R Type: Complex(DoubleFloat) --E 3 ---S 4 of 155 +--S 4 of 166 dcabs1(t2) --R --R @@ -412,7 +412,7 @@ dcabs1(t2) --R Type: DoubleFloat --E 4 ---S 5 of 155 +--S 5 of 166 t3:Complex DoubleFloat := complex(1.0,-1.0) --R --R @@ -420,7 +420,7 @@ t3:Complex DoubleFloat := complex(1.0,-1.0) --R Type: Complex(DoubleFloat) --E 5 ---S 6 of 155 +--S 6 of 166 dcabs1(t3) --R --R @@ -428,7 +428,7 @@ dcabs1(t3) --R Type: DoubleFloat --E 6 ---S 7 of 155 +--S 7 of 166 t4:Complex DoubleFloat := complex(-1.0,-1.0) --R --R @@ -436,7 +436,7 @@ t4:Complex DoubleFloat := complex(-1.0,-1.0) --R Type: Complex(DoubleFloat) --E 7 ---S 8 of 155 +--S 8 of 166 dcabs1(t4) --R --R @@ -444,7 +444,7 @@ dcabs1(t4) --R Type: DoubleFloat --E 8 ---S 9 of 155 +--S 9 of 166 t5:Complex DoubleFloat := complex(-2.0,-2.0) --R --R @@ -452,7 +452,7 @@ t5:Complex DoubleFloat := complex(-2.0,-2.0) --R Type: Complex(DoubleFloat) --E 9 ---S 10 of 155 +--S 10 of 166 dcabs1(t5) --R --R @@ -462,196 +462,196 @@ dcabs1(t5) )clear all ---S 11 of 155 +--S 11 of 166 a:PRIMARR(DFLOAT):=[ [1.0,2.0,3.0,4,0,5,0,6,0] ] --R --R (1) [1.,2.,3.,4.,0.,5.,0.,6.,0.] --R Type: PrimitiveArray(DoubleFloat) --E 11 ---S 12 of 155 +--S 12 of 166 dasum(3,a,-1) -- 0.0 neg incx --R --R (2) 0. --R Type: DoubleFloat --E 12 ---S 13 of 155 +--S 13 of 166 dasum(3,a,0) -- 0.0 zero incx --R --R (3) 0. --R Type: DoubleFloat --E 13 ---S 14 of 155 +--S 14 of 166 dasum(-1,a,1) -- 0.0 neg elements --R --R (4) 0. --R Type: DoubleFloat --E 14 ---S 15 of 155 +--S 15 of 166 dasum(0,a,1) -- 0.0 no elements --R --R (5) 0. --R Type: DoubleFloat --E 15 ---S 16 of 155 +--S 16 of 166 dasum(1,a,1) -- 1.0 1.0 --R --R (6) 1. --R Type: DoubleFloat --E 16 ---S 17 of 155 +--S 17 of 166 dasum(2,a,1) -- 3.0 1.0+2.0 --R --R (7) 3. --R Type: DoubleFloat --E 17 ---S 18 of 155 +--S 18 of 166 dasum(3,a,1) -- 6.0 1.0+2.0+3.0 --R --R (8) 6. --R Type: DoubleFloat --E 18 ---S 19 of 155 +--S 19 of 166 dasum(4,a,1) -- 10.0 1.0+2.0+3.0+4.0 --R --R (9) 10. --R Type: DoubleFloat --E 19 ---S 20 of 155 +--S 20 of 166 dasum(5,a,1) -- 15.0 1.0+2.0+3.0+4.0+5.0 --R --R (10) 10. --R Type: DoubleFloat --E 20 ---S 21 of 155 +--S 21 of 166 dasum(6,a,1) -- 21.0 1.0+2.0+3.0+4.0+5.0+6.0 --R --R (11) 15. --R Type: DoubleFloat --E 21 ---S 22 of 155 +--S 22 of 166 dasum(7,a,1) -- 21.0 1.0+2.0+3.0+4.0+5.0+6.0 --R --R (12) 15. --R Type: DoubleFloat --E 22 ---S 23 of 155 +--S 23 of 166 dasum(1,a,2) -- 1.0 1.0 --R --R (13) 1. --R Type: DoubleFloat --E 23 ---S 24 of 155 +--S 24 of 166 dasum(2,a,2) -- 4.0 1.0+3.0 --R --R (14) 4. --R Type: DoubleFloat --E 24 ---S 25 of 155 +--S 25 of 166 dasum(3,a,2) -- 9.0 1.0+3.0+5.0 --R --R (15) 4. --R Type: DoubleFloat --E 25 ---S 26 of 155 +--S 26 of 166 dasum(4,a,2) -- 9.0 1.0+3.0+5.0 --R --R (16) 4. --R Type: DoubleFloat --E 26 ---S 27 of 155 +--S 27 of 166 dasum(1,a,3) -- 1.0 1.0 --R --R (17) 1. --R Type: DoubleFloat --E 27 ---S 28 of 155 +--S 28 of 166 dasum(2,a,3) -- 5.0 1.0+4.0 --R --R (18) 5. --R Type: DoubleFloat --E 28 ---S 29 of 155 +--S 29 of 166 dasum(3,a,3) -- 5.0 1.0+4.0 --R --R (19) 5. --R Type: DoubleFloat --E 29 ---S 30 of 155 +--S 30 of 166 dasum(1,a,4) -- 1.0 1.0 --R --R (20) 1. --R Type: DoubleFloat --E 30 ---S 31 of 155 +--S 31 of 166 dasum(2,a,4) -- 6.0 1.0+5.0 --R --R (21) 1. --R Type: DoubleFloat --E 31 ---S 32 of 155 +--S 32 of 166 dasum(3,a,4) -- 6.0 1.0+5.0 --R --R (22) 1. --R Type: DoubleFloat --E 32 ---S 33 of 155 +--S 33 of 166 dasum(1,a,5) -- 1.0 1.0 --R --R (23) 1. --R Type: DoubleFloat --E 33 ---S 34 of 155 +--S 34 of 166 dasum(2,a,5) -- 7.0 1.0+6.0 --R --R (24) 6. --R Type: DoubleFloat --E 34 ---S 35 of 155 +--S 35 of 166 dasum(3,a,5) -- 7.0 1.0+6.0 --R --R (25) 6. --R Type: DoubleFloat --E 35 ---S 36 of 155 +--S 36 of 166 dasum(1,a,6) -- 1.0 1.0 --R --R (26) 1. --R Type: DoubleFloat --E 36 ---S 37 of 155 +--S 37 of 166 dasum(2,a,6) -- 1.0 1.0 --R --R (27) 1. --R Type: DoubleFloat --E 37 ---S 38 of 155 +--S 38 of 166 dasum(1,a,7) -- 1.0 1.0 --R --R (28) 1. @@ -660,7 +660,7 @@ dasum(1,a,7) -- 1.0 1.0 )clear all ---S 39 of 155 +--S 39 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -668,7 +668,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 39 ---S 40 of 155 +--S 40 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -676,7 +676,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 40 ---S 41 of 155 +--S 41 of 166 daxpy(3,2.0,a,1,b,1) --R --R @@ -684,7 +684,7 @@ daxpy(3,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 41 ---S 42 of 155 +--S 42 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -692,7 +692,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 42 ---S 43 of 155 +--S 43 of 166 daxpy(7,2.0,a,1,b,1) --R --R @@ -700,7 +700,7 @@ daxpy(7,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 43 ---S 44 of 155 +--S 44 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -713,7 +713,7 @@ Note that Axiom properly handles array indexes that are out of bounds. The BLAS daxpy routine cannot check this condition. \begin{chunk}{BlasLevelOne.input} ---S 45 of 155 +--S 45 of 166 daxpy(8,2.0,a,1,b,1) --R --R @@ -721,7 +721,7 @@ daxpy(8,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 45 ---S 46 of 155 +--S 46 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -729,7 +729,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 46 ---S 47 of 155 +--S 47 of 166 daxpy(3,2.0,a,3,b,3) --R --R @@ -737,7 +737,7 @@ daxpy(3,2.0,a,3,b,3) --R Type: PrimitiveArray(DoubleFloat) --E 47 ---S 48 of 155 +--S 48 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -745,7 +745,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 48 ---S 49 of 155 +--S 49 of 166 daxpy(4,2.0,a,2,b,2) --R --R @@ -753,7 +753,7 @@ daxpy(4,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 49 ---S 50 of 155 +--S 50 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -761,7 +761,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 50 ---S 51 of 155 +--S 51 of 166 daxpy(5,2.0,a,2,b,2) --R --R @@ -769,7 +769,7 @@ daxpy(5,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 51 ---S 52 of 155 +--S 52 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -777,7 +777,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 52 ---S 53 of 155 +--S 53 of 166 daxpy(3,2.0,a,2,b,2) --R --R @@ -785,7 +785,7 @@ daxpy(3,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 53 ---S 54 of 155 +--S 54 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -793,7 +793,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 54 ---S 55 of 155 +--S 55 of 166 daxpy(3,-2.0,a,2,b,2) --R --R @@ -801,7 +801,7 @@ daxpy(3,-2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 55 ---S 56 of 155 +--S 56 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -809,7 +809,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 56 ---S 57 of 155 +--S 57 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -817,7 +817,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 57 ---S 58 of 155 +--S 58 of 166 daxpy(3,-2.0,a,1,b,2) --R --R @@ -825,7 +825,7 @@ daxpy(3,-2.0,a,1,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 58 ---S 59 of 155 +--S 59 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -833,7 +833,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 59 ---S 60 of 155 +--S 60 of 166 daxpy(3,0.0,a,1,b,2) --R --R @@ -843,7 +843,7 @@ daxpy(3,0.0,a,1,b,2) )clear all ---S 61 of 155 +--S 61 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -851,7 +851,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 61 ---S 62 of 155 +--S 62 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -859,7 +859,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 62 ---S 63 of 155 +--S 63 of 166 dcopy(3,a,1,b,1) --R --R @@ -867,7 +867,7 @@ dcopy(3,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 63 ---S 64 of 155 +--S 64 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -875,7 +875,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 64 ---S 65 of 155 +--S 65 of 166 dcopy(7,a,1,b,1) --R --R @@ -883,7 +883,7 @@ dcopy(7,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 65 ---S 66 of 155 +--S 66 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -891,7 +891,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 66 ---S 67 of 155 +--S 67 of 166 dcopy(8,a,1,b,1) --R --R @@ -899,7 +899,7 @@ dcopy(8,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 67 ---S 68 of 155 +--S 68 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -907,7 +907,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 68 ---S 69 of 155 +--S 69 of 166 dcopy(3,a,3,b,3) --R --R @@ -915,7 +915,7 @@ dcopy(3,a,3,b,3) --R Type: PrimitiveArray(DoubleFloat) --E 69 ---S 70 of 155 +--S 70 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -923,7 +923,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 70 ---S 71 of 155 +--S 71 of 166 dcopy(4,a,2,b,2) --R --R @@ -931,7 +931,7 @@ dcopy(4,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 71 ---S 72 of 155 +--S 72 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -939,7 +939,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 72 ---S 73 of 155 +--S 73 of 166 dcopy(5,a,2,b,2) --R --R @@ -947,7 +947,7 @@ dcopy(5,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 73 ---S 74 of 155 +--S 74 of 166 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -955,7 +955,7 @@ b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 74 ---S 75 of 155 +--S 75 of 166 dcopy(3,a,2,b,2) --R --R @@ -963,7 +963,7 @@ dcopy(3,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 75 ---S 76 of 155 +--S 76 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -971,7 +971,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 76 ---S 77 of 155 +--S 77 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -979,7 +979,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 77 ---S 78 of 155 +--S 78 of 166 dcopy(3,a,1,b,1) --R --R @@ -987,7 +987,7 @@ dcopy(3,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 78 ---S 79 of 155 +--S 79 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -995,7 +995,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 79 ---S 80 of 155 +--S 80 of 166 dcopy(3,a,1,b,2) --R --R @@ -1003,7 +1003,7 @@ dcopy(3,a,1,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 80 ---S 81 of 155 +--S 81 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -1011,7 +1011,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 81 ---S 82 of 155 +--S 82 of 166 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -1019,7 +1019,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 82 ---S 83 of 155 +--S 83 of 166 dcopy(5,a,1,b,1) --R --R @@ -1029,63 +1029,63 @@ dcopy(5,a,1,b,1) )clear all ---S 84 of 155 +--S 84 of 166 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R (1) [1.,2.,3.,4.,5.] --R Type: PrimitiveArray(DoubleFloat) --E 84 ---S 85 of 155 +--S 85 of 166 b:PRIMARR(DFLOAT):=[ [ 5.0, 6.0, 7.0, 8.0, 9.0] ] --R --R (2) [5.,6.,7.,8.,9.] --R Type: PrimitiveArray(DoubleFloat) --E 85 ---S 86 of 155 +--S 86 of 166 ddot(0,a,1,b,1) --R --R (3) 0. --R Type: DoubleFloat --E 86 ---S 87 of 155 +--S 87 of 166 ddot(3,a,1,b,1) --R --R (4) 38. --R Type: DoubleFloat --E 87 ---S 88 of 155 +--S 88 of 166 ddot(3,a,1,b,2) --R --R (5) 46. --R Type: DoubleFloat --E 88 ---S 89 of 155 +--S 89 of 166 ddot(3,a,2,b,1) --R --R (6) 58. --R Type: DoubleFloat --E 89 ---S 90 of 155 +--S 90 of 166 ddot(3,a,1,b,-2) --R --R (7) 38. --R Type: DoubleFloat --E 90 ---S 91 of 155 +--S 91 of 166 ddot(3,a,-2,b,1) --R --R (8) 50. --R Type: DoubleFloat --E 91 ---S 92 of 155 +--S 92 of 166 ddot(3,a,-2,b,-2) --R --R (9) 71. @@ -1094,28 +1094,28 @@ ddot(3,a,-2,b,-2) )clear all ---S 93 of 155 +--S 93 of 166 a:PRIMARR(DFLOAT):=[ [ 3.0, -4.0, 5.0, -7.0, 9.0] ] --R --R (1) [3.,- 4.,5.,- 7.,9.] --R Type: PrimitiveArray(DoubleFloat) --E 93 ---S 94 of 155 +--S 94 of 166 dnrm2(3,a,1) --R --R (2) 7.0710678118654755 --R Type: DoubleFloat --E 94 ---S 95 of 155 +--S 95 of 166 dnrm2(5,a,1) --R --R (3) 13.416407864998739 --R Type: DoubleFloat --E 95 ---S 96 of 155 +--S 96 of 166 dnrm2(3,a,2) --R --R (4) 10.723805294763608 @@ -1123,7 +1123,7 @@ dnrm2(3,a,2) --E 96 )clear all ---S 97 of 155 +--S 97 of 166 a:MATRIX(DFLOAT):=[[6,5,0],[5,1,4],[0,4,3]] --R --R +6. 5. 0.+ @@ -1134,7 +1134,7 @@ a:MATRIX(DFLOAT):=[[6,5,0],[5,1,4],[0,4,3]] --R Type: Matrix(DoubleFloat) --E 97 ---S 98 of 155 +--S 98 of 166 t1:=drotg(elt(a,1,1),elt(a,1,2),0.0,0.0) --R --R (2) @@ -1143,7 +1143,7 @@ t1:=drotg(elt(a,1,1),elt(a,1,2),0.0,0.0) --R Type: PrimitiveArray(DoubleFloat) --E 98 ---S 99 of 155 +--S 99 of 166 g1:MATRIX(DFLOAT):=[[elt(t1,2), elt(t1,3),0.0],_ [-elt(t1,3),elt(t1,2),0.0],_ [0.0, 0.0, 1.0]] @@ -1157,7 +1157,7 @@ g1:MATRIX(DFLOAT):=[[elt(t1,2), elt(t1,3),0.0],_ --R Type: Matrix(DoubleFloat) --E 99 ---S 100 of 155 +--S 100 of 166 t2:=g1*a --R --R + 7.810249675906654 4.4812907976513596 2.5607375986579197+ @@ -1168,7 +1168,7 @@ t2:=g1*a --R Type: Matrix(DoubleFloat) --E 100 ---S 101 of 155 +--S 101 of 166 t3:=drotg(elt(t2,2,2),elt(a,3,2),0.0,0.0) --R --R (5) @@ -1177,7 +1177,7 @@ t3:=drotg(elt(t2,2,2),elt(a,3,2),0.0,0.0) --R Type: PrimitiveArray(DoubleFloat) --E 101 ---S 102 of 155 +--S 102 of 166 g2:MATRIX(DFLOAT):=[[1.0, 0.0, 0.0],_ [0.0, elt(t3,2),elt(t3,3)],_ [0.0,-elt(t3,3),elt(t3,2)]] @@ -1191,7 +1191,7 @@ g2:MATRIX(DFLOAT):=[[1.0, 0.0, 0.0],_ --R Type: Matrix(DoubleFloat) --E 102 ---S 103 of 155 +--S 103 of 166 g2*g1*a --R --R + 7.810249675906654 4.4812907976513596 2.5607375986579197 + @@ -1202,7 +1202,7 @@ g2*g1*a --R Type: Matrix(DoubleFloat) --E 103 ---S 104 of 155 +--S 104 of 166 q:=transpose(g1)*transpose(g2) --R --R +0.76822127959737585 0.33265417936007158 0.54697098874441952 + @@ -1215,21 +1215,21 @@ q:=transpose(g1)*transpose(g2) )clear all ---S 105 of 155 +--S 105 of 166 dx:PRIMARR(DFLOAT):=[[6,0, 1.0, 4.0, -1.0, -1.0]] --R --R (1) [6.,0.,1.,4.,- 1.,- 1.] --R Type: PrimitiveArray(DoubleFloat) --E 105 ---S 106 of 155 +--S 106 of 166 dy:PRIMARR(DFLOAT):=[[5.0, 1.0, -4.0, 4.0, -4.0]] --R --R (2) [5.,1.,- 4.,4.,- 4.] --R Type: PrimitiveArray(DoubleFloat) --E 106 ---S 107 of 155 +--S 107 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R --R (3) @@ -1244,7 +1244,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 107 ---S 108 of 155 +--S 108 of 166 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (4) @@ -1259,7 +1259,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 108 ---S 109 of 155 +--S 109 of 166 drot(5,dx,1,dy,1,0.707106781,-0.707106781) -- rotate by -45 degrees --R --R (5) @@ -1274,7 +1274,7 @@ drot(5,dx,1,dy,1,0.707106781,-0.707106781) -- rotate by -45 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 109 ---S 110 of 155 +--S 110 of 166 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (6) @@ -1289,21 +1289,21 @@ drot(5,dx,1,dy,1,0.707106781,-0.707106781) -- rotate by -45 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 110 ---S 111 of 155 +--S 111 of 166 dx:PRIMARR(DFLOAT):=[[6,0, 1.0, 4.0, -1.0, -1.0]] --R --R (7) [6.,0.,1.,4.,- 1.,- 1.] --R Type: PrimitiveArray(DoubleFloat) --E 111 ---S 112 of 155 +--S 112 of 166 dy:PRIMARR(DFLOAT):=[[5.0, 1.0, -4.0, 4.0, -4.0]] --R --R (8) [5.,1.,- 4.,4.,- 4.] --R Type: PrimitiveArray(DoubleFloat) --E 112 ---S 113 of 155 +--S 113 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R --R (9) @@ -1318,7 +1318,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 113 ---S 114 of 155 +--S 114 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 90 degrees --R --R (10) @@ -1333,7 +1333,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 90 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 114 ---S 115 of 155 +--S 115 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 135 degrees --R --R (11) @@ -1348,7 +1348,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 135 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 115 ---S 116 of 155 +--S 116 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 180 degrees --R --R (12) @@ -1363,7 +1363,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 180 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 116 ---S 117 of 155 +--S 117 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 225 degrees --R --R (13) @@ -1378,7 +1378,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 225 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 117 ---S 118 of 155 +--S 118 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 270 degrees --R --R (14) @@ -1393,7 +1393,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 270 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 118 ---S 119 of 155 +--S 119 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 315 degrees --R --R (15) @@ -1408,7 +1408,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 315 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 119 ---S 120 of 155 +--S 120 of 166 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 360 degrees --R --R (16) @@ -1423,7 +1423,7 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 360 degrees --R Type: List(PrimitiveArray(DoubleFloat)) --E 120 ---S 121 of 155 +--S 121 of 166 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (17) @@ -1439,42 +1439,42 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 360 degrees --E 121 )clear all ---S 122 of 155 +--S 122 of 166 dx:PRIMARR(DFLOAT):=[[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]] --R --R (1) [1.,2.,3.,4.,5.,6.] --R Type: PrimitiveArray(DoubleFloat) --E 122 ---S 123 of 155 +--S 123 of 166 dscal(6,2.0,dx,1) --R --R (2) [2.,4.,6.,8.,10.,12.] --R Type: PrimitiveArray(DoubleFloat) --E 123 ---S 124 of 155 +--S 124 of 166 dx --R --R (3) [2.,4.,6.,8.,10.,12.] --R Type: PrimitiveArray(DoubleFloat) --E 124 ---S 125 of 155 +--S 125 of 166 dx:PRIMARR(DFLOAT):=[[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]] --R --R (4) [1.,2.,3.,4.,5.,6.] --R Type: PrimitiveArray(DoubleFloat) --E 125 ---S 126 of 155 +--S 126 of 166 dscal(3,0.5,dx,1) --R --R (5) [0.5,1.,1.5,4.,5.,6.] --R Type: PrimitiveArray(DoubleFloat) --E 126 ---S 127 of 155 +--S 127 of 166 dx --R --R (6) [0.5,1.,1.5,4.,5.,6.] @@ -1483,63 +1483,63 @@ dx )clear all ---S 128 of 155 +--S 128 of 166 dx:PRIMARR(DFLOAT):=[[1.0, 2.0, 3.0, 4.0, 5.0]] --R --R (1) [1.,2.,3.,4.,5.] --R Type: PrimitiveArray(DoubleFloat) --E 128 ---S 129 of 155 +--S 129 of 166 dy:PRIMARR(DFLOAT):=[[9.0, 8.0, 7.0, 6.0, -5.0]] --R --R (2) [9.,8.,7.,6.,- 5.] --R Type: PrimitiveArray(DoubleFloat) --E 129 ---S 130 of 155 +--S 130 of 166 dswap(5,dx,1,dy,1) --R --R (3) [[9.,8.,7.,6.,- 5.],[1.,2.,3.,4.,5.]] --R Type: List(PrimitiveArray(DoubleFloat)) --E 130 ---S 131 of 155 +--S 131 of 166 dx:PRIMARR(DFLOAT):=[[1.0, 2.0, 3.0, 4.0, 5.0]] --R --R (4) [1.,2.,3.,4.,5.] --R Type: PrimitiveArray(DoubleFloat) --E 131 ---S 132 of 155 +--S 132 of 166 dy:PRIMARR(DFLOAT):=[[9.0, 8.0, 7.0, 6.0, -5.0]] --R --R (5) [9.,8.,7.,6.,- 5.] --R Type: PrimitiveArray(DoubleFloat) --E 132 ---S 133 of 155 +--S 133 of 166 dswap(3,dx,2,dy,2) --R --R (6) [[9.,2.,7.,4.,- 5.],[1.,8.,3.,6.,5.]] --R Type: List(PrimitiveArray(DoubleFloat)) --E 133 ---S 134 of 155 +--S 134 of 166 dx:PRIMARR(DFLOAT):=[[1.0, 2.0, 3.0, 4.0, 5.0]] --R --R (7) [1.,2.,3.,4.,5.] --R Type: PrimitiveArray(DoubleFloat) --E 134 ---S 135 of 155 +--S 135 of 166 dy:PRIMARR(DFLOAT):=[[9.0, 8.0, 7.0, 6.0, -5.0]] --R --R (8) [9.,8.,7.,6.,- 5.] --R Type: PrimitiveArray(DoubleFloat) --E 135 ---S 136 of 155 +--S 136 of 166 dswap(5,dx,1,dy,-1) --R --R (9) [[9.,8.,7.,6.,- 5.],[1.,2.,3.,4.,5.]] @@ -1548,28 +1548,28 @@ dswap(5,dx,1,dy,-1) )clear all ---S 137 of 155 +--S 137 of 166 d:PRIMARR(COMPLEX(DFLOAT)):=[[1.0+2.0*%i,-3.0+4.0*%i,5.0-6.0*%i]] --R --R (1) [1. + 2. %i,- 3. + 4. %i,5. - 6. %i] --R Type: PrimitiveArray(Complex(DoubleFloat)) --E 137 ---S 138 of 155 +--S 138 of 166 dzasum(3,d,1) -- 21.0 --R --R (2) 21. --R Type: DoubleFloat --E 138 ---S 139 of 155 +--S 139 of 166 dzasum(3,d,2) -- 14.0 --R --R (3) 14. --R Type: DoubleFloat --E 139 ---S 140 of 155 +--S 140 of 166 dzasum(-3,d,1) -- 0.0 --R --R (4) 0. @@ -1578,7 +1578,7 @@ dzasum(-3,d,1) -- 0.0 )clear all ---S 141 of 155 +--S 141 of 166 a:PRIMARR(COMPLEX(DFLOAT)):=_ [[3.+4.*%i, -4.+5.*%i, 5.+6.*%i, 7.-8.*%i, -9.-2.*%i]] --R @@ -1586,49 +1586,49 @@ a:PRIMARR(COMPLEX(DFLOAT)):=_ --R Type: PrimitiveArray(Complex(DoubleFloat)) --E 141 ---S 142 of 155 +--S 142 of 166 dznrm2(5,a,1) -- should be 18.028 --R --R (2) 18.027756377319946 --R Type: DoubleFloat --E 142 ---S 143 of 155 +--S 143 of 166 dznrm2(3,a,2) -- should be 13.077 --R --R (3) 13.076696830622021 --R Type: DoubleFloat --E 143 ---S 144 of 155 +--S 144 of 166 dznrm2(3,a,1) -- should be 11.269 --R --R (4) 11.269427669584644 --R Type: DoubleFloat --E 144 ---S 145 of 155 +--S 145 of 166 dznrm2(3,a,-1) -- should be 0.0 --R --R (5) 0. --R Type: DoubleFloat --E 145 ---S 146 of 155 +--S 146 of 166 dznrm2(-3,a,-1) -- should be 0.0 --R --R (6) 0. --R Type: DoubleFloat --E 146 ---S 147 of 155 +--S 147 of 166 dznrm2(1,a,1) -- should be 5.0 --R --R (7) 5. --R Type: DoubleFloat --E 147 ---S 148 of 155 +--S 148 of 166 dznrm2(1,a,2) -- should be 5.0 --R --R (8) 5. @@ -1637,53 +1637,132 @@ dznrm2(1,a,2) -- should be 5.0 )clear all ---S 149 of 155 +--S 149 of 166 a:PRIMARR(COMPLEX(FLOAT)) --R Type: Void --E 149 ---S 150 of 155 +--S 150 of 166 a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]] --R --R (2) [3.0 + 4.0 %i,- 4.0 + 5.0 %i,5.0 + 6.0 %i,7.0 - 8.0 %i,- 9.0 - 2.0 %i] --R Type: PrimitiveArray(Complex(Float)) --E 150 ---S 151 of 155 +--S 151 of 166 icamax(5,a,1) -- should be 3 --R --R (3) 3 --R Type: PositiveInteger --E 151 ---S 152 of 155 -icamax(0,a,1) -- should be 0 +--S 152 of 166 +icamax(0,a,1) -- should be -1 --R ---R (4) 0 ---R Type: NonNegativeInteger +--R (4) - 1 +--R Type: Integer --E 152 ---S 153 of 155 -icamax(5,a,-1) -- should be 0 +--S 153 of 166 +icamax(5,a,-1) -- should be -1 --R ---R (5) 0 ---R Type: NonNegativeInteger +--R (5) - 1 +--R Type: Integer --E 153 ---S 154 of 155 +--S 154 of 166 icamax(3,a,1) -- should be 2 --R --R (6) 2 --R Type: PositiveInteger ---E 154 +--E 155 ---S 155 of 155 -icamax(3,a,2) -- should be 1 +--S 155 of 166 +icamax(3,a,2) -- should be 1 --R --R (7) 1 --R Type: PositiveInteger --E 155 +)clear all + +--S 156 of 166 +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, 5.0, -1.0]] +--R +--R (1) [3.,4.,- 3.,5.,- 1.] +--R Type: PrimitiveArray(DoubleFloat) +--E 156 + +--S 157 of 166 +idamax(5,a,1) -- should be 3 +--R +--R (2) 3 +--R Type: PositiveInteger +--E 157 + +--S 158 of 166 +idamax(3,a,1) -- should be 1 +--R +--R (3) 1 +--R Type: PositiveInteger +--E 158 + +--S 159 of 166 +idamax(0,a,1) -- should be -1 +--R +--R (4) - 1 +--R Type: Integer +--E 159 + +--S 160 of 166 +idamax(-5,a,1) -- should be -1 +--R +--R (5) - 1 +--R Type: Integer +--E 160 + +--S 161 of 166 +idamax(5,a,-1) -- should be -1 +--R +--R (6) - 1 +--R Type: Integer +--E 161 + +--S 162 of 166 +idamax(5,a,2) -- should be 0 +--R +--R (7) 0 +--R Type: NonNegativeInteger +--E 162 + +--S 163 of 166 +idamax(1,a,0) -- should be -1 +--R +--R (8) - 1 +--R Type: Integer +--E 163 + +--S 164 of 166 +idamax(1,a,-1) -- should be -1 +--R +--R (9) - 1 +--R Type: Integer +--E 164 + +--S 165 of 166 +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, -5.0, -1.0]] +--R +--R (10) [3.,4.,- 3.,- 5.,- 1.] +--R Type: PrimitiveArray(DoubleFloat) +--E 165 + +--S 166 of 166 +idamax(5,a,1) -- should be 3 +--R +--R (11) 3 +--R Type: PositiveInteger +--E 166 + )spool )lisp (bye) \end{chunk} @@ -1903,11 +1982,28 @@ BlasLevelOne() : Exports == Implementation where ++ ++X a:PRIMARR(COMPLEX(FLOAT)) ++X a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]] - ++X icamax(5,a,1) -- should be 4 - ++X icamax(0,a,1) -- should be 1 - ++X icamax(5,a,-1) -- should be 1 - ++X icamax(3,a,1) -- should be 3 - ++X icamax(3,a,2) -- should be 2 + ++X icamax(5,a,1) -- should be 3 + ++X icamax(0,a,1) -- should be -1 + ++X icamax(5,a,-1) -- should be -1 + ++X icamax(3,a,1) -- should be 2 + ++X icamax(3,a,2) -- should be 1 + + idamax: (INT, DX, INT) -> INT + ++ idamax computes the largest absolute value of the elements + ++ of the array and returns the index of the first instance + ++ of the maximum. + ++ + ++X a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, 5.0, -1.0]] + ++X idamax(5,a,1) -- should be 3 + ++X idamax(3,a,1) -- should be 1 + ++X idamax(0,a,1) -- should be -1 + ++X idamax(-5,a,1) -- should be -1 + ++X idamax(5,a,-1) -- should be -1 + ++X idamax(5,a,2) -- should be 0 + ++X idamax(1,a,0) -- should be -1 + ++X idamax(1,a,-1) -- should be -1 + ++X a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, -5.0, -1.0]] + ++X idamax(5,a,1) -- should be 3 Implementation == add @@ -1937,6 +2033,8 @@ BlasLevelOne() : Exports == Implementation where DZNRM2SPAD(n,dz,incx)$Lisp icamax(n:INT,dz:PCF,incx:INT):INT == ICAMAXSPAD(n,dz,incx)$Lisp + idamax(n:INT,dz:DX,incx:INT):INT == + IDAMAX(n,dz,incx)$Lisp \end{chunk} @@ -7489,37 +7587,37 @@ a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]] --E 2 --S 3 of 7 -icamax(5,a,1) -- should be 4 +icamax(5,a,1) -- should be 3 --R ---R (10) 4 +--R (10) 3 --R Type: PositiveInteger --E 3 --S 4 of 7 -icamax(0,a,1) -- should be 1 +icamax(0,a,1) -- should be -1 --R ---R (11) 1 ---R Type: PositiveInteger +--R (11) - 1 +--R Type: Integer --E 4 --S 5 of 7 -icamax(5,a,-1) -- should be 1 +icamax(5,a,-1) -- should be -1 --R ---R (12) 1 ---R Type: PositiveInteger +--R (12) - 1 +--R Type: Integer --E 5 --S 6 of 7 -icamax(3,a,1) -- should be 3 +icamax(3,a,1) -- should be 2 --R ---R (13) 3 +--R (13) 2 --R Type: PositiveInteger --E 6 --S 7 of 7 -icamax(3,a,2) -- should be 2 +icamax(3,a,2) -- should be 1 --R ---R (14) 2 +--R (14) 1 --R Type: PositiveInteger --E 7 @@ -7537,26 +7635,34 @@ a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]] [3.0 + 4.0 %i,- 4.0 + 5.0 %i,5.0 + 6.0 %i,7.0 - 8.0 %i,- 9.0 - 2.0 %i] -icamax(5,a,1) -- should be 4 +Note that Axiom arrays are 0-based + +icamax(5,a,1) -- should be 3 - 4 + 3 -icamax(0,a,1) -- should be 1 +If the arguments are not valid, return an invalid array index - 1 +The count must be greater than 0. -icamax(5,a,-1) -- should be 1 +icamax(0,a,1) -- should be -1 - 1 + - 1 -icamax(3,a,1) -- should be 3 +The increment must be positive - 3 +icamax(5,a,-1) -- should be -1 + + - 1 -icamax(3,a,2) -- should be 2 +icamax(3,a,1) -- should be 2 2 +icamax(3,a,2) -- should be 1 + + 1 + ==================================================================== Man Page Details ==================================================================== @@ -7663,33 +7769,84 @@ c \begin{chunk}{icamax example} program icamaxEX -* Tim Daly May 13, 2012 +* Tim Daly May 17, 2012 * unit tests for BLAS icamax complex a(5) integer n - a(1) = ( 3.0, 4.0) - a(2) = (-4.0, 5.0) - a(3) = ( 5.0, 6.0) - a(4) = ( 7.0,-8.0) - a(5) = (-9.0,-2.0) + a(1) = ( 1.0, 2.0) + a(2) = (-2.0, 2.0) + a(3) = ( 2.0,-1.0) + a(4) = ( 2.0,-3.0) + a(5) = (-1.0,-0.0) write(6,100)a(1),a(2),a(3),a(4),a(5) 100 format("a=(/ (",f6.3,f6.3,"),(",f6.3,f6.3"),(",f6.3,f6.3"),",/, C " (",f6.3,f6.3,"),(",f6.3,f6.3") /)") n=icamax(5,a,1) write(6,200)n 200 format("should be 4",/,"n=",i3) + n=icamax(3,a,1) + write(6,201)n + 201 format("should be 2",/,"n=",i3) + n=icamax(0,a,1) + write(6,202)n + 202 format("should be 0",/,"n=",i3) + n=icamax(-5,a,1) + write(6,203)n + 203 format("should be 0",/,"n=",i3) + n=icamax(5,a,-1) + write(6,204)n + 204 format("should be 0",/,"n=",i3) + n=icamax(5,a,2) + write(6,205)n + 205 format("should be 1",/,"n=",i3) + n=icamax(1,a,0) + write(6,206)n + 206 format("should be 0",/,"n=",i3) + n=icamax(1,a,-1) + write(6,207)n + 207 format("should be 0",/,"n=",i3) + n=icamax(1,a,5) + write(6,208)n + 208 format("should be 1",/,"n=",i3) + a(1) = ( 1.0, 2.0) + a(2) = (-2.0, 2.0) + a(3) = ( 2.0,-1.0) + a(4) = (-2.0,-3.0) + a(5) = (-1.0,-0.0) + write(6,100)a(1),a(2),a(3),a(4),a(5) + n=icamax(5,a,1) + write(6,209)n + 209 format("should be 4",/,"n=",i3) stop end \end{chunk} \begin{verbatim} -gcc -o icamaxEX icamaxEX.f -lgfortran icamax.o && ./icamaxEX - -a=(/ ( 3.000 4.000),(-4.000 5.000),( 5.000 6.000), - ( 7.000-8.000),(-9.000-2.000) /) +gcc -o icamaxEX icamaxEX.f -lgfortran icamax.o && ./icamaxEX +a=(/ ( 1.000 2.000),(-2.000 2.000),( 2.000-1.000), + ( 2.000-3.000),(-1.000-0.000) /) +should be 4 +n= 4 +should be 2 +n= 2 +should be 0 +n= 0 +should be 0 +n= 0 +should be 0 +n= 0 +should be 1 +n= 1 +should be 0 +n= 0 +should be 0 +n= 0 +should be 1 +n= 1 +a=(/ ( 1.000 2.000),(-2.000 2.000),( 2.000-1.000), + (-2.000-3.000),(-1.000-0.000) /) should be 4 n= 4 - \end{verbatim} Spad represents complex numbers as a pair where the car is the real @@ -7722,7 +7879,6 @@ the results are displaced by 1. (icamax n vec incx))) (defun icamax (n cx incx) -; Tim Daly May 13, 2012 (declare (type (simple-array (complex single-float) (*)) cx) (type fixnum incx n)) (labels ( @@ -7731,9 +7887,10 @@ the results are displaced by 1. (+ (the single-float (abs (the single-float (realpart zdum)))) (the single-float (abs (the single-float (imagpart zdum)))))))) (declare (ftype (function (complex single-float) single-float) cabs1)) - (let ((ix 0) (smax 0.0f0) (icamax 0) (limit (length cx))) + (let ((ix 0) (smax 0.0f0) (icamax -1) (limit (length cx))) (declare (type (single-float) smax) (type fixnum icamax ix limit)) - (when (and (> n 1) (> incx 0)) + (when (and (>= n 1) (> incx 0)) + (setq icamax 0) (setf smax (the single-float (cabs1 (svref cx 0)))) (setf ix (the fixnum (+ ix incx))) (do ((i 1 (+ i 1))) @@ -7745,24 +7902,37 @@ the results are displaced by 1. (setf ix (the fixnum (+ ix incx))))) icamax))) - \end{chunk} \begin{chunk}{BLAS 1 icamax lisp test} (load "icamax.lisp") (setq a - (vector #C(3.0 4.0) #C(-4.0 5.0) #C(5.0 6.0) #C(7.0 -8.0) #C(-9.0 -2.0))) -; #(#C(3.0 4.0) #C(-4.0 5.0) #C(5.0 6.0) #C(7.0 -8.0) #C(-9.0 -2.0)) + (vector #C(1.0 2.0) #C(-2.0 2.0) #C(2.0 -1.0) #C(2.0 -3.0) #C(-1.0 -0.0))) +; #(#C(1.0 2.0) #C(-2.0 2.0) #C(2.0 -1.0) #C(2.0 -3.0) #C(-1.0 0.0)) (icamax 5 a 1) -; 4 -(icamax 0 a 1) +; 3 +(icamax 3 a 1) ; 1 +(icamax 0 a 1) +; -1 +(icamax -5 a 1) +; -1 (icamax 5 a -1) -; 1 -(icamax 3 a 1) +; -1 +(icamax 5 a 2) +; 0 +(icamax 1 a 0) +; -1 +(icamax 1 a -1) +; -1 +(icamax 1 a 5) +; 0 +(setq a + (vector #C(1.0 2.0) #C(-2.0 2.0) #C(2.0 -1.0) #C(-2.0 -3.0) #C(-1.0 -0.0))) +; #(#C(1.0 2.0) #C(-2.0 2.0) #C(2.0 -1.0) #C(-2.0 -3.0) #C(-1.0 0.0)) +(icamax 5 a 1) ; 3 -(icamax 3 a 2) -; 2 + \end{chunk} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -7778,6 +7948,84 @@ the results are displaced by 1. )set message auto off )clear all + +--S 1 of 11 +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, 5.0, -1.0]] +--R +--R (1) [3.,4.,- 3.,5.,- 1.] +--R Type: PrimitiveArray(DoubleFloat) +--E 1 + +--S 2 of 11 +idamax(5,a,1) -- should be 3 +--R +--R (2) 3 +--R Type: PositiveInteger +--E 2 + +--S 3 of 11 +idamax(3,a,1) -- should be 1 +--R +--R (3) 1 +--R Type: PositiveInteger +--E 3 + +--S 4 of 11 +idamax(0,a,1) -- should be -1 +--R +--R (4) - 1 +--R Type: Integer +--E 4 + +--S 5 of 11 +idamax(-5,a,1) -- should be -1 +--R +--R (5) - 1 +--R Type: Integer +--E 5 + +--S 6 of 11 +idamax(5,a,-1) -- should be -1 +--R +--R (6) - 1 +--R Type: Integer +--E 6 + +--S 7 of 11 +idamax(5,a,2) -- should be 0 +--R +--R (7) 0 +--R Type: NonNegativeInteger +--E 7 + +--S 8 of 11 +idamax(1,a,0) -- should be -1 +--R +--R (8) - 1 +--R Type: Integer +--E 8 + +--S 9 of 11 +idamax(1,a,-1) -- should be -1 +--R +--R (9) - 1 +--R Type: Integer +--E 9 + +--S 10 of 11 +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, -5.0, -1.0]] +--R +--R (10) [3.,4.,- 3.,- 5.,- 1.] +--R Type: PrimitiveArray(DoubleFloat) +--E 10 + +--S 11 of 11 +idamax(5,a,1) -- should be 3 +--R +--R (11) 3 +--R Type: PositiveInteger +--E 11 + )spool )lisp (bye) \end{chunk} @@ -7786,6 +8034,56 @@ the results are displaced by 1. idamax examples ==================================================================== +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, 5.0, -1.0]] + + [3.,4.,- 3.,5.,- 1.] + +Note that Axiom arrays are 0-based. + +idamax(5,a,1) -- should be 3 + + 3 + +idamax(3,a,1) -- should be 1 + + 1 + +The count and increment must both be positive numbers + +idamax(0,a,1) -- should be -1 + + - 1 + +idamax(-5,a,1) -- should be -1 + + - 1 + +idamax(5,a,-1) -- should be -1 + + - 1 + +idamax(5,a,2) -- should be 0 + + 0 + +idamax(1,a,0) -- should be -1 + + - 1 + +idamax(1,a,-1) -- should be -1 + + - 1 + +The comparison for maximum uses the absolute value + +a:PRIMARR(DFLOAT):=[[3.0, 4.0, -3.0, -5.0, -1.0]] + + [3.,4.,- 3.,- 5.,- 1.] + +idamax(5,a,1) -- should be 3 + + 3 + ==================================================================== Man Page Details ==================================================================== @@ -7882,7 +8180,7 @@ c \begin{chunk}{idamaxEX example} program idamaxEX -* Tim Daly May 15, 2012 +* Tim Daly May 16, 2012 * unit tests for BLAS idamax double precision a(5) integer n @@ -7907,6 +8205,20 @@ c n=idamax(5,a,2) write(6,205)n 205 format("should be 1",/,"n=",i3) + n=idamax(1,a,0) + write(6,206)n + 206 format("should be 0",/,"n=",i3) + n=idamax(1,a,-1) + write(6,207)n + 207 format("should be 0",/,"n=",i3) + n=idamax(1,a,5) + write(6,208)n + 208 format("should be 1",/,"n=",i3) + a = (/ 3.0, 4.0, -3.0, -5.0, -1.0 /) + write(6,100)a(1),a(2),a(3),a(4),a(5) + n=idamax(5,a,1) + write(6,209)n + 209 format("should be 4",/,"n=",i3) stop end \end{chunk} @@ -7926,71 +8238,65 @@ should be 0 n= 0 should be 1 n= 1 +should be 0 +n= 0 +should be 0 +n= 0 +should be 1 +n= 1 +a=(/ (/ 3.000 4.000 -3.000 -5.000 -1.000 /) +should be 4 +n= 4 \end{verbatim} \begin{chunk}{BLAS 1 idamax} (defun idamax (n dx incx) - (declare (type (simple-array double-float (*)) dx) - (type fixnum incx n)) - (f2cl-lib:with-multi-array-data - ((dx double-float dx-%data% dx-%offset%)) - (prog ((i 0) (ix 0) (dmax 0.0) (idamax 0)) - (declare (type (double-float) dmax) - (type fixnum idamax ix i)) - (setf idamax 0) - (if (or (< n 1) (<= incx 0)) (go end_label)) - (setf idamax 1) - (if (= n 1) (go end_label)) - (if (= incx 1) (go label20)) - (setf ix 1) - (setf dmax - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (1) ((1 *)) dx-%offset%))))) - (setf ix (f2cl-lib:int-add ix incx)) - (f2cl-lib:fdo (i 2 (f2cl-lib:int-add i 1)) - ((> i n) nil) - (tagbody - (if - (<= - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (ix) ((1 *)) dx-%offset%)))) - dmax) - (go label5)) - (setf idamax i) - (setf dmax - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (ix) ((1 *)) dx-%offset%))))) - label5 - (setf ix (f2cl-lib:int-add ix incx)))) - (go end_label) - label20 - (setf dmax - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (1) ((1 *)) dx-%offset%))))) - (f2cl-lib:fdo (i 2 (f2cl-lib:int-add i 1)) - ((> i n) nil) - (tagbody - (if - (<= - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (i) ((1 *)) dx-%offset%)))) - dmax) - (go label30)) - (setf idamax i) - (setf dmax - (the double-float (abs - (the double-float - (f2cl-lib:fref dx-%data% (i) ((1 *)) dx-%offset%))))) - label30)) - end_label - (return (values idamax nil nil nil))))) + (declare (type (simple-array double-float (*)) dx) + (type fixnum incx n)) + (let ((ix 0) (dmax 0.0) (idamax -1) (limit (length dx))) + (declare (type (double-float) dmax) (type fixnum idamax ix limit)) + (when (and (>= n 1) (> incx 0)) + (setq idamax 0) + (setf dmax (the double-float (abs (the double-float (svref dx 0))))) + (setf ix (the fixnum (+ ix incx))) + (do ((i 1 (+ i 1))) + ((or (>= ix limit) (>= i n))) + (when (> (the double-float (abs (the double-float (svref dx ix)))) dmax) + (setf idamax i) + (setf dmax (the double-float (abs (the double-float (svref dx ix)))))) + (setf ix (the fixnum (+ ix incx))))) + idamax)) \end{chunk} + +\begin{chunk}{BLAS 1 idamax lisp test} +(load "idamax.lisp") +(setq a (vector 3.0d0 4.0d0 -3.0d0 5.0d0 -1.0d0)) +; #(3.0 4.0 -3.0 5.0 -1.0) +(idamax 5 a 1) +; 3 +(idamax 3 a 1) +; 1 +(idamax 0 a 1) +; -1 +(idamax -5 a 1) +; -1 +(idamax 5 a -1) +; -1 +(idamax 5 a 2) +; 0 +(idamax 1 a 0) +; -1 +(idamax 1 a -1) +; -1 +(idamax 1 a 5) +; 0 +(setq a (vector 3.0d0 4.0d0 -3.0d0 -5.0d0 -1.0d0)) +; #(3.0 4.0 -3.0 -5.0 -1.0) +(idamax 5 a 1) +; 3 +\end{chunk} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{isamax BLAS} %\pagehead{isamax}{isamax} @@ -139445,12 +139751,12 @@ Warning: Types of argument 1 in call to ZLARFB do not match. \getchunk{BLAS 1 dzasum} \getchunk{BLAS 1 dznrm2} \getchunk{BLAS 1 icamax} +\getchunk{BLAS 1 idamax} \end{chunk} \begin{chunk}{untested} \getchunk{BLAS lsame} \getchunk{BLAS xerbla} -\getchunk{BLAS 1 idamax} \getchunk{BLAS 1 isamax} \getchunk{BLAS 1 izamax} \getchunk{BLAS 1 zaxpy} diff --git a/changelog b/changelog index 92f8683..3a87d3c 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,5 @@ +20120516 tpd src/axiom-website/patches.html 20120516.01.tpd.patch +20120516 tpd books/bookvol10.5 BLAS1 idamax 20120515 tpd src/axiom-website/patches.html 20120515.01.tpd.patch 20120515 tpd books/bookvol10.5 BLAS1 icamax 0-based fix 20120514 tpd src/axiom-website/patches.html 20120514.01.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 3f9a0f2..12d7430 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3916,5 +3916,7 @@ books/bookvol10.5 BLAS1 dznrm2
books/bookvol10.5 BLAS1 icamax
20120515.01.tpd.patch books/bookvol10.5 BLAS1 icamax 0-based fix
+20120516.01.tpd.patch +books/bookvol10.5 BLAS1 idamax