| 1 | /* matrix/minmax_source.c |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | BASEcxx . . $ `./templates_on.h:78:9`! |
| 21 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, max) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m) |
| 22 | { |
| 23 | /* finds the largest element of a matrix */ |
| 24 | |
| 25 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 26 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 27 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 28 | |
| 29 | BASEcxx . . $ `./templates_on.h:78:9`! max = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 30 | size_t i, j; |
| 31 | |
| 32 | for (i = 0; i < M; i++) |
| 33 | { |
| 34 | for (j = 0; j < N; j++) |
| 35 | { |
| 36 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 37 | if (x > max) |
| 38 | max = x; |
| 39 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 40 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 41 | return x; |
| 42 | #endif |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | return max; |
| 47 | } |
| 48 | |
| 49 | BASEcxx . . $ `./templates_on.h:78:9`! |
| 50 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, min) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m) |
| 51 | { |
| 52 | /* finds the smallest element of a matrix */ |
| 53 | |
| 54 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 55 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 56 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 57 | |
| 58 | BASEcxx . . $ `./templates_on.h:78:9`! min = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 59 | size_t i, j; |
| 60 | |
| 61 | for (i = 0; i < M; i++) |
| 62 | { |
| 63 | for (j = 0; j < N; j++) |
| 64 | { |
| 65 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 66 | if (x < min) |
| 67 | min = x; |
| 68 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 69 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 70 | return x; |
| 71 | #endif |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return min; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | void |
| 80 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, minmax) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m, |
| 81 | BASEcxx . . $ `./templates_on.h:78:9`! * min_out, |
| 82 | BASEcxx . . $ `./templates_on.h:78:9`! * max_out) |
| 83 | { |
| 84 | /* finds the smallest and largest elements of a matrix */ |
| 85 | |
| 86 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 87 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 88 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 89 | |
| 90 | BASEcxx . . $ `./templates_on.h:78:9`! max = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 91 | BASEcxx . . $ `./templates_on.h:78:9`! min = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 92 | |
| 93 | size_t i, j; |
| 94 | |
| 95 | for (i = 0; i < M; i++) |
| 96 | { |
| 97 | for (j = 0; j < N; j++) |
| 98 | { |
| 99 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 100 | if (x < min) |
| 101 | { |
| 102 | min = x; |
| 103 | } |
| 104 | if (x > max) |
| 105 | { |
| 106 | max = x; |
| 107 | } |
| 108 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 109 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 110 | { |
| 111 | *min_out = x; |
| 112 | *max_out = x; |
| 113 | return; |
| 114 | } |
| 115 | #endif |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | *min_out = min; |
| 120 | *max_out = max; |
| 121 | } |
| 122 | |
| 123 | void |
| 124 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, max_index) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m, size_t * imax_out, size_t *jmax_out) |
| 125 | { |
| 126 | /* finds the largest element of a matrix */ |
| 127 | |
| 128 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 129 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 130 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 131 | |
| 132 | BASEcxx . . $ `./templates_on.h:78:9`! max = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 133 | size_t imax = 0, jmax = 0; |
| 134 | size_t i, j; |
| 135 | |
| 136 | for (i = 0; i < M; i++) |
| 137 | { |
| 138 | for (j = 0; j < N; j++) |
| 139 | { |
| 140 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 141 | if (x > max) |
| 142 | { |
| 143 | max = x; |
| 144 | imax = i; |
| 145 | jmax = j; |
| 146 | } |
| 147 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 148 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 149 | { |
| 150 | *imax_out = i; |
| 151 | *jmax_out = j; |
| 152 | return; |
| 153 | } |
| 154 | #endif |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | *imax_out = imax; |
| 159 | *jmax_out = jmax; |
| 160 | } |
| 161 | |
| 162 | void |
| 163 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, min_index) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m, size_t * imin_out, size_t *jmin_out) |
| 164 | { |
| 165 | /* finds the largest element of a matrix */ |
| 166 | |
| 167 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 168 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 169 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 170 | |
| 171 | BASEcxx . . $ `./templates_on.h:78:9`! min = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 172 | size_t imin = 0, jmin = 0; |
| 173 | size_t i, j; |
| 174 | |
| 175 | for (i = 0; i < M; i++) |
| 176 | { |
| 177 | for (j = 0; j < N; j++) |
| 178 | { |
| 179 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 180 | if (x < min) |
| 181 | { |
| 182 | min = x; |
| 183 | imin = i; |
| 184 | jmin = j; |
| 185 | } |
| 186 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 187 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 188 | { |
| 189 | *imin_out = i; |
| 190 | *jmin_out = j; |
| 191 | return; |
| 192 | } |
| 193 | #endif |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | *imin_out = imin; |
| 198 | *jmin_out = jmin; |
| 199 | } |
| 200 | |
| 201 | void |
| 202 | FUNCTIONcxx . . $ `./templates_on.h:233:9`! (gsl_matrix, minmax_index) (const TYPEcxx . . $ `./templates_on.h:234:9`! (gsl_matrix) * m, |
| 203 | size_t * imin_out, |
| 204 | size_t * jmin_out, |
| 205 | size_t * imax_out, |
| 206 | size_t * jmax_out) |
| 207 | { |
| 208 | /* finds the smallest and largest elements of a matrix */ |
| 209 | |
| 210 | const size_t M = m->size1cxx . . $ $anonymous_type_440e409b7051068e_0#size1.; |
| 211 | const size_t N = m->size2cxx . . $ $anonymous_type_440e409b7051068e_0#size2.; |
| 212 | const size_t tda = m->tdacxx . . $ $anonymous_type_440e409b7051068e_0#tda.; |
| 213 | |
| 214 | size_t imin = 0, jmin = 0, imax = 0, jmax = 0; |
| 215 | BASEcxx . . $ `./templates_on.h:78:9`! max = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 216 | BASEcxx . . $ `./templates_on.h:78:9`! min = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[0 * tda + 0]; |
| 217 | |
| 218 | size_t i, j; |
| 219 | |
| 220 | for (i = 0; i < M; i++) |
| 221 | { |
| 222 | for (j = 0; j < N; j++) |
| 223 | { |
| 224 | BASEcxx . . $ `./templates_on.h:78:9`! x = m->datacxx . . $ $anonymous_type_440e409b7051068e_0#data.[i * tda + j]; |
| 225 | if (x < min) |
| 226 | { |
| 227 | min = x; |
| 228 | imin = i; |
| 229 | jmin = j; |
| 230 | } |
| 231 | if (x > max) |
| 232 | { |
| 233 | max = x; |
| 234 | imax = i; |
| 235 | jmax = j; |
| 236 | } |
| 237 | #ifdef FPcxx . . $ `./templates_on.h:82:9`! |
| 238 | if (isnancxx . . $ `<external>/11263917310783833665/math.h:980:11`! (x)) |
| 239 | { |
| 240 | *imin_out = i; |
| 241 | *jmin_out = j; |
| 242 | *imax_out = i; |
| 243 | *jmax_out = j; |
| 244 | return; |
| 245 | } |
| 246 | #endif |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | *imin_out = imin; |
| 251 | *jmin_out = jmin; |
| 252 | *imax_out = imax; |
| 253 | *jmax_out = jmax; |
| 254 | } |