![]() |
NFFT
3.3.1
|
00001 /* 00002 * Copyright (c) 2002, 2016 Jens Keiner, Stefan Kunis, Daniel Potts 00003 * 00004 * This program is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU General Public License as published by the Free Software 00006 * Foundation; either version 2 of the License, or (at your option) any later 00007 * version. 00008 * 00009 * This program is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU General Public License along with 00015 * this program; if not, write to the Free Software Foundation, Inc., 51 00016 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "infft.h" 00020 00022 R Y(dot_complex)(C *x, INT n) 00023 { 00024 INT k; 00025 R dot; 00026 00027 for (k = 0, dot = K(0.0); k < n; k++) 00028 dot += CONJ(x[k])*x[k]; 00029 00030 return dot; 00031 } 00032 00034 R Y(dot_double)(R *x, INT n) 00035 { 00036 INT k; 00037 R dot; 00038 00039 for (k = 0, dot = K(0.0); k < n; k++) 00040 dot += x[k]*x[k]; 00041 00042 return dot; 00043 } 00044 00045 00047 R Y(dot_w_complex)(C *x, R *w, INT n) 00048 { 00049 INT k; 00050 R dot; 00051 00052 for (k = 0, dot = K(0.0); k < n; k++) 00053 dot += w[k]*CONJ(x[k])*x[k]; 00054 00055 return dot; 00056 } 00057 00059 R Y(dot_w_double)(R *x, R *w, INT n) 00060 { 00061 INT k; 00062 R dot; 00063 00064 for (k = 0, dot = K(0.0); k < n; k++) 00065 dot += w[k]*x[k]*x[k]; 00066 00067 return dot; 00068 } 00069 00070 00072 R Y(dot_w_w2_complex)(C *x, R *w, R *w2, INT n) 00073 { 00074 INT k; 00075 R dot; 00076 00077 for (k = 0, dot = K(0.0); k < n; k++) 00078 dot += w[k]*w2[k]*w2[k]*CONJ(x[k])*x[k]; 00079 00080 return dot; 00081 } 00082 00084 R Y(dot_w2_complex)(C *x, R *w2, INT n) 00085 { 00086 INT k; 00087 R dot; 00088 00089 for (k = 0, dot = K(0.0); k < n; k++) 00090 dot+=w2[k]*w2[k]*CONJ(x[k])*x[k]; 00091 00092 return dot; 00093 }