NFFT 3.5.3alpha
vector1.c
1/*
2 * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
7 * version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#include "infft.h"
20
22R Y(dot_complex)(C *x, INT n)
23{
24 INT k;
25 R dot;
26
27 for (k = 0, dot = K(0.0); k < n; k++)
28 dot += CONJ(x[k])*x[k];
29
30 return dot;
31}
32
34R Y(dot_double)(R *x, INT n)
35{
36 INT k;
37 R dot;
38
39 for (k = 0, dot = K(0.0); k < n; k++)
40 dot += x[k]*x[k];
41
42 return dot;
43}
44
45
47R Y(dot_w_complex)(C *x, R *w, INT n)
48{
49 INT k;
50 R dot;
51
52 for (k = 0, dot = K(0.0); k < n; k++)
53 dot += w[k]*CONJ(x[k])*x[k];
54
55 return dot;
56}
57
59R Y(dot_w_double)(R *x, R *w, INT n)
60{
61 INT k;
62 R dot;
63
64 for (k = 0, dot = K(0.0); k < n; k++)
65 dot += w[k]*x[k]*x[k];
66
67 return dot;
68}
69
70
72R Y(dot_w_w2_complex)(C *x, R *w, R *w2, INT n)
73{
74 INT k;
75 R dot;
76
77 for (k = 0, dot = K(0.0); k < n; k++)
78 dot += w[k]*w2[k]*w2[k]*CONJ(x[k])*x[k];
79
80 return dot;
81}
82
84R Y(dot_w2_complex)(C *x, R *w2, INT n)
85{
86 INT k;
87 R dot;
88
89 for (k = 0, dot = K(0.0); k < n; k++)
90 dot+=w2[k]*w2[k]*CONJ(x[k])*x[k];
91
92 return dot;
93}
Internal header file for auxiliary definitions and functions.