NFFT  3.3.1
damp.c
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 
00025 R Y(modified_fejer)(const INT N, const INT kk)
00026 {
00027   return (K(2.0) / ((R) (N * N))
00028       * (K(1.0) - FABS(K(2.0) * ((R) kk) + K(1.0) ) / ((R) N)));
00029 }
00030 
00032 R Y(modified_jackson2)(const INT N, const INT kk)
00033 {
00034   INT kj;
00035   const R n = (((R) N) / K(2.0) + K(1.0) ) / K(2.0);
00036   R result, k;
00037 
00038   for (result = K(0.0), kj = kk; kj <= kk + 1; kj++)
00039   {
00040     k = (R)(ABS(kj));
00041 
00042     if (k / n < K(1.0) )
00043       result += K(1.0)
00044           - (K(3.0) * k + K(6.0) * n * POW(k, K(2.0) )
00045               - K(3.0) * POW(k, K(3.0) ))
00046               / (K(2.0) * n * (K(2.0) * POW(n, K(2.0) ) + K(1.0) ));
00047     else
00048       result += (K(2.0) * n - k) * (POW(2 * n - k, K(2.0) ) - K(1.0) )
00049           / (K(2.0) * n * (K(2.0) * POW(n, K(2.0) ) + K(1.0) ));
00050   }
00051 
00052   return result;
00053 }
00054 
00056 R Y(modified_jackson4)(const INT N, const INT kk)
00057 {
00058   INT kj;
00059   const R n = (((R) N) / K(2.0) + K(3.0) ) / K(4.0);
00060   const R normalisation = (K(2416.0) * POW(n, K(7.0) )
00061       + K(1120.0) * POW(n, K(5.0) ) + K(784.0) * POW(n, K(3.0) ) + K(720.0) * n);
00062   R result, k;
00063 
00064   for (result = K(0.0), kj = kk; kj <= kk + 1; kj++)
00065   {
00066     k = (R)(ABS(kj));
00067 
00068     if (k / n < K(1.0) )
00069       result += K(1.0)
00070           - (K(1260.0) * k
00071               + (K(1680.0) * POW(n, K(5.0) ) + K(2240.0) * POW(n, K(3.0) )
00072                   + K(2940.0) * n) * POW(k, K(2.0) )
00073               - K(1715.0) * POW(k, K(3.0) )
00074               - (K(560.0) * POW(n, K(3.0) ) + K(1400.0) * n) * POW(k, K(4.0) )
00075               + K(490.0) * POW(k, K(5.0) ) + K(140.0) * n * POW(k, K(6.0) )
00076               - K(35.0) * POW(k, K(7.0) )) / normalisation;
00077 
00078     if ((K(1.0) <= k / n) && (k / n < K(2.0) ))
00079       result += ((K(2472.0) * POW(n, K(7.0) ) + K(336.0) * POW(n, K(5.0) )
00080           + K(3528.0) * POW(n, K(3.0) ) - K(1296.0) * n)
00081           - (K(392.0) * POW(n, K(6.0) ) - K(3920.0) * POW(n, K(4.0) )
00082               + K(8232.0) * POW(n, K(2.0) ) - K(756.0) )*k
00083           - (K(504.0)*POW(n, K(5.0)) + K(10080.0)*POW(n, K(3.0))
00084               - K(5292.0)*n)*POW(k, K(2.0)) - (K(1960.0)*POW(n, K(4.0))
00085               - K(7840.0)*POW(n, K(2.0)) + K(1029.0))*POW(k, K(3.0))
00086           + (K(2520.0)*POW(n, K(3.0)) - K(2520.0)*n) * POW(k, K(4.0))
00087           - (K(1176.0)*POW(n, K(2.0)) - K(294.0)) * POW(k, K(5.0))
00088           + K(252.0)*n*POW(k, K(6.0)) - K(21.0)*POW(k, K(7.0)))/normalisation;
00089 
00090     if ((K(2.0) <= k / n) && (k / n < K(3.0) ))
00091       result += (-(K(1112.0) * POW(n, K(7.0) ) - K(12880.0) * POW(n, K(5.0) )
00092           + K(7448.0) * POW(n, K(3.0) ) - K(720.0) * n)
00093           + (K(12152.0) * POW(n, K(6.0) ) - K(27440.0) * POW(n, K(4.0) )
00094               + K(8232.0) * POW(n, K(2.0) ) - K(252.0) )*k
00095           - (K(19320.0)*POW(n, K(5.0)) - K(21280.0)*POW(n, K(3.0))
00096               + K(2940.0)*n)*POW(k, K(2.0)) + (K(13720.0)*POW(n, K(4.0))
00097               - K(7840.0)*POW(n, K(2.0)) + K(343.0))*POW(k, K(3.0))
00098           - (K(5320.0)*POW(n, K(3.0)) - K(1400.0)*n)*POW(k, K(4.0))
00099           + (K(1176.0)*POW(n, K(2.0)) - K(98.0))*POW(k, K(5.0))
00100           - K(140.0)*n*POW(k, K(6.0)) + K(7.0) * POW(k, K(7.0)))/normalisation;
00101 
00102     if ((K(3.0) <= k / n) && (k / n < K(4.0) ))
00103       result += ((4 * n - k)
00104           * (POW(4 * n - k, K(2.0) ) - K(1.0) )*(POW(4*n-k, K(2.0))
00105               - K(4.0))*(POW(4*n-k, K(2.0)) - K(9.0)))/normalisation;
00106         }
00107 
00108   return result;
00109 }
00110 
00112 R Y(modified_sobolev)(const R mu, const INT kk)
00113 {
00114   R result;
00115   INT kj, k;
00116 
00117   for (result = K(0.0), kj = kk; kj <= kk + 1; kj++)
00118   {
00119     k = ABS(kj);
00120     if (k == 0)
00121       result += K(1.0);
00122     else
00123       result += POW((R) k, -K(2.0) * mu);
00124   }
00125 
00126   return result;
00127 }
00128 
00130 R Y(modified_multiquadric)(const R mu, const R c, const INT kk)
00131 {
00132   R result;
00133   INT kj, k;
00134 
00135   for (result = K(0.0), kj = kk; kj <= kk + 1; kj++)
00136   {
00137     k = ABS(kj);
00138     result += POW((R)(k * k) + c * c, -mu);
00139   }
00140 
00141   return result;
00142 }