The FLOATARRAY package implements certain high-speed vector operations and operations using these vector operations. Though FLOATARRAY takes advantage of the special capabilities of the DandeTiger (Xerox 1108X), it can be run on any of the machines in the 1100 series. The package includes functions for one and two dimensional FFTs, matrice multiplication and transposition as well as a general function for operation on matrices. MAPARRAY MAPARRAY is the basic vectorizing function in the FLOATARRAY package. The MAPARRAY function is defined both as a function and a macro. The function definition contains more error checking than the macro definition and should be used in a debbuging phase since the vectorized opartions could ruin a sysout if given wrong arguments (e.g. add vectors of different lengths). MAPARRAY is capable of handling arrays of any dimensions and will in most cases create a resulting array of the correct dimensions if not supplied. (MAPARRAY Result Mapfn Array1 Array2 ... ArrayN) MAPARRAY will set Result [i] to the value returned by applying Mapfn to Array1[i], Array1[i], ... , ArrayN[i] for all possible i. If Result is NIL then an appropriate array is created to hold the result. Returns Result. MAPFN can be an arbitrary n-ary Lisp function. MAPARRAY deals with the cases of one or two input arrays specially, deferring to the functions MAPARRAY1 and MAPARRAY2. We use "SMALLP" for an array of type (UNSIGNED-BYTE 16) and "FLOAT" for an array of type SINGLE-FLOAT. A "COMPLEX" array is an array of type FLOAT whose successive pairs of elements are to be viewed as the real and imaginary parts of a complex number. Thus if C is a complex array, the nth complex number of C, C[n], has real part (AREF C ... (ITIMES 2 n)) and imaginary part (AREF C ... (ADD1 (ITIMES 2 n))). (MAPELT1 Result Mapfn Array1) applies MAPELT1 to each element of Array1, and places the result in the corresponding element of Result . Mapfn can be any unary function or one of a group of distinguished pseudo-functions, each of which is realized on the DandeTiger as a machine instruction: EXPONENT sets SMALLP Result[n] to the EXPONENT field of FLOATP Array[n]. EXPONENT can be used as a fast logarithm to base 2. The result is the eight high bits of the 32 bit floating point number. The exponent of 0.0 is 0, 0.0625 has the exponent 123 and 8.0 has the exponent 130. FLOAT sets FLOAT Result[n] to SMALLP Array[n]. I.e. a smallp to floating point vectorized conversion routine. COMPLEXFLOAT sets COMPLEX Result[n] to FLOAT Array[n]. If Array[n] is a, then Result[n] is a+0.0i. MAGNITUDE sets FLOAT Result[n] to the square of the magnitude of the complex number Array[n]. E.g. If one really wants the magnitude of a vector one could write: (MAPARRAY NIL 'SQRT (MAPARRAY NIL 'MAGNITUDE ARRAY)). This is somewhat inefficient as we create one temporary array containing the squared magnitude. [SEPARATE not fully debugged, not even tested ...] (MAPARRAY2 Result Mapfn Array1 Array2) applies Mapfn to corresponding elements of Array1 and Array2, placing the results in Result. Mapfn can be any binary Lisp function, though the following pseudo-functions are specially recognized and run as single DandeTiger instructions: FPLUS sets FLOAT Result[n] to the sum of Array1[n] and Array2[n]. If one of Array1 or Array2 is a number it is first converted to an array of the same dimensions as the other array. I.e. to add 1.0 to each element in the array WEIGHTS one could write: (MAPARRAY WEIGHTS (FUNCTION FPLUS) WEIGHTS 1.0) FDIFFERENCE sets FLOAT Result[n] to FDIFFERENCE of FLOAT Array1[n] and FLOAT Array2[n]. A numeric argument is treated in the same way as in FPLUS. Warning: This can result in much time spent in garbage collecting arrays if the arrays are large. FTIMES sets FLOAT Result[n] to FTIMES of FLOAT Array1[n] and FLOAT Array2[n]. As in FPLUS and FDIFFERENCE a numeric argument is converted into an array before applying the operation. PERMUTE This function works without examine the datatype of the arguments Result and Array1. The functions permutates the array Array1 through Array2 storing data in Result. All data transfers are done in words (16-bit quantities). Array2 has to be an one dimensional array of (UNSIGNED-BYTE 16). Ex: Suppose we want to transpose an 3 by 3 element array Q. Then we precalculate the permuatation vector PERMQ: PERMQ = #( 0 1 6 7 12 13 2 3 8 9 14 15 4 5 10 11 16 17). To calculate the actual transposition we could then write: (SETQ QT (MAPARRAY NIL 'PERMUTE Q PERMQ)). Note: We can not have Result = Array1 here. Fast Fourier transforms: FFTs The FLOATARRAY package also conatins functions to calculate the FFT of one and two dimensional vectors. These operations are highly optimized and large parts are written in micro code (1108 DandeTiger). One dimensional FFT (FFT ARRAY STARTPOSITION LENGTH INVERSFLAG \BASEPTR) Calculates the FFT of a one dimensional array (EQ (ARRAY-RANK ARRAY) 1) and stores the result in the same array. ARRAY is a complex array and the result is of course complex . STARTPOSITION is the first element in ARRAY to be used in the FFT calculation. Default for STARTPOSITION is 0. LENGTH is the number of complex element to be used in the FFT calculation. LENGTH has to be a power of two. LENGTH is defaulted to the size of the array. If INVERSEFLAG is none-NIL the inverse FFT is calculated. The last argument is \BASEPTR which should not be used if avoidable. \BASEPTR is a pointer to memory and is used of ARRAY if given. 2D FFT (2DFFT ARRAY INVERSEFLAG) Calculates two dimensional FFT of an an array. Array is a complex array of dimension m * (2n) there both m and n has to be a power of two. If INVERSEFLAG is none-NIL then the inverse transformation is calculated. Calculation times: size (1D) time : size (2D) time : n = 256 14 ms n = 128 * 128 3.8 s n = 512 22 ms n = 256 * 256 13.5 s n = 1024 41 ms Other 2D matrice operations (2DCTIMES ARRAY1 ARRAY2 RESULT) This function sets RESULT[i,j] to ARRAY1[i,j]*ARRAY2[i,j] there * represents complex multiplication. RESULT, ARRAY1 andARRAY2 should be complex arrays. If RESULT is NIL the result is stored in ARRAY1. (2DTRANS ARRAY RESULT) Transposes an array of floating point numbers. Returns RESULT. If ARRAY has the dimensions n*m then RESULT has to have the dimensions m*n. If RESULT is NIL an array is created to hold the result. ARRAY=RESULT AND n=m then transposition is done in place. (2DMMUL XARRAY YARRAY ZARRAY) This is the standard matrice multiplication algorithm. It sets ZARRAY[i,j] to the sum of XARRAY[i,k]*YARRAY[k,j] there k= 0..(p if XARRAY has dimensions n*p, YARRAY p*m and ZARRAY n*m. IF ZARRAY is NIL the a new array iscreated to hold the result. Returns ZARRAY. [This packages is built upon the CMLARRAY package and should not be used with the old array type (even if it is sometimes possible).] (LIST ((PAGE NIL NIL (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 SIZE 10 FAMILY GACHA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF SLOPE REGULAR WEIGHT MEDIUM)) (282 42 72 36) NIL) (HEADING NIL (HEADINGTYPE BOO) (84 756 444 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL NIL (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 SIZE 10 FAMILY GACHA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF SLOPE REGULAR WEIGHT MEDIUM)) (282 42 72 36) NIL) (HEADING NIL (HEADINGTYPE BOO) (84 756 444 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL NIL (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 SIZE 10 FAMILY GACHA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF SLOPE REGULAR WEIGHT MEDIUM)) (282 42 72 36) NIL) (HEADING NIL (HEADINGTYPE BOO) (84 756 444 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))),ÈÈMODERN MODERN MODERN ¤   % #    I¤Ÿ #8–  $Ý E      9I;a3 Œ  3  ¢ oE$<<E@5GFH:!Ì5wÖPHG Éÿ †fzº