Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/NFFT/nfft into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
passscoed committed Jul 19, 2024
2 parents de2674a + e9a1352 commit 3843638
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install libraries
run: |
sudo apt-get update
sudo apt-get install libfftw3-dev libcunit1-dev liboctave-dev julia
sudo apt-get install libfftw3-dev libcunit1-dev liboctave-dev doxygen-latex graphviz
- name: bootstrap
run: ./bootstrap.sh
- name: configure
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ Some examples for application of these transforms are provided:
Detailed API documentation in HTML format can be found in
`doc/html/index.html`, if you are working from a release tarball.
When working from a source repository, the documentation can be
generated with Doxygen.
generated with Doxygen (which requires the `doxygen-latex` and `perl` packages):
```
make doc
```

Building
--------
The NFFT depends on the [FFTW](https://fftw.org) library, which is available for many Linux distros, Homebrew on macOS and MSYS2 on Windows. If you compile the FFTW yourself, it should be configured with the flag `--enable-shared`.
The NFFT depends on the [FFTW](https://fftw.org) library, which is available for many Linux distros, Homebrew on macOS and MSYS2 on Windows. If you compile the FFTW yourself, it should be configured with the flag `--enable-shared` (and `--enable-threads` for the multi-threaded version). Building the NFFT requires `make` and a C compiler such as `gcc`.

When working from a source repository, you need to run libtoolize and autoreconf first. A bash script to do this is provided.
When working from a source repository, you need to run libtoolize and autoreconf first. A bash script to do this is provided. This step requries the tools `autoconf`, `automake` and `libtool`.
```
./bootstrap.sh
```
Expand All @@ -65,7 +65,7 @@ Here are some useful optional flags for `./configure`:
* `--enable-all` specifies that all modules should be compiled,
* `--enable-openmp` enables the multicore support and
* `--enable-julia` specifies that the julia interface will be compiled.
* `--with-matlab=/path/to/matlab` specifies a path of Matlab, and
* `--with-matlab=/path/to/matlab` specifies the path of a Matlab installation, and
* `--with-octave=/path/to/octave` does the same for GNU Octave.
* For a list of all available options, run `./configure --help`.

Expand All @@ -86,15 +86,25 @@ make install

Citing
------
The most current general paper, the one that we recommend if you wish to cite NFFT, is *Keiner, J., Kunis, S., and Potts, D.
The current general paper, the one that we recommend if you wish to cite NFFT, is *Keiner, J., Kunis, S., and Potts, D.
''Using NFFT 3 - a software library for various nonequispaced fast Fourier transforms''
ACM Trans. Math. Software,36, Article 19, 1-30, 2009*.
ACM Trans. Math. Software 36, Article 19, 1-30, 2009*. BibTeX entry:
```
@article{KeKuPo09,
author = {Jens Keiner and Stefan Kunis and Daniel Potts},
title = {Using {NFFT3} - a Software Library for Various Nonequispaced Fast {Fourier} Transforms},
journal = {{ACM} Trans. Math. Software},
year = {2009},
volume = {36},
pages = {Article 19, 1--30},
doi = {10.1145/1555386.1555388}}
```

Feedback
--------
Your comments are welcome! This is the third version of the library and may
not be as robust or well documented as it should be. Please keep track of bugs
or missing/confusing instructions and report them to
or missing/confusing instructions and report them in our issue tracker or directly to
[Daniel Potts](mailto:potts@mathematik.tu-chemnitz.de).
The postal address is

Expand Down
2 changes: 2 additions & 0 deletions applications/fastsum/fastsum.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
% 'cot' K(x) = cot(cx)
% 'one_over_cube' K(x) = 1/x^3
% 'laplacian_rbf' K(x) = EXP(-|x|/c)
% 'der_laplacian_rbf' K(x) = |x|/c EXP(-|x|/c)
% 'xx_gaussian' K(x) = x^2/c^2 EXP(-x^2/c^2)
% 'absx' K(x) = |x|
%
% Markus Fenn, 2006.

Expand Down
4 changes: 4 additions & 0 deletions applications/fastsum/fastsum_matlab.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ int main(int argc, char **argv)
kernel = log_sin;
else if (strcmp(s, "laplacian_rbf") == 0)
kernel = laplacian_rbf;
else if (strcmp(s, "der_laplacian_rbf") == 0)
kernel = der_laplacian_rbf;
else if (strcmp(s, "xx_gaussian") == 0)
kernel = xx_gaussian;
else if (strcmp(s, "absx") == 0)
kernel = absx;
else
{
printf("Unrecognized kernel function!\n");
Expand Down
4 changes: 4 additions & 0 deletions applications/fastsum/fastsum_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ int main(int argc, char **argv)
kernel = log_sin;
else if (strcmp(s, "laplacian_rbf") == 0)
kernel = laplacian_rbf;
else if (strcmp(s, "der_laplacian_rbf") == 0)
kernel = der_laplacian_rbf;
else if (strcmp(s, "xx_gaussian") == 0)
kernel = xx_gaussian;
else if (strcmp(s, "absx") == 0)
kernel = absx;
else
{
s = "multiquadric";
Expand Down
32 changes: 32 additions & 0 deletions applications/fastsum/kernels.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,22 @@ C laplacian_rbf(R x, int der, const R *param) /* K(x)=EXP(-|x|/c) */
return value;
}

C der_laplacian_rbf(R x, int der, const R *param) /* K(x)=|x|/c EXP(-|x|/c) */
{
R c = param[0];
R value = K(0.0);

switch (der)
{
case 0 : value = (FABS(x)/c)*EXP(-FABS(x)/c); break;
default:
value = (POW(K(-1.0),(R)der))*((FABS(x)-(R)der*c)/POW(c,(R)der+1))*EXP(-FABS(x)/c);
value *= 1 - 2 * ((x < K(0.0)) && (der % 2));
}

return value;
}

C xx_gaussian(R x, int der, const R *param) /* K(x)=x^2/c^2 EXP(-x^2/c^2) */
{
R c = param[0];
Expand All @@ -457,6 +473,22 @@ C xx_gaussian(R x, int der, const R *param) /* K(x)=x^2/c^2 EXP(-x^2/c^2) */
return value / (c*c);
}

C absx(R x, int der, const R *param) /* K(x)=|x| */
{
R value=K(0.0);

(void)param;

if (der == 0) value=FABS(x);
else if (der == 1){
if (x<0) value=K(-1.0);
else value=K(1.0);
}
else value=K(0.0);

return value;
}

/* \} */

/* kernels.c */
2 changes: 2 additions & 0 deletions applications/fastsum/kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ C kcot(R x, int der, const R *param); /**< K(x) = cot(cx) */
C one_over_cube(R x, int der, const R *param); /**< K(x) = 1/x^3 */
C log_sin(R x, int der, const R *param); /**< K(x) = log(|sin(cx)|) */
C laplacian_rbf(R x, int der, const R *param); /**< K(x) = exp(-|x|/c) */
C der_laplacian_rbf(R x, int der, const R *param); /**< K(x) = |x|/c exp(-|x|/c) */
C xx_gaussian(R x, int der, const R *param); /**< K(x) = x^2/c^2 exp(-x^2/c^2) */
C absx(R x, int der, const R *param); /**< K(x) = |x| */
/* \} */

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

m4_define([nfft_version_major], [3])
m4_define([nfft_version_minor], [5])
m4_define([nfft_version_patch], [3])
m4_define([nfft_version_patch], [4])
m4_define([nfft_version_type], [alpha])
m4_append([NFFT_VERSION], m4_expand([nfft_version_major.nfft_version_minor.nfft_version_patch]))
m4_append([NFFT_VERSION], m4_expand([nfft_version_type]))
Expand Down Expand Up @@ -278,7 +278,7 @@ AC_LANG(C)
AX_COMPILER_VENDOR

# check for C99 compliant mode (possibly with GNU extensions)
AC_PROG_CC
AC_PROG_CC_C99

# per-target flags
AM_PROG_CC_C_O
Expand Down
6 changes: 6 additions & 0 deletions julia/fastsum/libfastsumjulia.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ int jfastsum_init( fastsum_plan* p, int d, char* s, double* c, unsigned int f, i
kernel = log_sin;
else if ( strcmp(s, "laplacian_rbf") == 0 )
kernel = laplacian_rbf;
else if ( strcmp(s, "der_laplacian_rbf") == 0 )
kernel = der_laplacian_rbf;
else if ( strcmp(s, "xx_gaussian") == 0 )
kernel = xx_gaussian;
else if ( strcmp(s, "absx") == 0 )
kernel = absx;
else {
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions linux-build-mex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ set -ex
exec > >(tee linux-build-mex.log)
exec 2>&1

FFTWVERSION=3.3.9
GCCVERSION=8.5.0
FFTWVERSION=3.3.10
GCCVERSION=11.2.0
GCCARCH=haswell
BINARIES_ARCH_README='
Please note that since the binaries were compiled with gcc flag -march=haswell,
Expand Down
5 changes: 4 additions & 1 deletion m4/ax_prog_matlab.m4
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ AC_DEFUN([AX_PROG_MATLAB],
mac) matlab_mexext="mexmac";;
maci) matlab_mexext="mexmaci";;
maci64) matlab_mexext="mexmaci64";;
maca64) matlab_mexext="mexmaca64";;
sol64) matlab_mexext="mexs64";;
win32) matlab_mexext="mexw32";;
win64) matlab_mexext="mexw64";;
Expand Down Expand Up @@ -171,6 +172,7 @@ AC_DEFUN([AX_PROG_MATLAB],
mexmac) matlab_arch="mac";;
mexmaci) matlab_arch="maci";;
mexmaci64) matlab_arch="maci64";;
mexmaca64) matlab_arch="maca64";;
mexs64) matlab_arch="sol64";;
mexw32) matlab_arch="win32";;
mexw64) matlab_arch="win64";;
Expand All @@ -185,6 +187,7 @@ AC_DEFUN([AX_PROG_MATLAB],
mac) matlab_mexext="mexmac";;
maci) matlab_mexext="mexmaci";;
maci64) matlab_mexext="mexmaci64";;
maca64) matlab_mexext="mexmaca64";;
sol64) matlab_mexext="mexs64";;
win32) matlab_mexext="mexw32";;
win64) matlab_mexext="mexw64";;
Expand All @@ -205,7 +208,7 @@ AC_DEFUN([AX_PROG_MATLAB],
# dynamic library extension for architecture
case $matlab_arch in
glnx86|glnxa64|sol|sol64) matlab_libext=".so";;
mac|mac64|maci|maci64) matlab_libext=".dylib";;
mac|mac64|maci|maci64|maca64) matlab_libext=".dylib";;
win32|win64) matlab_libext=".dll";;
*) AC_MSG_ERROR([Unsupported or invalid architecture ${matlab_arch}.]);;
esac
Expand Down
6 changes: 3 additions & 3 deletions macos-build-mex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# A Matlab installation must be specified in order to build the
# Matlab interface. The paths should not contain spaces!
#
# The script is known to work on macOS 10.5 Catalina with Homebrew.
# The script is known to work on macOS 11 Big Sur with Homebrew.
#
# At least the following packages are required:
# octave gnu-sed cunit
Expand All @@ -19,11 +19,11 @@ set -ex

GCCARCH=haswell
FFTWDIR=/usr/local
GCC="gcc-9 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
GCC="gcc-11"

# default values (to be overwritten if respective parameters are set)
OCTAVEDIR=/usr/local

MATLABDIR=/Applications/MATLAB_R2021b.app
# read the options
TEMP=`getopt -o o:m:f:v: --long octave:,matlab:,matlab-version:,fftw: -n 'macos-build-mex.sh' -- "$@"`
eval set -- "$TEMP"
Expand Down
4 changes: 4 additions & 0 deletions matlab/fastsum/fastsummex.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ static kernel get_kernel(const mxArray *p)
ker = log_sin;
else if (strcmp(s, "laplacian_rbf") == 0)
ker = laplacian_rbf;
else if (strcmp(s, "der_laplacian_rbf") == 0)
ker = der_laplacian_rbf;
else if (strcmp(s, "xx_gaussian") == 0)
ker = xx_gaussian;
else if (strcmp(s, "absx") == 0)
ker = absx;
else
mexErrMsgTxt("fastsum: Unknown kernel function.");
return ker;
Expand Down
2 changes: 2 additions & 0 deletions matlab/fastsum/simple_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
% 'one_over_cube' K(x) = 1/x^3
% 'log_sin' K(x) = LOG(|SIN(cx)|)
% 'laplacian_rbf' K(x) = EXP(-|x|/c)
% 'der_laplacian_rbf' K(x) = |x|/c EXP(-|x|/c)
% 'xx_gaussian' K(x) = x^2/c^2 EXP(-x^2/c^2)
% 'absx' K(x) = |x|

%% Initialize parameters
d = 2; % number of dimensions
Expand Down
2 changes: 2 additions & 0 deletions matlab/fastsum/test_fastsum.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
% 'one_over_cube' K(x) = 1/x^3
% 'log_sin' K(x) = LOG(|SIN(cx)|)
% 'laplacian_rbf' K(x) = EXP(-|x|/c)
% 'der_laplacian_rbf' K(x) = |x|/c EXP(-|x|/c)
% 'xx_gaussian' K(x) = x^2/c^2 EXP(-x^2/c^2)
% 'absx' K(x) = |x|

%% Initialize parameters
d = 2; % number of dimensions
Expand Down
6 changes: 3 additions & 3 deletions windows-build-dll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The Matlab path should not contain spaces!
#
# Example call:
# ./nfft-build-dll.sh --fftw=3.3.8 --octave=5.2.0 --matlab=/c/path/to/matlab
# ./nfft-build-dll.sh --fftw=3.3.10 --octave=6.4.0 --matlab=/c/path/to/matlab
#
# WARNING: This script downloads and compiles FFTW and downloads GCC, Julia and Octave (requires ~ 3GB).
#
Expand All @@ -23,8 +23,8 @@ set -ex


# default values (to be overwritten if respective parameters are set)
FFTWVERSION=3.3.8
OCTAVEVERSION=5.2.0
FFTWVERSION=3.3.10
OCTAVEVERSION=6.4.0
MATLABVERSION=""
ARCH=64
GCCARCH=""
Expand Down

0 comments on commit 3843638

Please sign in to comment.