| 1 | /* vector/oper_source.c |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 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 | int |
| 21 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, add) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * b) |
| 22 | { |
| 23 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 24 | |
| 25 | if (b->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size. != N) |
| 26 | { |
| 27 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("vectors must have same length", GSL_EBADLEN); |
| 28 | } |
| 29 | else |
| 30 | { |
| 31 | const size_t stride_a = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 32 | const size_t stride_b = b->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 33 | |
| 34 | size_t i; |
| 35 | |
| 36 | for (i = 0; i < N; i++) |
| 37 | { |
| 38 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_a] += b->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_b]; |
| 39 | } |
| 40 | |
| 41 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | int |
| 46 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, sub) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * b) |
| 47 | { |
| 48 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 49 | |
| 50 | if (b->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size. != N) |
| 51 | { |
| 52 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("vectors must have same length", GSL_EBADLEN); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | const size_t stride_a = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 57 | const size_t stride_b = b->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 58 | |
| 59 | size_t i; |
| 60 | |
| 61 | for (i = 0; i < N; i++) |
| 62 | { |
| 63 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_a] -= b->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_b]; |
| 64 | } |
| 65 | |
| 66 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | int |
| 71 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, mul) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * b) |
| 72 | { |
| 73 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 74 | |
| 75 | if (b->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size. != N) |
| 76 | { |
| 77 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("vectors must have same length", GSL_EBADLEN); |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | const size_t stride_a = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 82 | const size_t stride_b = b->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 83 | |
| 84 | size_t i; |
| 85 | |
| 86 | for (i = 0; i < N; i++) |
| 87 | { |
| 88 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_a] *= b->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_b]; |
| 89 | } |
| 90 | |
| 91 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | int |
| 96 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, div) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * b) |
| 97 | { |
| 98 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 99 | |
| 100 | if (b->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size. != N) |
| 101 | { |
| 102 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("vectors must have same length", GSL_EBADLEN); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | const size_t stride_a = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 107 | const size_t stride_b = b->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 108 | |
| 109 | size_t i; |
| 110 | |
| 111 | for (i = 0; i < N; i++) |
| 112 | { |
| 113 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_a] /= b->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride_b]; |
| 114 | } |
| 115 | |
| 116 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | int |
| 121 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, scale) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const double x) |
| 122 | { |
| 123 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 124 | const size_t stride = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 125 | |
| 126 | size_t i; |
| 127 | |
| 128 | for (i = 0; i < N; i++) |
| 129 | { |
| 130 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride] *= x; |
| 131 | } |
| 132 | |
| 133 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 134 | } |
| 135 | |
| 136 | int |
| 137 | FUNCTIONcxx . . $ `./templates_on.h:233:9`!(gsl_vector, add_constant) (TYPEcxx . . $ `./templates_on.h:234:9`!(gsl_vector) * a, const double x) |
| 138 | { |
| 139 | const size_t N = a->sizecxx . . $ $anonymous_type_9a7b30797aee9e14_0#size.; |
| 140 | const size_t stride = a->stridecxx . . $ $anonymous_type_9a7b30797aee9e14_0#stride.; |
| 141 | |
| 142 | size_t i; |
| 143 | |
| 144 | for (i = 0; i < N; i++) |
| 145 | { |
| 146 | a->datacxx . . $ $anonymous_type_9a7b30797aee9e14_0#data.[i * stride] += x; |
| 147 | } |
| 148 | |
| 149 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 150 | } |