| 1 | ;; Histogram operations |
|---|
| 2 | ;; Liam Healy, Mon Jan 1 2007 - 16:47 |
|---|
| 3 | ;; Time-stamp: <2008-02-23 18:57:17EST operations.lisp> |
|---|
| 4 | ;; $Id$ |
|---|
| 5 | |
|---|
| 6 | (in-package :gsl) |
|---|
| 7 | |
|---|
| 8 | (defmfun equal-bins-p-1 (histogram1 histogram2) |
|---|
| 9 | "gsl_histogram_equal_bins_p" |
|---|
| 10 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 11 | :c-return :true-false |
|---|
| 12 | :export nil |
|---|
| 13 | :index equal-bins-p |
|---|
| 14 | :documentation ; FDL |
|---|
| 15 | "Are all of the individual bin ranges of the two histograms are identical?") |
|---|
| 16 | |
|---|
| 17 | (defmfun equal-bins-p-2 (histogram1 histogram2) |
|---|
| 18 | "gsl_histogram2d_equal_bins_p" |
|---|
| 19 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 20 | :c-return :true-false |
|---|
| 21 | :export nil |
|---|
| 22 | :index equal-bins-p |
|---|
| 23 | :documentation ; FDL |
|---|
| 24 | "Are all of the individual bin ranges of the two histograms are identical?") |
|---|
| 25 | |
|---|
| 26 | (export 'equal-bins-p) |
|---|
| 27 | (defun equal-bins-p (histogram1 histogram2) |
|---|
| 28 | "Are all of the individual bin ranges of the two histograms are identical?" |
|---|
| 29 | (histo-1d2d histogram1 equal-bins-p (histogram2))) |
|---|
| 30 | |
|---|
| 31 | ;;; GSL documentation does not state what the return value for the |
|---|
| 32 | ;;; C function means; assumed to be error code. |
|---|
| 33 | (defmfun m+-1 (histogram1 histogram2) |
|---|
| 34 | "gsl_histogram_add" |
|---|
| 35 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 36 | :export nil |
|---|
| 37 | :index m+ |
|---|
| 38 | :documentation ; FDL |
|---|
| 39 | "Add the contents of the bins in histogram2 to the |
|---|
| 40 | corresponding bins of histogram1 i.e. h'_1(i) = |
|---|
| 41 | h_1(i) + h_2(i). The two histograms must have identical bin |
|---|
| 42 | ranges.") |
|---|
| 43 | |
|---|
| 44 | ;;; GSL documentation does not state what the return value for the |
|---|
| 45 | ;;; C function means; assumed to be error code. |
|---|
| 46 | (defmfun m+-2 (histogram1 histogram2) |
|---|
| 47 | "gsl_histogram2d_add" |
|---|
| 48 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 49 | :export nil |
|---|
| 50 | :index m+ |
|---|
| 51 | :documentation ; FDL |
|---|
| 52 | "Add the contents of the bins in histogram2 to the |
|---|
| 53 | corresponding bins of histogram1 i.e. h'_1(i) = |
|---|
| 54 | h_1(i) + h_2(i). The two histograms must have identical bin |
|---|
| 55 | ranges.") |
|---|
| 56 | |
|---|
| 57 | (defmethod m+ ((histogram1 histogram) (histogram2 histogram)) |
|---|
| 58 | ;; FDL |
|---|
| 59 | "Add the contents of the bins in histogram2 to the |
|---|
| 60 | corresponding bins of histogram1 i.e. h'_1(i) = |
|---|
| 61 | h_1(i) + h_2(i). The two histograms must have identical bin |
|---|
| 62 | ranges." |
|---|
| 63 | (histo-1d2d histogram1 m+ (histogram2))) |
|---|
| 64 | |
|---|
| 65 | ;;; GSL documentation does not state what the return value for the |
|---|
| 66 | ;;; C function means; assumed to be error code. |
|---|
| 67 | (defmfun m--1 (histogram1 histogram2) |
|---|
| 68 | "gsl_histogram_sub" |
|---|
| 69 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 70 | :export nil |
|---|
| 71 | :index m- |
|---|
| 72 | :documentation ; FDL |
|---|
| 73 | "Subtract the contents of the bins in histogram2 from the |
|---|
| 74 | corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - |
|---|
| 75 | h_2(i). The two histograms must have identical bin ranges.") |
|---|
| 76 | |
|---|
| 77 | ;;; GSL documentation does not state what the return value for the |
|---|
| 78 | ;;; C function means; assumed to be error code. |
|---|
| 79 | (defmfun m--2 (histogram1 histogram2) |
|---|
| 80 | "gsl_histogram2d_sub" |
|---|
| 81 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 82 | :export nil |
|---|
| 83 | :index m- |
|---|
| 84 | :documentation ; FDL |
|---|
| 85 | "Subtract the contents of the bins in histogram2 from the |
|---|
| 86 | corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - |
|---|
| 87 | h_2(i). The two histograms must have identical bin ranges.") |
|---|
| 88 | |
|---|
| 89 | (defmethod m- ((histogram1 histogram) (histogram2 histogram)) |
|---|
| 90 | ;; FDL |
|---|
| 91 | "Subtract the contents of the bins in histogram2 from the |
|---|
| 92 | corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - |
|---|
| 93 | h_2(i). The two histograms must have identical bin ranges." |
|---|
| 94 | (histo-1d2d histogram1 gsl- (histogram2))) |
|---|
| 95 | |
|---|
| 96 | ;;; GSL documentation does not state what the return value for the |
|---|
| 97 | ;;; C function means; assumed to be error code. |
|---|
| 98 | (defmfun m*-1 (histogram1 histogram2) |
|---|
| 99 | "gsl_histogram_mul" |
|---|
| 100 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 101 | :export nil |
|---|
| 102 | :index m* |
|---|
| 103 | :documentation ; FDL |
|---|
| 104 | "Multiply the contents of the bins of histogram1 by the |
|---|
| 105 | contents of the corresponding bins in histogram2 |
|---|
| 106 | i.e. h'_1(i) = h_1(i) * h_2(i). The two histograms |
|---|
| 107 | must have identical bin ranges.") |
|---|
| 108 | |
|---|
| 109 | ;;; GSL documentation does not state what the return value for the |
|---|
| 110 | ;;; C function means; assumed to be error code. |
|---|
| 111 | (defmfun m*-2 (histogram1 histogram2) |
|---|
| 112 | "gsl_histogram2d_mul" |
|---|
| 113 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 114 | :export nil |
|---|
| 115 | :index m* |
|---|
| 116 | :documentation ; FDL |
|---|
| 117 | "Multiply the contents of the bins of histogram1 by the |
|---|
| 118 | contents of the corresponding bins in histogram2 |
|---|
| 119 | i.e. h'_1(i) = h_1(i) * h_2(i). The two histograms |
|---|
| 120 | must have identical bin ranges.") |
|---|
| 121 | |
|---|
| 122 | (defmethod m* ((histogram1 histogram) (histogram2 histogram)) |
|---|
| 123 | ;; FDL |
|---|
| 124 | "Multiply the contents of the bins of histogram1 by the |
|---|
| 125 | contents of the corresponding bins in histogram2 |
|---|
| 126 | i.e. h'_1(i) = h_1(i) * h_2(i). The two histograms |
|---|
| 127 | must have identical bin ranges." |
|---|
| 128 | (histo-1d2d histogram1 m* (histogram2))) |
|---|
| 129 | |
|---|
| 130 | ;;; GSL documentation does not state what the return value for the |
|---|
| 131 | ;;; C function means; assumed to be error code. |
|---|
| 132 | (defmfun m/-1 (histogram1 histogram2) |
|---|
| 133 | "gsl_histogram_div" |
|---|
| 134 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 135 | :export nil |
|---|
| 136 | :index m/ |
|---|
| 137 | :documentation ; FDL |
|---|
| 138 | "Divide the contents of the bins of histogram1 by the |
|---|
| 139 | contents of the corresponding bins in histogram2 |
|---|
| 140 | i.e. h'_1(i) = h_1(i) / h_2(i). The two histograms |
|---|
| 141 | must have identical bin ranges.") |
|---|
| 142 | |
|---|
| 143 | ;;; GSL documentation does not state what the return value for the |
|---|
| 144 | ;;; C function means; assumed to be error code. |
|---|
| 145 | (defmfun m/-2 (histogram1 histogram2) |
|---|
| 146 | "gsl_histogram2d_div" |
|---|
| 147 | (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) |
|---|
| 148 | :export nil |
|---|
| 149 | :index m/ |
|---|
| 150 | :documentation ; FDL |
|---|
| 151 | "Divide the contents of the bins of histogram1 by the |
|---|
| 152 | contents of the corresponding bins in histogram2 |
|---|
| 153 | i.e. h'_1(i) = h_1(i) / h_2(i). The two histograms |
|---|
| 154 | must have identical bin ranges.") |
|---|
| 155 | |
|---|
| 156 | (defmethod m/ ((histogram1 histogram) (histogram2 histogram)) |
|---|
| 157 | ;; FDL |
|---|
| 158 | "Divide the contents of the bins of histogram1 by the |
|---|
| 159 | contents of the corresponding bins in histogram2 |
|---|
| 160 | i.e. h'_1(i) = h_1(i) / h_2(i). The two histograms |
|---|
| 161 | must have identical bin ranges." |
|---|
| 162 | (histo-1d2d histogram1 m/ (histogram2))) |
|---|
| 163 | |
|---|
| 164 | ;;; GSL documentation does not state what the return value for the |
|---|
| 165 | ;;; C function means; assumed to be error code. |
|---|
| 166 | (defmfun scale-1 (histogram scale) |
|---|
| 167 | "gsl_histogram_scale" |
|---|
| 168 | (((pointer histogram) :pointer) (scale :double)) |
|---|
| 169 | :export nil |
|---|
| 170 | :index scale |
|---|
| 171 | :documentation ; FDL |
|---|
| 172 | "Multiply the contents of the bins of histogram by the |
|---|
| 173 | constant scale, i.e. h'_1(i) = h_1(i) * scale.") |
|---|
| 174 | |
|---|
| 175 | ;;; GSL documentation does not state what the return value for the |
|---|
| 176 | ;;; C function means; assumed to be error code. |
|---|
| 177 | (defmfun scale-2 (histogram scale) |
|---|
| 178 | "gsl_histogram2d_scale" |
|---|
| 179 | (((pointer histogram) :pointer) (scale :double)) |
|---|
| 180 | :export nil |
|---|
| 181 | :index scale |
|---|
| 182 | :documentation ; FDL |
|---|
| 183 | "Multiply the contents of the bins of histogram by the |
|---|
| 184 | constant scale, i.e. h'_1(i) = h_1(i) * scale.") |
|---|
| 185 | |
|---|
| 186 | (export 'scale) |
|---|
| 187 | (defun scale (histogram scale) |
|---|
| 188 | ;; FDL |
|---|
| 189 | "Multiply the contents of the bins of histogram by the |
|---|
| 190 | constant scale, i.e. h'_1(i) = h_1(i) * scale." |
|---|
| 191 | (histo-1d2d histogram scale (scale))) |
|---|
| 192 | |
|---|
| 193 | ;;; GSL documentation does not state what the return value for the |
|---|
| 194 | ;;; C function means; assumed to be error code. |
|---|
| 195 | (defmfun shift-1 (histogram offset) |
|---|
| 196 | "gsl_histogram_shift" |
|---|
| 197 | (((pointer histogram) :pointer) (offset :double)) |
|---|
| 198 | :export nil |
|---|
| 199 | :index shift |
|---|
| 200 | :documentation ; FDL |
|---|
| 201 | "Shift the contents of the bins of histogram h by the |
|---|
| 202 | constant offset, i.e. h'_1(i) = h_1(i) + offset.") |
|---|
| 203 | |
|---|
| 204 | ;;; GSL documentation does not state what the return value for the |
|---|
| 205 | ;;; C function means; assumed to be error code. |
|---|
| 206 | (defmfun shift-2 (histogram offset) |
|---|
| 207 | "gsl_histogram2d_shift" |
|---|
| 208 | (((pointer histogram) :pointer) (offset :double)) |
|---|
| 209 | :export nil |
|---|
| 210 | :index shift |
|---|
| 211 | :documentation ; FDL |
|---|
| 212 | "Shift the contents of the bins of histogram h by the |
|---|
| 213 | constant offset, i.e. h'_1(i) = h_1(i) + offset.") |
|---|
| 214 | |
|---|
| 215 | (export 'shift) |
|---|
| 216 | (defun shift (histogram offset) |
|---|
| 217 | (histo-1d2d histogram shift (offset))) |
|---|