diff --git a/books/bookvol10.5.pamphlet b/books/bookvol10.5.pamphlet index 62240ec..7ef9be3 100644 --- a/books/bookvol10.5.pamphlet +++ b/books/bookvol10.5.pamphlet @@ -337,6 +337,38 @@ and may be passed as character strings. They mean: For real matrices, TRANSx=T and TRANSx=C have the same meaning. For Hermitian matrices, TRANSx=T is not allowed. For complex symmetric matrices, TRANSx=H is not allowed. + +There were 38 BLAS Level 1 routines defined in \cite{REF-LAW79}. They are +\begin{itemize} +\item Dot product SDSDOT, DSDOT, DQ-IDOT DQ-ADOT C-UDOT C-CDOT DDOT SDOT +\item Constant times a vector plus a vector CAXPY DAXPY SAXPY +\item Set up Givens rotation DROTG SROTG +\item Apply rotation DROT SROT +\item Set up modified Givens rotation DROTMG SROTMG +\item Apply modified rotation DROTM SROTM +\item Copy x into y CCOPY DCOPY SCOPY +\item Sway x and y CSWAP DSWAP SSWAP +\item 2-norm (Euclidean length) SCNRM2 DNRM2 SNRM2 +\item Sum of absolute values SCASUM DASUM SASUM +\item Constant times a vector CSSCAL CSCAL DSCAL SSCAL +\item Index of maximum element ICAMAX IDAMAX ISAMAX +\end{itemize} +where +\begin{itemize} +\item I Integer +\item S Single Precision +\item D Double Precision +\item C Single Precision Complex +\item Q extended precision +\item Z COMPLEX*16 +\end{itemize} + +Vector arguments are permitted to have a storage spacing between elements. +This spacing is specified by an increment parameter. For example, suppose +a vector $x$ having components $x_i$, $i=1,ldots,N$ is stored in a DOUBLE +PRECISION array DX() with increment parameter INCX. If $INCX \ge 0$ then +$x_i$ is stored in $DX(1 + (i-1)*INCX)$. If $INCX < 0$ then $x_i$ is +stored in $DX(1+ (N-1)*|INCX|)$. \chapter{Algebra Cover Code} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{package BLAS1 BlasLevelOne} @@ -348,7 +380,7 @@ For complex symmetric matrices, TRANSx=H is not allowed. )set message auto off )clear all ---S 1 of 140 +--S 1 of 148 t1:Complex DoubleFloat := complex(1.0,0) --R --R @@ -356,7 +388,7 @@ t1:Complex DoubleFloat := complex(1.0,0) --R Type: Complex(DoubleFloat) --E 1 ---S 2 of 140 +--S 2 of 148 dcabs1(t1) --R --R @@ -364,7 +396,7 @@ dcabs1(t1) --R Type: DoubleFloat --E 2 ---S 3 of 140 +--S 3 of 148 t2:Complex DoubleFloat := complex(1.0,1.0) --R --R @@ -372,7 +404,7 @@ t2:Complex DoubleFloat := complex(1.0,1.0) --R Type: Complex(DoubleFloat) --E 3 ---S 4 of 140 +--S 4 of 148 dcabs1(t2) --R --R @@ -380,7 +412,7 @@ dcabs1(t2) --R Type: DoubleFloat --E 4 ---S 5 of 140 +--S 5 of 148 t3:Complex DoubleFloat := complex(1.0,-1.0) --R --R @@ -388,7 +420,7 @@ t3:Complex DoubleFloat := complex(1.0,-1.0) --R Type: Complex(DoubleFloat) --E 5 ---S 6 of 140 +--S 6 of 148 dcabs1(t3) --R --R @@ -396,7 +428,7 @@ dcabs1(t3) --R Type: DoubleFloat --E 6 ---S 7 of 140 +--S 7 of 148 t4:Complex DoubleFloat := complex(-1.0,-1.0) --R --R @@ -404,7 +436,7 @@ t4:Complex DoubleFloat := complex(-1.0,-1.0) --R Type: Complex(DoubleFloat) --E 7 ---S 8 of 140 +--S 8 of 148 dcabs1(t4) --R --R @@ -412,7 +444,7 @@ dcabs1(t4) --R Type: DoubleFloat --E 8 ---S 9 of 140 +--S 9 of 148 t5:Complex DoubleFloat := complex(-2.0,-2.0) --R --R @@ -420,7 +452,7 @@ t5:Complex DoubleFloat := complex(-2.0,-2.0) --R Type: Complex(DoubleFloat) --E 9 ---S 10 of 140 +--S 10 of 148 dcabs1(t5) --R --R @@ -430,196 +462,196 @@ dcabs1(t5) )clear all ---S 11 of 140 +--S 11 of 148 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 140 +--S 12 of 148 dasum(3,a,-1) -- 0.0 neg incx --R --R (2) 0. --R Type: DoubleFloat --E 12 ---S 13 of 140 +--S 13 of 148 dasum(3,a,0) -- 0.0 zero incx --R --R (3) 0. --R Type: DoubleFloat --E 13 ---S 14 of 140 +--S 14 of 148 dasum(-1,a,1) -- 0.0 neg elements --R --R (4) 0. --R Type: DoubleFloat --E 14 ---S 15 of 140 +--S 15 of 148 dasum(0,a,1) -- 0.0 no elements --R --R (5) 0. --R Type: DoubleFloat --E 15 ---S 16 of 140 +--S 16 of 148 dasum(1,a,1) -- 1.0 1.0 --R --R (6) 1. --R Type: DoubleFloat --E 16 ---S 17 of 140 +--S 17 of 148 dasum(2,a,1) -- 3.0 1.0+2.0 --R --R (7) 3. --R Type: DoubleFloat --E 17 ---S 18 of 140 +--S 18 of 148 dasum(3,a,1) -- 6.0 1.0+2.0+3.0 --R --R (8) 6. --R Type: DoubleFloat --E 18 ---S 19 of 140 +--S 19 of 148 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 140 +--S 20 of 148 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 140 +--S 21 of 148 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 140 +--S 22 of 148 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 140 +--S 23 of 148 dasum(1,a,2) -- 1.0 1.0 --R --R (13) 1. --R Type: DoubleFloat --E 23 ---S 24 of 140 +--S 24 of 148 dasum(2,a,2) -- 4.0 1.0+3.0 --R --R (14) 4. --R Type: DoubleFloat --E 24 ---S 25 of 140 +--S 25 of 148 dasum(3,a,2) -- 9.0 1.0+3.0+5.0 --R --R (15) 4. --R Type: DoubleFloat --E 25 ---S 26 of 140 +--S 26 of 148 dasum(4,a,2) -- 9.0 1.0+3.0+5.0 --R --R (16) 4. --R Type: DoubleFloat --E 26 ---S 27 of 140 +--S 27 of 148 dasum(1,a,3) -- 1.0 1.0 --R --R (17) 1. --R Type: DoubleFloat --E 27 ---S 28 of 140 +--S 28 of 148 dasum(2,a,3) -- 5.0 1.0+4.0 --R --R (18) 5. --R Type: DoubleFloat --E 28 ---S 29 of 140 +--S 29 of 148 dasum(3,a,3) -- 5.0 1.0+4.0 --R --R (19) 5. --R Type: DoubleFloat --E 29 ---S 30 of 140 +--S 30 of 148 dasum(1,a,4) -- 1.0 1.0 --R --R (20) 1. --R Type: DoubleFloat --E 30 ---S 31 of 140 +--S 31 of 148 dasum(2,a,4) -- 6.0 1.0+5.0 --R --R (21) 1. --R Type: DoubleFloat --E 31 ---S 32 of 140 +--S 32 of 148 dasum(3,a,4) -- 6.0 1.0+5.0 --R --R (22) 1. --R Type: DoubleFloat --E 32 ---S 33 of 140 +--S 33 of 148 dasum(1,a,5) -- 1.0 1.0 --R --R (23) 1. --R Type: DoubleFloat --E 33 ---S 34 of 140 +--S 34 of 148 dasum(2,a,5) -- 7.0 1.0+6.0 --R --R (24) 6. --R Type: DoubleFloat --E 34 ---S 35 of 140 +--S 35 of 148 dasum(3,a,5) -- 7.0 1.0+6.0 --R --R (25) 6. --R Type: DoubleFloat --E 35 ---S 36 of 140 +--S 36 of 148 dasum(1,a,6) -- 1.0 1.0 --R --R (26) 1. --R Type: DoubleFloat --E 36 ---S 37 of 140 +--S 37 of 148 dasum(2,a,6) -- 1.0 1.0 --R --R (27) 1. --R Type: DoubleFloat --E 37 ---S 38 of 140 +--S 38 of 148 dasum(1,a,7) -- 1.0 1.0 --R --R (28) 1. @@ -628,7 +660,7 @@ dasum(1,a,7) -- 1.0 1.0 )clear all ---S 39 of 140 +--S 39 of 148 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -636,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 140 +--S 40 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -644,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 140 +--S 41 of 148 daxpy(3,2.0,a,1,b,1) --R --R @@ -652,7 +684,7 @@ daxpy(3,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 41 ---S 42 of 140 +--S 42 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -660,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 140 +--S 43 of 148 daxpy(7,2.0,a,1,b,1) --R --R @@ -668,7 +700,7 @@ daxpy(7,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 43 ---S 44 of 140 +--S 44 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -681,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 140 +--S 45 of 148 daxpy(8,2.0,a,1,b,1) --R --R @@ -689,7 +721,7 @@ daxpy(8,2.0,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 45 ---S 46 of 140 +--S 46 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -697,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 140 +--S 47 of 148 daxpy(3,2.0,a,3,b,3) --R --R @@ -705,7 +737,7 @@ daxpy(3,2.0,a,3,b,3) --R Type: PrimitiveArray(DoubleFloat) --E 47 ---S 48 of 140 +--S 48 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -713,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 140 +--S 49 of 148 daxpy(4,2.0,a,2,b,2) --R --R @@ -721,7 +753,7 @@ daxpy(4,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 49 ---S 50 of 140 +--S 50 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -729,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 140 +--S 51 of 148 daxpy(5,2.0,a,2,b,2) --R --R @@ -737,7 +769,7 @@ daxpy(5,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 51 ---S 52 of 140 +--S 52 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -745,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 140 +--S 53 of 148 daxpy(3,2.0,a,2,b,2) --R --R @@ -753,7 +785,7 @@ daxpy(3,2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 53 ---S 54 of 140 +--S 54 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -761,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 140 +--S 55 of 148 daxpy(3,-2.0,a,2,b,2) --R --R @@ -769,7 +801,7 @@ daxpy(3,-2.0,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 55 ---S 56 of 140 +--S 56 of 148 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -777,7 +809,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 56 ---S 57 of 140 +--S 57 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -785,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 140 +--S 58 of 148 daxpy(3,-2.0,a,1,b,2) --R --R @@ -793,7 +825,7 @@ daxpy(3,-2.0,a,1,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 58 ---S 59 of 140 +--S 59 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -801,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 140 +--S 60 of 148 daxpy(3,0.0,a,1,b,2) --R --R @@ -811,7 +843,7 @@ daxpy(3,0.0,a,1,b,2) )clear all ---S 61 of 140 +--S 61 of 148 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] ] --R --R @@ -819,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 140 +--S 62 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -827,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 140 +--S 63 of 148 dcopy(3,a,1,b,1) --R --R @@ -835,7 +867,7 @@ dcopy(3,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 63 ---S 64 of 140 +--S 64 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -843,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 140 +--S 65 of 148 dcopy(7,a,1,b,1) --R --R @@ -851,7 +883,7 @@ dcopy(7,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 65 ---S 66 of 140 +--S 66 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -859,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 140 +--S 67 of 148 dcopy(8,a,1,b,1) --R --R @@ -867,7 +899,7 @@ dcopy(8,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 67 ---S 68 of 140 +--S 68 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -875,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 140 +--S 69 of 148 dcopy(3,a,3,b,3) --R --R @@ -883,7 +915,7 @@ dcopy(3,a,3,b,3) --R Type: PrimitiveArray(DoubleFloat) --E 69 ---S 70 of 140 +--S 70 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -891,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 140 +--S 71 of 148 dcopy(4,a,2,b,2) --R --R @@ -899,7 +931,7 @@ dcopy(4,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 71 ---S 72 of 140 +--S 72 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -907,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 140 +--S 73 of 148 dcopy(5,a,2,b,2) --R --R @@ -915,7 +947,7 @@ dcopy(5,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 73 ---S 74 of 140 +--S 74 of 148 b:PRIMARR(DFLOAT):=[ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ] --R --R @@ -923,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 140 +--S 75 of 148 dcopy(3,a,2,b,2) --R --R @@ -931,7 +963,7 @@ dcopy(3,a,2,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 75 ---S 76 of 140 +--S 76 of 148 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -939,7 +971,7 @@ a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 76 ---S 77 of 140 +--S 77 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -947,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 140 +--S 78 of 148 dcopy(3,a,1,b,1) --R --R @@ -955,7 +987,7 @@ dcopy(3,a,1,b,1) --R Type: PrimitiveArray(DoubleFloat) --E 78 ---S 79 of 140 +--S 79 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -963,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 140 +--S 80 of 148 dcopy(3,a,1,b,2) --R --R @@ -971,7 +1003,7 @@ dcopy(3,a,1,b,2) --R Type: PrimitiveArray(DoubleFloat) --E 80 ---S 81 of 140 +--S 81 of 148 a:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0, 4.0, 5.0] ] --R --R @@ -979,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 140 +--S 82 of 148 b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R --R @@ -987,7 +1019,7 @@ b:PRIMARR(DFLOAT):=[ [ 1.0, 2.0, 3.0] ] --R Type: PrimitiveArray(DoubleFloat) --E 82 ---S 83 of 140 +--S 83 of 148 dcopy(5,a,1,b,1) --R --R @@ -997,63 +1029,63 @@ dcopy(5,a,1,b,1) )clear all ---S 84 of 140 +--S 84 of 148 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 140 +--S 85 of 148 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 140 +--S 86 of 148 ddot(0,a,1,b,1) --R --R (3) 0. --R Type: DoubleFloat --E 86 ---S 87 of 140 +--S 87 of 148 ddot(3,a,1,b,1) --R --R (4) 38. --R Type: DoubleFloat --E 87 ---S 88 of 140 +--S 88 of 148 ddot(3,a,1,b,2) --R --R (5) 46. --R Type: DoubleFloat --E 88 ---S 89 of 140 +--S 89 of 148 ddot(3,a,2,b,1) --R --R (6) 58. --R Type: DoubleFloat --E 89 ---S 90 of 140 +--S 90 of 148 ddot(3,a,1,b,-2) --R --R (7) 38. --R Type: DoubleFloat --E 90 ---S 91 of 140 +--S 91 of 148 ddot(3,a,-2,b,1) --R --R (8) 50. --R Type: DoubleFloat --E 91 ---S 92 of 140 +--S 92 of 148 ddot(3,a,-2,b,-2) --R --R (9) 71. @@ -1062,28 +1094,28 @@ ddot(3,a,-2,b,-2) )clear all ---S 93 of 140 +--S 93 of 148 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 140 +--S 94 of 148 dnrm2(3,a,1) --R --R (2) 7.0710678118654755 --R Type: DoubleFloat --E 94 ---S 95 of 140 +--S 95 of 148 dnrm2(5,a,1) --R --R (3) 13.416407864998739 --R Type: DoubleFloat --E 95 ---S 96 of 140 +--S 96 of 148 dnrm2(3,a,2) --R --R (4) 10.723805294763608 @@ -1091,7 +1123,7 @@ dnrm2(3,a,2) --E 96 )clear all ---S 97 of 140 +--S 97 of 148 a:MATRIX(DFLOAT):=[[6,5,0],[5,1,4],[0,4,3]] --R --R +6. 5. 0.+ @@ -1102,7 +1134,7 @@ a:MATRIX(DFLOAT):=[[6,5,0],[5,1,4],[0,4,3]] --R Type: Matrix(DoubleFloat) --E 97 ---S 98 of 140 +--S 98 of 148 t1:=drotg(elt(a,1,1),elt(a,1,2),0.0,0.0) --R --R (2) @@ -1111,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 140 +--S 99 of 148 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]] @@ -1125,7 +1157,7 @@ g1:MATRIX(DFLOAT):=[[elt(t1,2), elt(t1,3),0.0],_ --R Type: Matrix(DoubleFloat) --E 99 ---S 100 of 140 +--S 100 of 148 t2:=g1*a --R --R + 7.810249675906654 4.4812907976513596 2.5607375986579197+ @@ -1136,7 +1168,7 @@ t2:=g1*a --R Type: Matrix(DoubleFloat) --E 100 ---S 101 of 140 +--S 101 of 148 t3:=drotg(elt(t2,2,2),elt(a,3,2),0.0,0.0) --R --R (5) @@ -1145,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 140 +--S 102 of 148 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)]] @@ -1159,7 +1191,7 @@ g2:MATRIX(DFLOAT):=[[1.0, 0.0, 0.0],_ --R Type: Matrix(DoubleFloat) --E 102 ---S 103 of 140 +--S 103 of 148 g2*g1*a --R --R + 7.810249675906654 4.4812907976513596 2.5607375986579197 + @@ -1170,7 +1202,7 @@ g2*g1*a --R Type: Matrix(DoubleFloat) --E 103 ---S 104 of 140 +--S 104 of 148 q:=transpose(g1)*transpose(g2) --R --R +0.76822127959737585 0.33265417936007158 0.54697098874441952 + @@ -1183,21 +1215,21 @@ q:=transpose(g1)*transpose(g2) )clear all ---S 105 of 140 +--S 105 of 148 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 140 +--S 106 of 148 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 140 +--S 107 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R --R (3) @@ -1212,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 140 +--S 108 of 148 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (4) @@ -1227,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 140 +--S 109 of 148 drot(5,dx,1,dy,1,0.707106781,-0.707106781) -- rotate by -45 degrees --R --R (5) @@ -1242,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 140 +--S 110 of 148 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (6) @@ -1257,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 140 +--S 111 of 148 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 140 +--S 112 of 148 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 140 +--S 113 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate by 45 degrees --R --R (9) @@ -1286,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 140 +--S 114 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 90 degrees --R --R (10) @@ -1301,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 140 +--S 115 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 135 degrees --R --R (11) @@ -1316,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 140 +--S 116 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 180 degrees --R --R (12) @@ -1331,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 140 +--S 117 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 225 degrees --R --R (13) @@ -1346,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 140 +--S 118 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 270 degrees --R --R (14) @@ -1361,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 140 +--S 119 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 315 degrees --R --R (15) @@ -1376,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 140 +--S 120 of 148 drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 360 degrees --R --R (16) @@ -1391,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 140 +--S 121 of 148 [dx,dy] -- note that the input arguments, dx and dy were modified --R --R (17) @@ -1407,42 +1439,42 @@ drot(5,dx,1,dy,1,0.707106781,0.707106781) -- rotate to 360 degrees --E 121 )clear all ---S 122 of 140 +--S 122 of 148 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 140 +--S 123 of 148 dscal(6,2.0,dx,1) --R --R (2) [2.,4.,6.,8.,10.,12.] --R Type: PrimitiveArray(DoubleFloat) --E 123 ---S 124 of 140 +--S 124 of 148 dx --R --R (3) [2.,4.,6.,8.,10.,12.] --R Type: PrimitiveArray(DoubleFloat) --E 124 ---S 125 of 140 +--S 125 of 148 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 140 +--S 126 of 148 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 140 +--S 127 of 148 dx --R --R (6) [0.5,1.,1.5,4.,5.,6.] @@ -1451,63 +1483,63 @@ dx )clear all ---S 128 of 140 +--S 128 of 148 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 140 +--S 129 of 148 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 140 +--S 130 of 148 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 140 +--S 131 of 148 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 140 +--S 132 of 148 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 140 +--S 133 of 148 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 140 +--S 134 of 148 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 140 +--S 135 of 148 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 140 +--S 136 of 148 dswap(5,dx,1,dy,-1) --R --R (9) [[9.,8.,7.,6.,- 5.],[1.,2.,3.,4.,5.]] @@ -1516,34 +1548,93 @@ dswap(5,dx,1,dy,-1) )clear all ---S 137 of 140 +--S 137 of 148 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 140 +--S 138 of 148 dzasum(3,d,1) -- 21.0 --R --R (2) 21. --R Type: DoubleFloat --E 138 ---S 139 of 140 +--S 139 of 148 dzasum(3,d,2) -- 14.0 --R --R (3) 14. --R Type: DoubleFloat --E 139 ---S 140 of 140 +--S 140 of 148 dzasum(-3,d,1) -- 0.0 --R --R (4) 0. --R Type: DoubleFloat --E 140 +)clear all + +--S 141 of 148 +a:PRIMARR(COMPLEX(DFLOAT)):=_ + [[3.+4.*%i, -4.+5.*%i, 5.+6.*%i, 7.-8.*%i, -9.-2.*%i]] +--R +--R (1) [3. + 4. %i,- 4. + 5. %i,5. + 6. %i,7. - 8. %i,- 9. - 2. %i] +--R Type: PrimitiveArray(Complex(DoubleFloat)) +--E 141 + +--S 142 of 148 +dznrm2(5,a,1) -- should be 18.028 +--R +--R (2) 18.027756377319946 +--R Type: DoubleFloat +--E 142 + +--S 143 of 148 +dznrm2(3,a,2) -- should be 13.077 +--R +--R (3) 13.076696830622021 +--R Type: DoubleFloat +--E 143 + +--S 144 of 148 +dznrm2(3,a,1) -- should be 11.269 +--R +--R (4) 11.269427669584644 +--R Type: DoubleFloat +--E 144 + +--S 145 of 148 +dznrm2(3,a,-1) -- should be 0.0 +--R +--R (5) 0. +--R Type: DoubleFloat +--E 145 + +--S 146 of 148 +dznrm2(-3,a,-1) -- should be 0.0 +--R +--R (6) 0. +--R Type: DoubleFloat +--E 146 + +--S 147 of 148 +dznrm2(1,a,1) -- should be 5.0 +--R +--R (7) 5. +--R Type: DoubleFloat +--E 147 + +--S 148 of 148 +dznrm2(1,a,2) -- should be 5.0 +--R +--R (8) 5. +--R Type: DoubleFloat +--E 148 + )spool )lisp (bye) \end{chunk} @@ -1740,6 +1831,21 @@ BlasLevelOne() : Exports == Implementation where ++X dzasum(3,d,2) -- 14.0 ++X dzasum(-3,d,1) -- 0.0 + dznrm2: (SI, PCDF, SI) -> DF + ++ dznrm2 returns the norm of a complex vector. It computes + ++ sqrt(sum(v*conjugate(v))) + ++ + ++X a:PRIMARR(COMPLEX(DFLOAT)) + ++X a:=[[3.+4.*%i,-4.+5.*%i,5.+6.*%i,7.-8.*%i,-9.-2.*%i]] + ++X dznrm2(5,a,1) -- should be 18.028 + ++X dznrm2(3,a,2) -- should be 13.077 + ++X dznrm2(3,a,1) -- should be 11.269 + ++X dznrm2(3,a,-1) -- should be 0.0 + ++X dznrm2(-3,a,-1) -- should be 0.0 + ++X dznrm2(1,a,1) -- should be 5.0 + ++X dznrm2(1,a,2) -- should be 5.0 + + Implementation == add dcabs1(z:CDF):DF == @@ -1764,6 +1870,8 @@ BlasLevelOne() : Exports == Implementation where DSWAP(n,dx,incx,dy,incx)$Lisp dzasum(n:SI,dz:PCDF,incx:SI):DF == DZASUMSPAD(n,dz,incx)$Lisp + dznrm2(n:SI,dz:PCDF,incx:SI):DF == + DZNRM2SPAD(n,dz,incx)$Lisp \end{chunk} \begin{chunk}{BLAS1.dotabb} @@ -6917,6 +7025,63 @@ code standard so we need to create thunks to do the data translation. )set message auto off )clear all +--S 1 of 8 +a:PRIMARR(COMPLEX(DFLOAT)):=_ + [[3.+4.*%i, -4.+5.*%i, 5.+6.*%i, 7.-8.*%i, -9.-2.*%i]] +--R +--R (1) [3. + 4. %i,- 4. + 5. %i,5. + 6. %i,7. - 8. %i,- 9. - 2. %i] +--R Type: PrimitiveArray(Complex(DoubleFloat)) +--E 1 + +--S 2 of 8 +dznrm2(5,a,1) -- should be 18.028 +--R +--R (2) 18.027756377319946 +--R Type: DoubleFloat +--E 2 + +--S 3 of 8 +dznrm2(3,a,2) -- should be 13.077 +--R +--R (3) 13.076696830622021 +--R Type: DoubleFloat +--E 3 + +--S 4 of 8 +dznrm2(3,a,1) -- should be 11.269 +--R +--R (4) 11.269427669584644 +--R Type: DoubleFloat +--E 4 + +--S 5 of 8 +dznrm2(3,a,-1) -- should be 0.0 +--R +--R (5) 0. +--R Type: DoubleFloat +--E 5 + +--S 6 of 8 +dznrm2(-3,a,-1) -- should be 0.0 +--R +--R (6) 0. +--R Type: DoubleFloat +--E 6 + +--S 7 of 8 +dznrm2(1,a,1) -- should be 5.0 +--R +--R (7) 5. +--R Type: DoubleFloat +--E 7 + +--S 8 of 8 +dznrm2(1,a,2) -- should be 5.0 +--R +--R (8) 5. +--R Type: DoubleFloat +--E 8 + )spool )lisp (bye) \end{chunk} @@ -6925,6 +7090,46 @@ code standard so we need to create thunks to do the data translation. dznrm2 examples ==================================================================== +dznrm2 computes the complex norm of the input vector. +For each element it computes the sum + a.i*conjugate(a.i) +for all i. Then it returns the square root of the final sum. + +If the count or increment are negative, the result is 0.0 + + +a:PRIMARR(COMPLEX(DFLOAT)):=_ + [[3.+4.*%i, -4.+5.*%i, 5.+6.*%i, 7.-8.*%i, -9.-2.*%i]] + + [3. + 4. %i,- 4. + 5. %i,5. + 6. %i,7. - 8. %i,- 9. - 2. %i] + +dznrm2(5,a,1) + + 18.027756377319946 + +dznrm2(3,a,2) + + 13.076696830622021 + +dznrm2(3,a,1) + + 11.269427669584644 + +dznrm2(3,a,-1) + + 0. + +dznrm2(-3,a,-1) + + 0. + +dznrm2(1,a,1) + + 5. + +dznrm2(1,a,2) + 5. + ==================================================================== Man Page Details ==================================================================== @@ -7045,65 +7250,153 @@ NOTES \end{chunk} +\begin{chunk}{dznrm2 example} + program dznrm2EX +* Tim Daly May 8, 2012 +* unit tests for BLAS dznrm2 + complex*16 a(5) + double precision c + a(1) = ( 3.0D0, 4.0D0) + a(2) = (-4.0D0, 5.0D0) + a(3) = ( 5.0D0, 6.0D0) + a(4) = ( 7.0D0,-8.0D0) + a(5) = (-9.0D0,-2.0D0) + 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") /)") + c=dznrm2(5,a,1) + write(6,200)c + 200 format("should be 18.028",/,"c=",f6.3) + c=dznrm2(3,a,2) + write(6,201)c + 201 format("should be 13.077",/,"c=",f6.3) + c=dznrm2(3,a,1) + write(6,202)c + 202 format("should be 11.269",/,"c=",f6.3) + c=dznrm2(3,a,-1) + write(6,203)c + 203 format("should be 0.000",/,"c=",f6.3) + c=dznrm2(-3,a,-1) + write(6,204)c + 204 format("should be 0.000",/,"c=",f6.3) + c=dznrm2(1,a,1) + write(6,205)c + 205 format("should be 5.000",/,"c=",f6.3) + c=dznrm2(1,a,2) + write(6,206)c + 206 format("should be 5.000",/,"c=",f6.3) + stop + end +\end{chunk} + +\begin{verbatim} +gcc -o dznrm2EX dznrm2EX.f -lgfortran dznrm2.o && ./dznrm2EX +a=(/ ( 3.000 4.000),(-4.000 5.000),( 5.000 6.000), + ( 7.000-8.000),(-9.000-2.000) /) +should be 18.028 +c=18.028 +should be 13.077 +c=13.077 +should be 11.269 +c=11.269 +should be 0.000 +c= 0.000 +should be 0.000 +c= 0.000 +should be 5.000 +c= 5.000 +should be 5.000 +c= 5.000 +\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. + \begin{chunk}{BLAS 1 dznrm2} -(let* ((one 1.0) (zero 0.0)) - (declare (type (double-float 1.0 1.0) one) - (type (double-float 0.0 0.0) zero)) - (defun dznrm2 (n x incx) - (declare (type (simple-array (complex double-float) (*)) x) - (type fixnum incx n)) - (f2cl-lib:with-multi-array-data - ((x (complex double-float) x-%data% x-%offset%)) - (prog ((norm 0.0) (scale 0.0) (ssq 0.0) (temp 0.0) (ix 0) (dznrm2 0.0)) - (declare (type fixnum ix) - (type (double-float) norm scale ssq temp dznrm2)) - (cond - ((or (< n 1) (< incx 1)) - (setf norm zero)) - (t - (setf scale zero) - (setf ssq one) - (f2cl-lib:fdo (ix 1 (f2cl-lib:int-add ix incx)) - ((> ix - (f2cl-lib:int-add 1 - (f2cl-lib:int-mul - (the fixnum (1- n)) - incx))) - nil) - (tagbody - (cond - ((/= - (coerce (realpart (f2cl-lib:fref x (ix) ((1 *)))) 'double-float) - zero) - (setf temp - (abs - (coerce (realpart - (f2cl-lib:fref x-%data% (ix) ((1 *)) x-%offset%)) - 'double-float))) - (cond - ((< scale temp) - (setf ssq (+ one (* ssq (expt (/ scale temp) 2)))) - (setf scale temp)) - (t - (setf ssq (+ ssq (expt (/ temp scale) 2))))))) - (cond - ((/= (f2cl-lib:dimag (f2cl-lib:fref x (ix) ((1 *)))) zero) - (setf temp - (abs - (f2cl-lib:dimag - (f2cl-lib:fref x-%data% (ix) ((1 *)) x-%offset%)))) - (cond - ((< scale temp) - (setf ssq (+ one (* ssq (expt (/ scale temp) 2)))) - (setf scale temp)) - (t - (setf ssq (+ ssq (expt (/ temp scale) 2))))))))) - (setf norm (* scale (f2cl-lib:fsqrt ssq))))) - (setf dznrm2 norm) - end_label - (return (values dznrm2 nil nil nil)))))) +(defun dznrm2Spad (n zx incx) +; Tim Daly May 8, 2012 + (let (result vec) + (dotimes (i (length zx)) + (push (complex (car (svref zx i)) (cdr (svref zx i))) result)) + (setq vec (make-array (length result) :initial-contents (nreverse result))) + (dznrm2 n vec incx))) +(defun dznrm2 (n x incx) +; Tim Daly May 8, 2012 + (declare (type (simple-array (complex double-float) (*)) x) + (type fixnum incx n)) + (let ((scale 0.0d0) (ssq 0.0d0) (temp 0.0d0) + (dznrm2 0.0d0) (limitx (min (* n incx) (length x)))) + (declare (type fixnum limitx) (type (double-float) scale ssq temp dznrm2)) + (when (and (>= n 1) (>= incx 1)) + (do ((ix 0 (the fixnum (+ ix incx)))) + ((>= ix limitx)) + (when (/= (the double-float (realpart + (the (complex double-float) (svref x ix)))) + 0.0d0) + (setf temp + (the double-float (abs + (the double-float (realpart + (the (complex double-float) (svref x ix))))))) + (cond + ((< scale temp) + (setf ssq (+ 1.0d0 + (the double-float (* + ssq + (the double-float (* + (the double-float (/ scale temp)) + (the double-float (/ scale temp)))))))) + (setf scale temp)) + (t + (setf ssq (+ ssq (* + (the double-float (/ temp scale)) + (the double-float (/ temp scale)))))))) + (when (/= (the double-float (imagpart + (the (complex double-float) (svref x ix)))) 0.0d0) + (setf temp + (the double-float (abs + (the double-float (imagpart + (the (complex double-float) (svref x ix))))))) + (cond + ((< scale temp) + (setf ssq (+ 1.0d0 (* ssq (* + (the double-float (/ scale temp)) + (the double-float (/ scale temp)))))) + (setf scale temp)) + (t + (setf ssq (+ ssq (* + (the double-float (/ temp scale)) + (the double-float (/ temp scale))))))))) + (setf dznrm2 (the double-float (* scale (the double-float (sqrt ssq)))))) + dznrm2)) + +\end{chunk} + +\begin{chunk}{BLAS 1 dznrm2 lisp test} +(load "dznrm2.lisp") +(setq a (vector #C(3.0d0 4.0d0) #C(-4.0d0 5.0d0) #C(5.0d0 6.0d0) + #C(7.0d0 -8.0d0) #C(-9.0d0 -2.0d0))) +; #(#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)) +(dznrm2 5 a 1) +; 18.027756377319946 +(dznrm2 3 a 2) +; 13.076696830622023 +(dznrm2 3 a 1) +; 11.269427669584648 +(dznrm2 3 a -1) +; 0.0 +(dznrm2 -3 a -1) +; 0.0 +(dznrm2 1 a 1) +; 5.0 +(dznrm2 1 a 2) +; 5.0 \end{chunk} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{icamax BLAS} %\pagehead{icamax}{icamax} @@ -138913,12 +139206,12 @@ Warning: Types of argument 1 in call to ZLARFB do not match. \getchunk{BLAS 1 dscal} \getchunk{BLAS 1 dswap} \getchunk{BLAS 1 dzasum} +\getchunk{BLAS 1 dznrm2} \end{chunk} \begin{chunk}{untested} \getchunk{BLAS lsame} \getchunk{BLAS xerbla} -\getchunk{BLAS 1 dznrm2} \getchunk{BLAS 1 icamax} \getchunk{BLAS 1 idamax} \getchunk{BLAS 1 isamax} diff --git a/books/bookvolbib.bib b/books/bookvolbib.bib index 36bbdd6..9023eee 100644 --- a/books/bookvolbib.bib +++ b/books/bookvolbib.bib @@ -177,6 +177,66 @@ Aggressive Early Deflation}, Month = {June}, Year = {2006}} +@article{REF-LAW79 + Author = {C.L. Lawson, R.J. Hanson, D.R. Kincaid, F.T. Krogh}, + Date-Added = {2012-05-07 05:32:45 -0500}, + Date-Modified = {2012-05-07 05:33:48 -0500}, + Journal = {ACM Transactions on Mathematical Software}, + Pages = {303-323}, + Title = {Basic Linear Algebra Subprograms for Fortran Usage}, + Volume = {5}, + Number = {3}, + Month = {September}, + Year = {1979}} + +@article{REF-DOU88, + Author = {Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Richard J. Hanson}, + Date-Added = {2012-05-07 05:32:45 -0500}, + Date-Modified = {2012-05-07 05:33:48 -0500}, + Journal = {ACM Transactions on Mathematical Software}, + Pages = {1-17}, + Title = {An Extended Set of FORTRAN Basic Linear Algebra Subprograms}, + Volume = {14}, + Number = {1}, + Month = {March}, + Year = {1988}} + +@article{REF-DOU88a, + Author = {Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Richard J. Hanson}, + Date-Added = {2012-05-07 05:32:45 -0500}, + Date-Modified = {2012-05-07 05:33:48 -0500}, + Journal = {ACM Transactions on Mathematical Software}, + Pages = {18-32}, + Title = {An Extended Set of FORTRAN Basic Linear Algebra Subprograms: Model Implementation and Test Programs}, + Volume = {14}, + Number = {1}, + Month = {March}, + Year = {1988}} + +@article{REF-DOU90, + Author = {Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Iain S. Duff}, + Date-Added = {2012-05-07 05:32:45 -0500}, + Date-Modified = {2012-05-07 05:33:48 -0500}, + Journal = {ACM Transactions on Mathematical Software}, + Pages = {1-17}, + Title = {A Set of Level 3 Basic Linear Algebra Subprograms}, + Volume = {16}, + Number = {1}, + Month = {March}, + Year = {1990}} + +@article{REF-DOU90a, + Author = {Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Iain S. Duff}, + Date-Added = {2012-05-07 05:32:45 -0500}, + Date-Modified = {2012-05-07 05:33:48 -0500}, + Journal = {ACM Transactions on Mathematical Software}, + Pages = {18-28}, + Title = {ALGORITHM 679: A Set of Level 3 Basic Linear Algebra Subprograms: Model Implementation and Test Programs}, + Volume = {16}, + Number = {1}, + Month = {March}, + Year = {1990}} + @article{REF-Hig88, Author = {N. J. Higham}, Date-Added = {2012-04-22 05:32:45 -0500}, diff --git a/books/bookvolbib.pamphlet b/books/bookvolbib.pamphlet index a722655..804c802 100644 --- a/books/bookvolbib.pamphlet +++ b/books/bookvolbib.pamphlet @@ -1252,6 +1252,28 @@ A.K Peters, Natick, MA. (2003) ISBN 1-56881-134-9 \bibitem[DA98]{DA98} Dalmas, Stephane and Arsac, Olivier ``The INRIA OpenMath Library'' Projet SAFIR, INRIA Sophia Antipolis Nov 25, 1998 +\bibitem[REF-DON88]{REF-DON88} +Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Richard J. Hanson +``An Extended Set of FORTRAN Basic Linear Algebra Subroutines'' +ACM Transactions on Mathematical Software, Vol 14, No 1, March 1988, +pp 1-17 +\bibitem[REF-DON88a]{REF-DON88a} +Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Richard J. Hanson +``ALGORITHM 656: An Extended Set of Basic Linear Algebra Subprograms: +Model Implementation and Test Programs'' +ACM Transactions on Mathematical Software, Vol 14, No 1, March 1988, +pp 18-32 +\bibitem[REF-DON90]{REF-DON90} +Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Iain S. Duff +``A Set of Level 3 Basic Linear Algebra Subprograms'' +ACM Transactions on Mathematical Software, Vol 16, No 1, March 1990, +pp 1-17 +\bibitem[REF-DON90a]{REF-DON90a} +Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, Iain S. Duff +``ALGORITHM 679: A Set of Level 3 Basic Linear Algebra Subprograms: +Model Implementation and Test Programs'' +ACM Transactions on Mathematical Software, Vol 16, No 1, March 1990, +pp 18-28 \bibitem[Fl01]{Fl01} Fletcher, John P. ``Symbolic processing of Clifford Numbers in C++'', Paper 25, AGACSE 2001. @@ -1340,6 +1362,11 @@ Lamport, Leslie, {\it LaTeX: A Document Preparation System,} \\ Reading, Massachusetts, Addison-Wesley Publishing Company, Inc., 1986. ISBN 0-201-15790-X +\bibitem[REF-LAW79]{REF-LAW79} +Lawson, C.L., Hanson R.J., Kincaid, D.R., Krogh, F.T. +``Algorithm 539: Basic linear algebra subprograms for FORTRAN usage'' +ACM Transactions on Mathematical Software, Vol 5 No 3 September 1979 +pp 308-323 \bibitem[LR88]{LR88} Le Brigand, D. and Risler, J.J. ``Algorithme de Brill-Noether et codes de Goppa'' diff --git a/changelog b/changelog index 625da0c..673b835 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +20120508 tpd src/axiom-website/patches.html 20120508.01.tpd.patch +20120508 tpd books/bookvolbib update references +20120508 tpd books/bookvolbib.bib update references +20120508 tpd books/bookvol10.5 BLAS1 dznrm2 20120507 tpd src/axiom-website/patches.html 20120507.02.tpd.patch 20120507 tpd books/bookvol10.5 BLAS1 dzasum 20120507 tpd src/axiom-website/patches.html 20120507.01.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 53fc6de..e79d5af 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3910,5 +3910,7 @@ books/bookvol10.5 BLAS1 dscal
books/bookvol10.5 BLAS1 dswap
20120507.02.tpd.patch books/bookvol10.5 BLAS1 dzasum
+20120508.01.tpd.patch +books/bookvol10.5 BLAS1 dznrm2