common-math-package.lisp 3.1 KB
Newer Older
Marco Antoniotti's avatar
Marco Antoniotti committed
1 2 3 4 5 6 7
;;;; -*- Mode: Lisp -*-

;;;; common-math-package.lisp
;;;;
;;;; See file COPYING in the main folder for licensing information.

(defpackage "IT.UNIMIB.DISCO.MA.CL.EXT.MATH" (:use "CL")
8 9
  (:documentation "The Common Math Common Lisp Package.

10
The main package containing the symbols that comprise the generic math
11 12 13 14 15 16 17 18
operations library.  Most math library symbols form the CL package are
shadowed and re-exported.  The other symbols are mostly the hooks into
the generic function machinery for generic math.

The symbols in the API are constants, mostly covering IEEE 754 names
and values, and generic functions of fixed arity.  These functions
usually come in two flavors: monadic and dyadic. They have names
following a simple scheme: monadic functions have a single dot
19
indicating the single argument, and dyadic ones have two, indicating
20 21 22 23 24 25 26 27 28 29 30 31
both arguments.  E.g.,

Monadic minus: -.
Dyadic minus: .-.

All fixed arity generic functions also have an optional argument
possibly holding the resul.  This is ignored for simple arithmetic
results but is useful when writing, for example, matrix libraries that
must allocate the result, say, of a sum; one can pass the resulting
argument as the optional one.
")

Marco Antoniotti's avatar
Marco Antoniotti committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
  (:nicknames
   "COMMON-MATH"
   "MATH"
   "CL.MATH"
   "CL.EXTENSIONS.MATH"
   "CL.EXT.MATH")


  ;; IEEE names.

  (:export
   "NAN")

  (:export
   "LONG-FLOAT-POSITIVE-INFINITY"
   "LONG-FLOAT-NEGATIVE-INFINITY"

   "DOUBLE-FLOAT-POSITIVE-INFINITY"
   "DOUBLE-FLOAT-NEGATIVE-INFINITY"

   "SINGLE-FLOAT-POSITIVE-INFINITY"
   "SINGLE-FLOAT-NEGATIVE-INFINITY"

   "SHORT-FLOAT-POSITIVE-INFINITY"
   "SHORT-FLOAT-NEGATIVE-INFINITY"
   )

  (:export "+POSITIVE-INFINITY+" "+NEGATIVE-INFINITY+")

  (:export
   "IS-NAN"
   "NAN-P"
   
   "IS-INFINITY"
   "INFINITY-P"
   )

  (:export
   "ROUNDING-MODES"
   )


  (:export
   "UNIT-ROUNDOFF"

   "+UNIT-ROUNDOFF-RATIONAL+"
   "+UNIT-ROUNDOFF-SHORT-RATIONAL+"
   "+UNIT-ROUNDOFF-SINGLE-RATIONAL+"
   "+UNIT-ROUNDOFF-DOUBLE-RATIONAL+"
   "+UNIT-ROUNDOFF-LONG-RATIONAL+"

   "+UNIT-ROUNDOFF-FLOAT+"
   "+UNIT-ROUNDOFF-SHORT-FLOAT+"
   "+UNIT-ROUNDOFF-SINGLE-FLOAT+"
   "+UNIT-ROUNDOFF-DOUBLE-FLOAT+"
   "+UNIT-ROUNDOFF-LONG-FLOAT+"
   )


  ;; Generic names (shadowing CL symbols).

  (:shadow "=" "+" "-" "*" "/" ">" "<" ">=" "<=" "/=")
  (:shadow "PLUSP" "MINUSP" "ZEROP")
Marco Antoniotti's avatar
Marco Antoniotti committed
95
  (:shadow "EXP" "EXPT" "GCD" "LCM")
Marco Antoniotti's avatar
Marco Antoniotti committed
96 97 98
  
  (:export "=" "+" "-" "*" "/" ">" "<" ">=" "<=" "/=")
  (:export "PLUSP" "MINUSP" "ZEROP")
Marco Antoniotti's avatar
Marco Antoniotti committed
99
  (:export "EXP" "EXPT" "GCD" "LCM")
Marco Antoniotti's avatar
Marco Antoniotti committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

  (:export "INCREASING" "DECREASING")
  (:export "MINIMUM" "MAXIMUM" "MINMAX")

  (:export "SUM")
  (:export "PRODUCT")

  (:export ; Fixed arity operators.
   "+." ".+."
   "*." ".*."
   "-." ".-."
   "/." "./."
   "=." ".=."
   ".<."
   ".>."
   ".<=."
   ".>=."
   "/=."
   "./=."
   )

  (:export "GCD." ".GCD." "LCM." ".LCM.")

Marco Antoniotti's avatar
Marco Antoniotti committed
123
  (:export "INNER-PRODUCT" "OUTER-PRODUCT" "DOT")
Marco Antoniotti's avatar
Marco Antoniotti committed
124 125 126
  (:export "/*" "./*.") ; Inner product.
  (:export "*/" ".*/.") ; Outer product.

Marco Antoniotti's avatar
Marco Antoniotti committed
127
  (:export "INNER-SUM" "OUTER-SUM")
Marco Antoniotti's avatar
Marco Antoniotti committed
128 129 130 131 132 133 134 135 136 137
  (:export "/+" "./+.") ; Inner sum.
  (:export "+/" ".+/.") ; Outer sum.

  ;; Conditions.

  (:export "UNDEFINED-OPERATION")

  )

;;;; end of file -- common-math-package.lisp