diff options
Diffstat (limited to 'lib/Numeric/GSL/gsl-aux.c')
-rw-r--r-- | lib/Numeric/GSL/gsl-aux.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c index 689989d..3e9e2cb 100644 --- a/lib/Numeric/GSL/gsl-aux.c +++ b/lib/Numeric/GSL/gsl-aux.c | |||
@@ -153,6 +153,56 @@ int sumC(KCVEC(x),CVEC(r)) { | |||
153 | OK | 153 | OK |
154 | } | 154 | } |
155 | 155 | ||
156 | int prodF(KFVEC(x),FVEC(r)) { | ||
157 | DEBUGMSG("prodF"); | ||
158 | REQUIRES(rn==1,BAD_SIZE); | ||
159 | int i; | ||
160 | float res = 0; | ||
161 | for (i = 0; i < xn; i++) res *= xp[i]; | ||
162 | rp[0] = res; | ||
163 | OK | ||
164 | } | ||
165 | |||
166 | int prodR(KRVEC(x),RVEC(r)) { | ||
167 | DEBUGMSG("prodR"); | ||
168 | REQUIRES(rn==1,BAD_SIZE); | ||
169 | int i; | ||
170 | double res = 0; | ||
171 | for (i = 0; i < xn; i++) res *= xp[i]; | ||
172 | rp[0] = res; | ||
173 | OK | ||
174 | } | ||
175 | |||
176 | int prodQ(KQVEC(x),QVEC(r)) { | ||
177 | DEBUGMSG("prodQ"); | ||
178 | REQUIRES(rn==1,BAD_SIZE); | ||
179 | int i; | ||
180 | gsl_complex_float res; | ||
181 | res.dat[0] = 0; | ||
182 | res.dat[1] = 0; | ||
183 | for (i = 0; i < xn; i++) { | ||
184 | res.dat[0] = res.dat[0] * xp[i].dat[0] - res.dat[1] * xp[i].dat[1]; | ||
185 | res.dat[1] = res.dat[0] * xp[i].dat[1] + res.dat[1] * xp[i].dat[0]; | ||
186 | } | ||
187 | rp[0] = res; | ||
188 | OK | ||
189 | } | ||
190 | |||
191 | int prodC(KCVEC(x),CVEC(r)) { | ||
192 | DEBUGMSG("prodC"); | ||
193 | REQUIRES(rn==1,BAD_SIZE); | ||
194 | int i; | ||
195 | gsl_complex res; | ||
196 | res.dat[0] = 0; | ||
197 | res.dat[1] = 0; | ||
198 | for (i = 0; i < xn; i++) { | ||
199 | res.dat[0] = res.dat[0] * xp[i].dat[0] - res.dat[1] * xp[i].dat[1]; | ||
200 | res.dat[1] = res.dat[0] * xp[i].dat[1] + res.dat[1] * xp[i].dat[0]; | ||
201 | } | ||
202 | rp[0] = res; | ||
203 | OK | ||
204 | } | ||
205 | |||
156 | int dotF(KFVEC(x), KFVEC(y), FVEC(r)) { | 206 | int dotF(KFVEC(x), KFVEC(y), FVEC(r)) { |
157 | DEBUGMSG("dotF"); | 207 | DEBUGMSG("dotF"); |
158 | REQUIRES(xn==yn,BAD_SIZE); | 208 | REQUIRES(xn==yn,BAD_SIZE); |