NFFT
3.4.1
Main Page
Modules
Data Structures
Files
File List
Globals
kernel
util
sinc.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
21
R Y(sinc)(
const
R x)
22
{
23
/* Based on sinc function from Boost C++ library. */
24
const
R b = NFFT_EPSILON;
25
const
R bs = SQRT(b);
26
const
R bs2 = SQRT(bs);
27
28
if
(FABS(x) >= bs2)
29
return
SIN(x)/x;
30
else
31
{
32
R r = K(1.0);
33
34
if
(FABS(x) >= b)
35
{
36
const
R x2 = x * x;
37
r -= x2 / K(6.0);
38
39
if
(FABS(x) >= bs)
40
r += (x2 * x2) / K(120.0);
41
}
42
43
return
r;
44
}
45
}
Generated on Thu Apr 12 2018 21:00:50 for NFFT by
1.8.6