diff --git a/books/bookvol10.5.pamphlet b/books/bookvol10.5.pamphlet
index 7ef9be3..58a0132 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 148
+--S 1 of 155
 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 148
+--S 2 of 155
 dcabs1(t1)
 --R 
 --R
@@ -396,7 +396,7 @@ dcabs1(t1)
 --R                                                            Type: DoubleFloat
 --E 2
 
---S 3 of 148
+--S 3 of 155
 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 148
+--S 4 of 155
 dcabs1(t2)
 --R 
 --R
@@ -412,7 +412,7 @@ dcabs1(t2)
 --R                                                            Type: DoubleFloat
 --E 4
 
---S 5 of 148
+--S 5 of 155
 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 148
+--S 6 of 155
 dcabs1(t3)
 --R 
 --R
@@ -428,7 +428,7 @@ dcabs1(t3)
 --R                                                            Type: DoubleFloat
 --E 6
 
---S 7 of 148
+--S 7 of 155
 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 148
+--S 8 of 155
 dcabs1(t4)
 --R 
 --R
@@ -444,7 +444,7 @@ dcabs1(t4)
 --R                                                            Type: DoubleFloat
 --E 8
 
---S 9 of 148
+--S 9 of 155
 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 148
+--S 10 of 155
 dcabs1(t5)
 --R 
 --R
@@ -462,196 +462,196 @@ dcabs1(t5)
 
 )clear all
 
---S 11 of 148 
+--S 11 of 155 
 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 148 
+--S 12 of 155 
 dasum(3,a,-1) -- 0.0   neg incx
 --R
 --R   (2)  0.
 --R                                                            Type: DoubleFloat
 --E 12
 
---S 13 of 148 
+--S 13 of 155 
 dasum(3,a,0) --  0.0   zero incx
 --R
 --R   (3)  0.
 --R                                                            Type: DoubleFloat
 --E 13
 
---S 14 of 148 
+--S 14 of 155 
 dasum(-1,a,1) -- 0.0   neg elements
 --R
 --R   (4)  0.
 --R                                                            Type: DoubleFloat
 --E 14
 
---S 15 of 148 
+--S 15 of 155 
 dasum(0,a,1) --  0.0   no elements
 --R
 --R   (5)  0.
 --R                                                            Type: DoubleFloat
 --E 15
 
---S 16 of 148 
+--S 16 of 155 
 dasum(1,a,1) --  1.0   1.0
 --R
 --R   (6)  1.
 --R                                                            Type: DoubleFloat
 --E 16
 
---S 17 of 148 
+--S 17 of 155 
 dasum(2,a,1) --  3.0   1.0+2.0
 --R
 --R   (7)  3.
 --R                                                            Type: DoubleFloat
 --E 17
 
---S 18 of 148 
+--S 18 of 155 
 dasum(3,a,1) --  6.0   1.0+2.0+3.0
 --R
 --R   (8)  6.
 --R                                                            Type: DoubleFloat
 --E 18
 
---S 19 of 148 
+--S 19 of 155 
 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 148 
+--S 20 of 155 
 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 148 
+--S 21 of 155 
 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 148 
+--S 22 of 155 
 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 148 
+--S 23 of 155 
 dasum(1,a,2) --  1.0   1.0
 --R
 --R   (13)  1.
 --R                                                            Type: DoubleFloat
 --E 23
 
---S 24 of 148 
+--S 24 of 155 
 dasum(2,a,2) --  4.0   1.0+3.0
 --R
 --R   (14)  4.
 --R                                                            Type: DoubleFloat
 --E 24
 
---S 25 of 148 
+--S 25 of 155 
 dasum(3,a,2) --  9.0   1.0+3.0+5.0
 --R
 --R   (15)  4.
 --R                                                            Type: DoubleFloat
 --E 25
 
---S 26 of 148 
+--S 26 of 155 
 dasum(4,a,2) --  9.0   1.0+3.0+5.0
 --R
 --R   (16)  4.
 --R                                                            Type: DoubleFloat
 --E 26
 
---S 27 of 148 
+--S 27 of 155 
 dasum(1,a,3) --  1.0   1.0
 --R
 --R   (17)  1.
 --R                                                            Type: DoubleFloat
 --E 27
 
---S 28 of 148 
+--S 28 of 155 
 dasum(2,a,3) --  5.0   1.0+4.0
 --R
 --R   (18)  5.
 --R                                                            Type: DoubleFloat
 --E 28
 
---S 29 of 148 
+--S 29 of 155 
 dasum(3,a,3) --  5.0   1.0+4.0
 --R
 --R   (19)  5.
 --R                                                            Type: DoubleFloat
 --E 29
 
---S 30 of 148 
+--S 30 of 155 
 dasum(1,a,4) --  1.0   1.0
 --R
 --R   (20)  1.
 --R                                                            Type: DoubleFloat
 --E 30
 
---S 31 of 148 
+--S 31 of 155 
 dasum(2,a,4) --  6.0   1.0+5.0
 --R
 --R   (21)  1.
 --R                                                            Type: DoubleFloat
 --E 31
 
---S 32 of 148 
+--S 32 of 155 
 dasum(3,a,4) --  6.0   1.0+5.0
 --R
 --R   (22)  1.
 --R                                                            Type: DoubleFloat
 --E 32
 
---S 33 of 148 
+--S 33 of 155 
 dasum(1,a,5) --  1.0   1.0
 --R
 --R   (23)  1.
 --R                                                            Type: DoubleFloat
 --E 33
 
---S 34 of 148 
+--S 34 of 155 
 dasum(2,a,5) --  7.0   1.0+6.0
 --R
 --R   (24)  6.
 --R                                                            Type: DoubleFloat
 --E 34
 
---S 35 of 148 
+--S 35 of 155 
 dasum(3,a,5) --  7.0   1.0+6.0
 --R
 --R   (25)  6.
 --R                                                            Type: DoubleFloat
 --E 35
 
---S 36 of 148 
+--S 36 of 155 
 dasum(1,a,6) --  1.0   1.0
 --R
 --R   (26)  1.
 --R                                                            Type: DoubleFloat
 --E 36
 
---S 37 of 148 
+--S 37 of 155 
 dasum(2,a,6) --  1.0   1.0
 --R
 --R   (27)  1.
 --R                                                            Type: DoubleFloat
 --E 37
 
---S 38 of 148 
+--S 38 of 155 
 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 148
+--S 39 of 155
 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 148
+--S 40 of 155
 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 148
+--S 41 of 155
 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 148
+--S 42 of 155
 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 148
+--S 43 of 155
 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 148
+--S 44 of 155
 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 148
+--S 45 of 155
 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 148
+--S 46 of 155
 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 148
+--S 47 of 155
 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 148
+--S 48 of 155
 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 148
+--S 49 of 155
 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 148
+--S 50 of 155
 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 148
+--S 51 of 155
 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 148
+--S 52 of 155
 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 148
+--S 53 of 155
 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 148
+--S 54 of 155
 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 148
+--S 55 of 155
 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 148
+--S 56 of 155
 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 148
+--S 57 of 155
 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 148
+--S 58 of 155
 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 148
+--S 59 of 155
 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 148
+--S 60 of 155
 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 148
+--S 61 of 155
 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 148
+--S 62 of 155
 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 148
+--S 63 of 155
 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 148
+--S 64 of 155
 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 148
+--S 65 of 155
 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 148
+--S 66 of 155
 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 148
+--S 67 of 155
 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 148
+--S 68 of 155
 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 148
+--S 69 of 155
 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 148
+--S 70 of 155
 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 148
+--S 71 of 155
 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 148
+--S 72 of 155
 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 148
+--S 73 of 155
 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 148
+--S 74 of 155
 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 148
+--S 75 of 155
 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 148
+--S 76 of 155
 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 148
+--S 77 of 155
 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 148
+--S 78 of 155
 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 148
+--S 79 of 155
 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 148
+--S 80 of 155
 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 148
+--S 81 of 155
 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 148
+--S 82 of 155
 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 148
+--S 83 of 155
 dcopy(5,a,1,b,1)
 --R 
 --R
@@ -1029,63 +1029,63 @@ dcopy(5,a,1,b,1)
 
 )clear all
 
---S 84 of 148
+--S 84 of 155
 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 148
+--S 85 of 155
 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 148
+--S 86 of 155
 ddot(0,a,1,b,1)
 --R
 --R   (3)  0.
 --R                                                            Type: DoubleFloat
 --E 86
 
---S 87 of 148
+--S 87 of 155
 ddot(3,a,1,b,1)
 --R
 --R   (4)  38.
 --R                                                            Type: DoubleFloat
 --E 87
 
---S 88 of 148
+--S 88 of 155
 ddot(3,a,1,b,2)
 --R
 --R   (5)  46.
 --R                                                            Type: DoubleFloat
 --E 88
 
---S 89 of 148
+--S 89 of 155
 ddot(3,a,2,b,1)
 --R
 --R   (6)  58.
 --R                                                            Type: DoubleFloat
 --E 89
 
---S 90 of 148
+--S 90 of 155
 ddot(3,a,1,b,-2)
 --R
 --R   (7)  38.
 --R                                                            Type: DoubleFloat
 --E 90
 
---S 91 of 148
+--S 91 of 155
 ddot(3,a,-2,b,1)
 --R
 --R   (8)  50.
 --R                                                            Type: DoubleFloat
 --E 91
 
---S 92 of 148
+--S 92 of 155
 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 148
+--S 93 of 155
 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 148
+--S 94 of 155
 dnrm2(3,a,1)
 --R
 --R   (2)  7.0710678118654755
 --R                                                            Type: DoubleFloat
 --E 94
 
---S 95 of 148
+--S 95 of 155
 dnrm2(5,a,1)
 --R
 --R   (3)  13.416407864998739
 --R                                                            Type: DoubleFloat
 --E 95
 
---S 96 of 148
+--S 96 of 155
 dnrm2(3,a,2)
 --R
 --R   (4)  10.723805294763608
@@ -1123,7 +1123,7 @@ dnrm2(3,a,2)
 --E 96
 
 )clear all
---S 97 of 148
+--S 97 of 155
 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 148
+--S 98 of 155
 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 148
+--S 99 of 155
 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 148
+--S 100 of 155
 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 148
+--S 101 of 155
 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 148
+--S 102 of 155
 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 148
+--S 103 of 155
 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 148
+--S 104 of 155
 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 148
+--S 105 of 155
 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 148
+--S 106 of 155
 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 148
+--S 107 of 155
 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 148
+--S 108 of 155
 [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 148
+--S 109 of 155
 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 148
+--S 110 of 155
 [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 148
+--S 111 of 155
 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 148
+--S 112 of 155
 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 148
+--S 113 of 155
 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 148
+--S 114 of 155
 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 148
+--S 115 of 155
 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 148
+--S 116 of 155
 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 148
+--S 117 of 155
 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 148
+--S 118 of 155
 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 148
+--S 119 of 155
 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 148
+--S 120 of 155
 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 148
+--S 121 of 155
 [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 148
+--S 122 of 155
 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 148
+--S 123 of 155
 dscal(6,2.0,dx,1)
 --R
 --R   (2)  [2.,4.,6.,8.,10.,12.]
 --R                                            Type: PrimitiveArray(DoubleFloat)
 --E 123
 
---S 124 of 148
+--S 124 of 155
 dx
 --R
 --R   (3)  [2.,4.,6.,8.,10.,12.]
 --R                                            Type: PrimitiveArray(DoubleFloat)
 --E 124
 
---S 125 of 148
+--S 125 of 155
 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 148
+--S 126 of 155
 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 148
+--S 127 of 155
 dx
 --R
 --R   (6)  [0.5,1.,1.5,4.,5.,6.]
@@ -1483,63 +1483,63 @@ dx
 
 )clear all
 
---S 128 of 148
+--S 128 of 155
 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 148
+--S 129 of 155
 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 148
+--S 130 of 155
 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 148
+--S 131 of 155
 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 148
+--S 132 of 155
 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 148
+--S 133 of 155
 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 148
+--S 134 of 155
 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 148
+--S 135 of 155
 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 148
+--S 136 of 155
 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 148
+--S 137 of 155
 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 148
+--S 138 of 155
 dzasum(3,d,1) -- 21.0 
 --R
 --R   (2)  21.
 --R                                                            Type: DoubleFloat
 --E 138
 
---S 139 of 148
+--S 139 of 155
 dzasum(3,d,2) -- 14.0 
 --R
 --R   (3)  14.
 --R                                                            Type: DoubleFloat
 --E 139
 
---S 140 of 148
+--S 140 of 155
 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 148
+--S 141 of 155
 a:PRIMARR(COMPLEX(DFLOAT)):=_
   [[3.+4.*%i, -4.+5.*%i, 5.+6.*%i, 7.-8.*%i, -9.-2.*%i]] 
 --R
@@ -1586,55 +1586,104 @@ a:PRIMARR(COMPLEX(DFLOAT)):=_
 --R                                   Type: PrimitiveArray(Complex(DoubleFloat))
 --E 141
 
---S 142 of 148
+--S 142 of 155
 dznrm2(5,a,1) -- should be 18.028 
 --R
 --R   (2)  18.027756377319946
 --R                                                            Type: DoubleFloat
 --E 142
 
---S 143 of 148
+--S 143 of 155
 dznrm2(3,a,2) -- should be 13.077 
 --R
 --R   (3)  13.076696830622021
 --R                                                            Type: DoubleFloat
 --E 143
 
---S 144 of 148
+--S 144 of 155
 dznrm2(3,a,1) -- should be 11.269 
 --R
 --R   (4)  11.269427669584644
 --R                                                            Type: DoubleFloat
 --E 144
 
---S 145 of 148
+--S 145 of 155
 dznrm2(3,a,-1) -- should be 0.0 
 --R
 --R   (5)  0.
 --R                                                            Type: DoubleFloat
 --E 145
 
---S 146 of 148
+--S 146 of 155
 dznrm2(-3,a,-1) -- should be 0.0 
 --R
 --R   (6)  0.
 --R                                                            Type: DoubleFloat
 --E 146
 
---S 147 of 148
+--S 147 of 155
 dznrm2(1,a,1) -- should be 5.0 
 --R
 --R   (7)  5.
 --R                                                            Type: DoubleFloat
 --E 147
 
---S 148 of 148
+--S 148 of 155
 dznrm2(1,a,2) -- should be 5.0
 --R
 --R   (8)  5.
 --R                                                            Type: DoubleFloat
 --E 148
 
+)clear all
+
+--S 149 of 155
+a:PRIMARR(COMPLEX(FLOAT))
+--R                                                                   Type: Void
+--E 149
+
+--S 150 of 155
+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
+icamax(5,a,1)  -- should be 4
+--R
+--R   (3)  4
+--R                                                        Type: PositiveInteger
+--E 151
+
+--S 152 of 155
+icamax(0,a,1)  -- should be 1
+--R
+--R   (4)  1
+--R                                                        Type: PositiveInteger
+--E 152
+
+--S 153 of 155
+icamax(5,a,-1) -- should be 1
+--R
+--R   (5)  1
+--R                                                        Type: PositiveInteger
+--E 153
+
+--S 154 of 155
+icamax(3,a,1)  -- should be 3
+--R
+--R   (6)  3
+--R                                                        Type: PositiveInteger
+--E 154
+
+--S 155 of 155
+icamax(3,a,2)  -- should be 2 
+--R
+--R   (7)  2
+--R                                                        Type: PositiveInteger
+--E 155
+
 )spool
 )lisp (bye)
 \end{chunk}
@@ -1692,12 +1741,14 @@ o )show BlasLevelOne
 ++ This package provides an interface to the Blas library (level 1)
 BlasLevelOne() : Exports == Implementation where
 
-  SI  ==>  SingleInteger
-  DF  ==>  DoubleFloat
-  DX  ==>  PrimitiveArray(DoubleFloat)
-  CDF ==>  Complex(DoubleFloat)
-  LDX ==>  List(PrimitiveArray(DoubleFloat))
+  SI   ==> SingleInteger
+  INT  ==> Integer
+  DF   ==> DoubleFloat
+  DX   ==> PrimitiveArray(DoubleFloat)
+  CDF  ==> Complex(DoubleFloat)
+  LDX  ==> List(PrimitiveArray(DoubleFloat))
   PCDF ==> PrimitiveArray(Complex(DoubleFloat))
+  PCF  ==> PrimitiveArray(Complex(Float))
 
   Exports == with
 
@@ -1845,6 +1896,18 @@ BlasLevelOne() : Exports == Implementation where
       ++X dznrm2(1,a,1)   -- should be 5.0
       ++X dznrm2(1,a,2)   -- should be 5.0
 
+    icamax: (INT, PCF, INT) -> INT
+      ++ icamax 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(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 
 
   Implementation  == add
 
@@ -1872,6 +1935,9 @@ BlasLevelOne() : Exports == Implementation where
         DZASUMSPAD(n,dz,incx)$Lisp
       dznrm2(n:SI,dz:PCDF,incx:SI):DF ==
         DZNRM2SPAD(n,dz,incx)$Lisp
+      icamax(n:INT,dz:PCF,incx:INT):INT ==
+        ICAMAXSPAD(n,dz,incx)$Lisp
+
 
 \end{chunk}
 \begin{chunk}{BLAS1.dotabb}
@@ -7410,6 +7476,53 @@ code standard so we need to create thunks to do the data translation.
 )set message auto off
 )clear all
 
+--S 1 of 7
+a:PRIMARR(COMPLEX(FLOAT))
+--R                                                                   Type: Void
+--E 1
+
+--S 2 of 7
+a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]]
+--R
+--R   (9)  [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 2
+
+--S 3 of 7
+icamax(5,a,1)  -- should be 4
+--R
+--R   (10)  4
+--R                                                        Type: PositiveInteger
+--E 3
+
+--S 4 of 7
+icamax(0,a,1)  -- should be 1
+--R
+--R   (11)  1
+--R                                                        Type: PositiveInteger
+--E 4
+
+--S 5 of 7
+icamax(5,a,-1) -- should be 1
+--R
+--R   (12)  1
+--R                                                        Type: PositiveInteger
+--E 5
+
+--S 6 of 7
+icamax(3,a,1)  -- should be 3
+--R
+--R   (13)  3
+--R                                                        Type: PositiveInteger
+--E 6
+
+--S 7 of 7
+icamax(3,a,2)  -- should be 2 
+--R
+--R   (14)  2
+--R                                                        Type: PositiveInteger
+--E 7
+
 )spool
 )lisp (bye)
 \end{chunk}
@@ -7418,6 +7531,32 @@ code standard so we need to create thunks to do the data translation.
 icamax examples
 ====================================================================
 
+a:PRIMARR(COMPLEX(FLOAT))
+
+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
+
+  4
+
+icamax(0,a,1)  -- should be 1
+
+  1
+
+icamax(5,a,-1) -- should be 1
+
+  1
+
+icamax(3,a,1)  -- should be 3
+
+  3
+
+icamax(3,a,2)  -- should be 2 
+
+  2
+
 ====================================================================
 Man Page Details
 ====================================================================
@@ -7522,60 +7661,105 @@ c
 
 \end{chunk}
 
+\begin{chunk}{icamax example}
+       program icamaxEX
+*      Tim Daly May 13, 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)
+       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)
+       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) /)
+should be 4
+n=  4
+
+\end{verbatim}
+
+Spad represents complex numbers as a pair where the car is the real
+part and the cons is the imaginary part. BLAS wants a complex number
+in fortran format. So we have a design choice to make. Either we could
+write all of the BLAS code using Spad internal representation or we
+could follow the BLAS code standard. I've decided to follow the BLAS
+code standard so we need to create thunks to do the data translation.
+
+NOTE: The Axiom internal representation of 
+PRIMARR(COMPLEX(FLOAT)) is an array where each array element AE is
+\begin{verbatim}
+   AE = (cons (cons (therealpart 0)) (cons (theimagpart 0)))
+\end{verbatim}
+so we need (caar AE) and (cadr AE) to get the real and imag parts.
+
 \begin{chunk}{BLAS 1 icamax}
-(defun icamax (n cx incx)
-  (declare (type (simple-array (complex single-float) (*)) cx)
-           (type fixnum incx n))
-  (f2cl-lib:with-multi-array-data
-      ((cx (complex single-float) cx-%data% cx-%offset%))
-    (labels ((cabs1 (zdum)
-               (+ (abs (coerce (realpart zdum) 'single-float))
-                       (abs (f2cl-lib:aimag zdum)))))
-      (declare (ftype (function (complex single-float)
-                       (values single-float &rest t))
-                      cabs1))
-      (prog ((zdum #C(0.0f0 0.0f0)) (i 0) (ix 0) (smax 0.0f0) (icamax 0))
-        (declare (type (single-float) smax)
-                 (type fixnum icamax ix i)
-                 (type (complex single-float) zdum))
-        (setf icamax 0)
-        (if (or (< n 1) (<= incx 0)) (go end_label))
-        (setf icamax 1)
-        (if (= n 1) (go end_label))
-        (if (= incx 1) (go label20))
-        (setf ix 1)
-        (setf smax (cabs1 (f2cl-lib:fref cx-%data% (1) ((1 *)) cx-%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
-             (<= (cabs1 (f2cl-lib:fref cx-%data% (ix) ((1 *)) cx-%offset%))
-                 smax)
-             (go label5))
-            (setf icamax i)
-            (setf smax
-                    (cabs1 (f2cl-lib:fref cx-%data% (ix) ((1 *)) cx-%offset%)))
- label5
-            (setf ix (f2cl-lib:int-add ix incx))))
-        (go end_label)
- label20
-        (setf smax (cabs1 (f2cl-lib:fref cx-%data% (1) ((1 *)) cx-%offset%)))
-        (f2cl-lib:fdo (i 2 (f2cl-lib:int-add i 1))
-                      ((> i n) nil)
-          (tagbody
-            (if
-             (<= (cabs1 (f2cl-lib:fref cx-%data% (i) ((1 *)) cx-%offset%))
-                 smax)
-             (go label30))
-            (setf icamax i)
-            (setf smax
-                    (cabs1 (f2cl-lib:fref cx-%data% (i) ((1 *)) cx-%offset%)))
- label30))
- end_label
-        (return (values icamax nil nil nil))))))
+(defun icamaxSpad (n zx incx)
+; Tim Daly May 13, 2012
+ (let (result vec)
+  (dotimes (i (length zx))
+   (push (complex 
+          (coerce (caar (svref zx i)) 'single-float)
+          (coerce (cadr (svref zx i))'single-float)) result))
+  (setq vec (make-array (length result) :initial-contents (nreverse result)
+                        :element-type '(complex single-float)))
+  (icamax n vec incx)))
 
+(defun icamax (n cx incx)
+ (declare (type (simple-array (complex single-float) (*)) cx)
+          (type fixnum incx n))
+ (labels (
+  (cabs1 (zdum)
+   (the single-float 
+    (+ (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 1) (limit (length cx)))
+  (declare (type (single-float) smax) (type fixnum icamax ix limit))
+  (when (and (> n 1) (> incx 0))
+   (setf smax (the single-float (cabs1 (svref cx 0))))
+   (setf ix (the fixnum (+ ix incx)))
+   (do ((i 2 (+ i 1)))
+       ((or (>= i limit) (> i n)))
+     (when (> (cabs1 (the (complex single-float) (svref cx ix)))
+              smax)
+      (setf icamax i)
+      (setf smax (cabs1 (svref cx ix))))
+     (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))
+(icamax 5 a 1)
+; 4
+(icamax 0 a 1)
+; 1
+(icamax 5 a -1)
+; 1
+(icamax 3 a 1)
+; 3
+(icamax 3 a 2)
+; 2
 \end{chunk}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{idamax BLAS}
 %\pagehead{idamax}{idamax}
@@ -139207,12 +139391,12 @@ Warning:  Types of argument 1 in call to ZLARFB do not match.
 \getchunk{BLAS 1 dswap}
 \getchunk{BLAS 1 dzasum}
 \getchunk{BLAS 1 dznrm2}
+\getchunk{BLAS 1 icamax}
 \end{chunk}
 \begin{chunk}{untested}
 \getchunk{BLAS lsame}
 \getchunk{BLAS xerbla}
 
-\getchunk{BLAS 1 icamax}
 \getchunk{BLAS 1 idamax}
 \getchunk{BLAS 1 isamax}
 \getchunk{BLAS 1 izamax}
diff --git a/changelog b/changelog
index 673b835..857a77d 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,5 @@
+20120514 tpd src/axiom-website/patches.html 20120514.01.tpd.patch
+20120514 tpd books/bookvol10.5 BLAS1 icamax
 20120508 tpd src/axiom-website/patches.html 20120508.01.tpd.patch
 20120508 tpd books/bookvolbib update references
 20120508 tpd books/bookvolbib.bib update references
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index e79d5af..eac4a1a 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -3912,5 +3912,7 @@ books/bookvol10.5 BLAS1 dswap<br/>
 books/bookvol10.5 BLAS1 dzasum<br/>
 <a href="patches/20120508.01.tpd.patch">20120508.01.tpd.patch</a>
 books/bookvol10.5 BLAS1 dznrm2<br/>
+<a href="patches/20120514.01.tpd.patch">20120514.01.tpd.patch</a>
+books/bookvol10.5 BLAS1 icamax<br/>
  </body>
 </html>
