1 LISP LIBRARY PACKAGES MANUAL 1 LISP LIBRARY PACKAGES MANUAL MATMULT 1 EXTENSIONS TO LISP 1 MATMULT 6 Interlisp-D contains low-level functions for high-speed matrix multiplication. The MatMult Lisp Library package provides a high-level interface to these functions. Matrices in MatMult are represented using ARRAYs (defined by the CMLArray package). 2 Matrix Creation Functions 1 (CREATE1BY3) [Function] Returns a 1-row-by-3-column CMLArray vector. (CREATE1BY4) [Function] Returns a 1-by-4 vector. (CREATE3-BY-1) [Function] Returns a 3-by-1 vector. (CREATE3BY3) [Function] Returns a 3-by-3 matrix. (CREATE4BY1) [Function] Returns a 4-by-1 vector. (CREATE4BY4) [Function] Returns a 4-by-4 matrix. (IDENTITY3BY3 M) [Function] Returns a 3-by-3 identity matrix (a matrix with the elements of its main diagonal all set to unity). In this and all following MatMult functions, if M is supplied, it is set and returned. (IDENTITY4BY4 M) [Function] Returns a 4-by-4 identity matrix. (ROTATE3BY3 THETA RADIANSFLG M) [Function] Returns a 3-by-3 matrix that, when multiplied by a vector, will rotate that vector an angle of THETA around the origin. THETA is measured in degrees or radians, depending on RADIANSFLG. (ROTATE4BY4.ABOUTX THETA RADIANSFLG M) [Function] Returns a 4-by-4 matrix suitable for rotating a point in 3-space around the X-axis by THETA. (ROTATE4BY4.ABOUTY THETA RADIANSFLG M) [Function] Returns a 4-by-4 matrix suitable for rotating a point in 3-space around the Y-axis by THETA. (ROTATE4BY4.ABOUTZ THETA RADIANSFLG M) [Function] Returns a 4-by-4 matrix suitable for rotating a point in 3-space around the Z-axis by THETA. (SCALE3BY3 Sx Sy M) [Function] Returns a 3-by-3 matrix that will scale by a factor of Sx in the X-axis and Sy in the Y-axis. (SCALE4BY4 Sx Sy Sz M) [Function] Returns a 4-by-4 matrix that will scale by a factor of Sx in the X-axis, Sy in the Y-axis, and Sz in the Z-axis. (TRANSLATE3BY3 Tx Ty M) [Function] Returns a 3-by-3 matrix that will translate by a distance of Tx in the X-axis and Ty in the Y-axis. (TRANSLATE4BY4 Tx Ty Tz M) [Function] Returns a 4-by-4 matrix that will translate by a distance of Tx in the X-axis, Ty in the Y-axis, and Tz in the Z-axis. 2 Matrix Accessor Functions 1 (SET.XCOORD VECTOR VALUE) [Function] Given a vector VECTOR of length 3 or 4, sets the X component to be VALUE. (SET.YCOORD VECTOR VALUE) [Function] Sets the Y component of VECTOR to be VALUE. (SET.ZCOORD VECTOR VALUE) [Function] Sets the Z component of VECTOR to be VALUE. (SET.WCOORD VECTOR VALUE) [Function] Sets the W (fourth) component of VECTOR to be VALUE. (GET.XCOORD VECTOR) [Function] Returns the X component of VECTOR. (GET.YCOORD VECTOR) [Function] Returns the Y component of VECTOR. (GET.ZCOORD VECTOR) [Function] Returns the Z component of VECTOR. (GET.WCOORD VECTOR) [Function] Returns the W component of VECTOR. 2 Matrix Multiplication Functions 1 N.B. The results of the following matrix multiplication functions are not guaranteed to be correct unless the matrix arguments are all different (NEQ). (MATMULT MATRIXA MATRIXB MATRIXC K M N) [Function] Multiplies MATRIXA by MATRIXB storing into MATRIXC. The dimensions of MATRIXA are K x M, MATRIXB are M x N, and MATRIXC are K x N. The following functions compile into single instructions. When run on the workstations equipped with the extended processor option, these instructions make use of the hardware floating-point unit. The three digits at the end of each function's name describe the dimensions of their arguments in the order K M N. (MATMULT133 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (1 x 3) by MATRIXB (3 x 3) storing into MATRIXC (1 x 3). (MATMULT331 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (3 x 3) by MATRIXB (3 x 1) into MATRIXC (3 x 3). (MATMULT333 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (3 x 3) by MATRIXB (3 x 3) into MATRIXC (3 x 3). (MATMULT144 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (1 x 4) by MATRIXB (4 x 4) into MATRIXC (1 x 4). (MATMULT441 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (4 x 4) by MATRIXB (4 x 1) into MATRIXC (4 x 1). (MATMULT444 MATRIXA MATRIXB MATRIXC) [Function] Multiplies MATRIXA (4 x 4) by MATRIXB (4 x 4) into MATRIXC (4 x 4). 2 Miscellaneous Matrix Functions 1 (MAT.INVERT MATRIX) [Function] Returns the inverse of MATRIX, an n x n matrix of any size. Causes an error if MATRIX is noninvertible. This is not a particularly fast function. (MAT.INVERT.3BY3 MATRIX) [Function] Returns the inverse of MATRIX, which is presumed to be of dimension 3 x 3. Causes an error if MATRIX is noninvertible. This function is much faster than MAT.INVERT for matrices known to be 3 x 3. (MAT.DETERMINANT MATRIX) [Function] Returns the determinant of MATRIX. Causes an error if MATRIX is not square. [This page intentionally left blank] (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# 290) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (54 12 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 618) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (270 12 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (54 12 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))))))äìT/ÌÌøøT0ø2øTT.ø2È/øÈT.ÌÌø ø/ø2øT/øøT.ÌÌøø.ÌÌøø.ÌÌø È/ÌÌøÈTBøø PAGEHEADING VERSOHEADBøø PAGEHEADING RECTOHEADAøø PAGEHEADINGFOOTINGVAøø PAGEHEADINGFOOTINGRMODERNMODERN MODERNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN    HRULE.GETFNMODERN    HRULE.GETFNMODERN  ú HRULE.GETFNMODERN HRULE.GETFNMODERN -             –&   "   _1   V   V   U   7    7   =    = HRULE.GETFNMODERN HRULE.GETFNMODERN    /            5             HRULE.GETFNMODERN  HRULE.GETFNMODERN˜    2                      0 F      HRULE.GETFNMODERN HRULE.GETFNMODERN   3>   Ba   7%yzº