summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/gsl-aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/GSL/gsl-aux.c')
-rw-r--r--lib/Numeric/GSL/gsl-aux.c102
1 files changed, 98 insertions, 4 deletions
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c
index 6bb16f0..fe33766 100644
--- a/lib/Numeric/GSL/gsl-aux.c
+++ b/lib/Numeric/GSL/gsl-aux.c
@@ -76,12 +76,12 @@
76 76
77#define FVVIEW(A) gsl_vector_float_view A = gsl_vector_float_view_array(A##p,A##n) 77#define FVVIEW(A) gsl_vector_float_view A = gsl_vector_float_view_array(A##p,A##n)
78#define FMVIEW(A) gsl_matrix_float_view A = gsl_matrix_float_view_array(A##p,A##r,A##c) 78#define FMVIEW(A) gsl_matrix_float_view A = gsl_matrix_float_view_array(A##p,A##r,A##c)
79#define QVVIEW(A) gsl_vector_float_complex_view A = gsl_vector_float_complex_view_array((float*)A##p,A##n) 79#define QVVIEW(A) gsl_vector_complex_float_view A = gsl_vector_float_complex_view_array((float*)A##p,A##n)
80#define QMVIEW(A) gsl_matrix_float_complex_view A = gsl_matrix_float_complex_view_array((float*)A##p,A##r,A##c) 80#define QMVIEW(A) gsl_matrix_complex_float_view A = gsl_matrix_float_complex_view_array((float*)A##p,A##r,A##c)
81#define KFVVIEW(A) gsl_vector_float_const_view A = gsl_vector_float_const_view_array(A##p,A##n) 81#define KFVVIEW(A) gsl_vector_float_const_view A = gsl_vector_float_const_view_array(A##p,A##n)
82#define KFMVIEW(A) gsl_matrix_float_const_view A = gsl_matrix_float_const_view_array(A##p,A##r,A##c) 82#define KFMVIEW(A) gsl_matrix_float_const_view A = gsl_matrix_float_const_view_array(A##p,A##r,A##c)
83#define KQVVIEW(A) gsl_vector_float_complex_const_view A = gsl_vector_float_complex_const_view_array((float*)A##p,A##n) 83#define KQVVIEW(A) gsl_vector_complex_float_const_view A = gsl_vector_complex_float_const_view_array((float*)A##p,A##n)
84#define KQMVIEW(A) gsl_matrix_float_complex_const_view A = gsl_matrix_float_complex_const_view_array((float*)A##p,A##r,A##c) 84#define KQMVIEW(A) gsl_matrix_complex_float_const_view A = gsl_matrix_complex_float_const_view_array((float*)A##p,A##r,A##c)
85 85
86#define V(a) (&a.vector) 86#define V(a) (&a.vector)
87#define M(a) (&a.matrix) 87#define M(a) (&a.matrix)
@@ -103,6 +103,100 @@ void no_abort_on_error() {
103} 103}
104 104
105 105
106int sumF(KFVEC(x),FVEC(r)) {
107 DEBUGMSG("sumF");
108 REQUIRES(rn==1,BAD_SIZE);
109 int i;
110 float res = 0;
111 for (i = 0; i < xn; i++) res += xp[i];
112 rp[0] = res;
113 OK
114}
115
116int sumR(KRVEC(x),RVEC(r)) {
117 DEBUGMSG("sumR");
118 REQUIRES(rn==1,BAD_SIZE);
119 int i;
120 double res = 0;
121 for (i = 0; i < xn; i++) res += xp[i];
122 rp[0] = res;
123 OK
124}
125
126int sumQ(KQVEC(x),QVEC(r)) {
127 DEBUGMSG("sumQ");
128 REQUIRES(rn==1,BAD_SIZE);
129 int i;
130 gsl_complex_float res;
131 res.dat[0] = 0;
132 res.dat[1] = 0;
133 for (i = 0; i < xn; i++) {
134 res.dat[0] += xp[i].dat[0];
135 res.dat[1] += xp[i].dat[1];
136 }
137 rp[0] = res;
138 OK
139}
140
141int sumC(KCVEC(x),CVEC(r)) {
142 DEBUGMSG("sumC");
143 REQUIRES(rn==1,BAD_SIZE);
144 int i;
145 gsl_complex res;
146 res.dat[0] = 0;
147 res.dat[1] = 0;
148 for (i = 0; i < xn; i++) {
149 res.dat[0] += xp[i].dat[0];
150 res.dat[1] += xp[i].dat[1];
151 }
152 rp[0] = res;
153 OK
154}
155
156int dotF(KFVEC(x), KFVEC(y), FVEC(r)) {
157 DEBUGMSG("dotF");
158 REQUIRES(xn==yn,BAD_SIZE);
159 REQUIRES(rn==1,BAD_SIZE);
160 DEBUGMSG("dotF");
161 KFVVIEW(x);
162 KFVVIEW(y);
163 gsl_blas_sdot(V(x),V(y),rp);
164 OK
165}
166
167int dotR(KRVEC(x), KRVEC(y), RVEC(r)) {
168 DEBUGMSG("dotR");
169 REQUIRES(xn==yn,BAD_SIZE);
170 REQUIRES(rn==1,BAD_SIZE);
171 DEBUGMSG("dotR");
172 KDVVIEW(x);
173 KDVVIEW(y);
174 gsl_blas_ddot(V(x),V(y),rp);
175 OK
176}
177
178int dotQ(KQVEC(x), KQVEC(y), QVEC(r)) {
179 DEBUGMSG("dotQ");
180 REQUIRES(xn==yn,BAD_SIZE);
181 REQUIRES(rn==1,BAD_SIZE);
182 DEBUGMSG("dotQ");
183 KQVVIEW(x);
184 KQVVIEW(y);
185 gsl_blas_cdotu(V(x),V(y),rp);
186 OK
187}
188
189int dotC(KCVEC(x), KCVEC(y), CVEC(r)) {
190 DEBUGMSG("dotC");
191 REQUIRES(xn==yn,BAD_SIZE);
192 REQUIRES(rn==1,BAD_SIZE);
193 DEBUGMSG("dotC");
194 KCVVIEW(x);
195 KCVVIEW(y);
196 gsl_blas_zdotu(V(x),V(y),rp);
197 OK
198}
199
106int toScalarR(int code, KRVEC(x), RVEC(r)) { 200int toScalarR(int code, KRVEC(x), RVEC(r)) {
107 REQUIRES(rn==1,BAD_SIZE); 201 REQUIRES(rn==1,BAD_SIZE);
108 DEBUGMSG("toScalarR"); 202 DEBUGMSG("toScalarR");