Skip to content

Commit 31bbf74

Browse files
authored
Merge pull request #51 from FastNFT/release-0.4
Release 0.4
2 parents 160e2f9 + cf0d1ed commit 31bbf74

96 files changed

Lines changed: 7699 additions & 1549 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
language: c
22

3+
install:
4+
- sudo apt-get remove -y cmake
5+
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
6+
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
7+
8+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
9+
CMAKE_URL="https://cmake.org/files/v3.17/cmake-3.17.3-Linux-x86_64.tar.gz";
10+
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake;
11+
export PATH=${DEPS_DIR}/cmake/bin:${PATH};
12+
else
13+
brew outdated cmake || brew upgrade cmake;
14+
fi
15+
- cmake --version
16+
- cd ..
17+
318
matrix:
419
include:
520
- os: linux
@@ -20,6 +35,7 @@ matrix:
2035
- gfortran-5
2136
- libfftw3-dev
2237

38+
2339
before_script:
2440
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 100
2541
- sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-5 100

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [0.4.0] -- 2020-07-08
4+
5+
### Added
6+
7+
- The routine fnft_nsev for the NFT of the vanishing nonlinear Schroedinger equation now supports higher-order discretizations. The new fourth-order discretizations 4SPLIT4A and 4SPLIT4B support fast computation. Furthermore, higher-order methods for the classical non-fast approach were added. See the documentation of nse_discretizations_t for more information.
8+
- The Matlab routine mex_fnft_nsev has been updated accordingly.
9+
- The routine fnft_nsep for the NFT of the periodic nonlinear Schroedinger equation can now find spectra of quasi-periodic signals. It also has support for 4SPLIT4A and 4SPLIT4B discretizations.
10+
- The Matlab routine mex_fnft_nsep has been updated accordingly.
11+
12+
### Changed
13+
14+
- The routine fnft_nsep for the NFT of the periodic nonlinear Schroedinger equation now only requires number of samples to be even (instead of a power of two). It has an extra input that specifies the phase shift over one quasi-period of the signal (see doc of fnft_nsep).
15+
- Improved computation of norming constants in fnft__nse_scatter_bound_states (see doc of fnft__nse_scatter_bound_states).
16+
317
## [0.3.0] -- 2020-03-06
418

519
### Added

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
# Sander Wahls (TU Delft) 2017-2018.
1717
# Marius Brehler (TU Dortmund) 2018.
1818

19-
cmake_minimum_required(VERSION 3.5)
19+
cmake_minimum_required(VERSION 3.17.3)
2020
project(fnft C)
2121

2222
set(FNFT_VERSION_MAJOR 0)
23-
set(FNFT_VERSION_MINOR 3)
23+
set(FNFT_VERSION_MINOR 4)
2424
set(FNFT_VERSION_PATCH 0)
2525
set(FNFT_VERSION_SUFFIX "") # should not be longer than FNFT_SUFFIX_MAXLEN
2626
set(FNFT_VERSION ${FNFT_VERSION_MAJOR}.${FNFT_VERSION_MINOR}.${FNFT_VERSION_PATCH}${FNFT_VERSION_SUFFIX})
@@ -207,7 +207,9 @@ if (WITH_MATLAB)
207207
message("++ Could not find a C++ compiler, which is sometimes required to localize Matlab.")
208208
message("++ If the build process fails, deactivate the localization with the -DWITH_MATLAB=OFF switch.")
209209
endif()
210+
210211
find_package(Matlab COMPONENTS MX_LIBRARY)
212+
211213
if (Matlab_FOUND)
212214
file(GLOB MEX_SOURCES "matlab/mex_*.c")
213215
foreach (srcfile ${MEX_SOURCES})

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,4 +2489,4 @@ GENERATE_LEGEND = YES
24892489
# The default value is: YES.
24902490
# This tag requires that the tag HAVE_DOT is set to YES.
24912491

2492-
DOT_CLEANUP = YES
2492+
DOT_CLEANUP = YES

Getting-Started.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ commands in a terminal.
1111
./fnft_nsep_example
1212
./fnft_kdvv_example
1313
./fnft_nsev_inverse_example
14+
./fnft_nsev_slow_example
1415

1516
The sources for the examples can be found in the same directory. The example binaries have already been built together with the library. If you want to see the exact commands that were used to compile the examples, replace the 'make -j4' command in the build process with
1617

@@ -23,9 +24,11 @@ If the MATLAB interface has been built, try the following in MATLAB
2324
mex_fnft_nsev_example
2425
mex_fnft_nsep_example
2526
mex_fnft_kdvv_example
26-
mex_fnft_inverse_example_1
27-
mex_fnft_inverse_example_2
28-
mex_fnft_inverse_example_3
27+
mex_fnft_nsev_inverse_example_1
28+
mex_fnft_nsev_inverse_example_2
29+
mex_fnft_nsev_inverse_example_3
30+
mex_fnft_nsev_slow_example_1
31+
mex_fnft_nsev_slow_example_2
2932

3033
## Documentation
3134

@@ -41,5 +44,6 @@ The MATLAB interface is documented in the usual way. Run the commands
4144
help mex_fnft_nsep
4245
help mex_fnft_kdvv
4346
help mex_fnft_nsev_inverse
47+
help mex_fnft_nsev_slow
4448

4549
in MATLAB to get more information.

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The following tools are needed in order to build FNFT:
66

7-
* [CMake](https://cmake.org/)
7+
* [CMake](https://cmake.org/), minimum version 3.17.3.
88
* A C compiler.
99
* A Fortran compiler.
1010

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# FNFT: Fast Nonlinear Fourier Transforms
22

3-
[![Build Status](https://travis-ci.org/FastNFT/FNFT.svg?branch=master)](https://travis-ci.org/FastNFT/FNFT) [![DOI](http://joss.theoj.org/papers/10.21105/joss.00597/status.svg)](https://doi.org/10.21105/joss.00597)
3+
[![Version](https://img.shields.io/github/v/release/FastNFT/FNFT)](https://github.com/FastNFT/FNFT/releases) [![Documentation](https://img.shields.io/badge/-documentation-informational)](https://fastnft.github.io/FNFT/) [![Build Status](https://travis-ci.org/FastNFT/FNFT.svg?branch=master)](https://travis-ci.org/FastNFT/FNFT) [![DOI](http://joss.theoj.org/papers/10.21105/joss.00597/status.svg)](https://doi.org/10.21105/joss.00597)
44

5-
FNFT is a software library for the fast numerical computation of (inverse) nonlinear Fourier transforms, which are also known as (inverse) scattering transforms. FNFT is written in C and comes with a MATLAB interface. A [Python interface](https://github.com/xmhk/FNFTpy) is available seperately.
5+
FNFT is a software library for the numerical computation of (inverse) nonlinear Fourier transforms, which are also known as (inverse) scattering transforms. The focus of the library is on fast algorithms, but it also contains non-fast methods. FNFT is written in C and comes with a MATLAB interface. A [Python interface](https://github.com/xmhk/FNFTpy) is available separately.
66

77
## Currently Implemented Cases
88

@@ -15,7 +15,7 @@ FNFT is a software library for the fast numerical computation of (inverse) nonli
1515
* Bound states (eigenvalues)
1616
* Norming constants and/or residues
1717

18-
* Periodic boundary conditions
18+
* (Quasi-)Periodic boundary conditions
1919
* Main spectrum
2020
* Auxiliary spectrum
2121

@@ -103,3 +103,7 @@ The algorithms in FNFT utilize ideas from the following references. More informa
103103
- S. Wahls and V. Vaibhav, ["Fast Inverse Nonlinear Fourier Transforms for Continuous Spectra of Zakharov-Shabat Type"](http://arxiv.org/abs/1607.01305v2), Withdrawn Preprint, Dec. 2016. arXiv:1607.01305v2 [cs.IT]
104104
- S. Wahls, ["Generation of Time-Limited Signals in the Nonlinear Fourier Domain via b-Modulation"](https://doi.org/10.1109/ECOC.2017.8346231), Proc. European Conference on Optical Communcation (ECOC), Gothenburg, Sweden, Sep. 2017.
105105
- J. Skaar, L. Wang and T. Erdogan, ["On the synthesis of fiber Bragg gratings by layer peeling"](https://doi.org/10.1109/3.903065), IEEE Journal of Quantum Electronics, vol. 37, no. 2, pp. 165--173, Feb. 2001.
106+
- S. Chimmalgi, P. J. Prins and S. Wahls, ["Fast Nonlinear Fourier Transform Algorithms Using Higher Order Exponential Integrators"](https://doi.org/10.1109/ACCESS.2019.2945480), IEEE Access, vol. 7, pp. 145161--145176, Oct. 2019.
107+
- P. J. Prins and S. Wahls, ["Soliton Phase Shift Calculation for the Korteweg–De Vries Equation"](https://doi.org/10.1109/ACCESS.2019.2932256), IEEE Access, vol. 7, pp. 122914--122930, July 2019.
108+
- S. Medvedev, I. Vaseva, I. Chekhovskoy and M. Fedoruk, ["Exponential fourth order schemes for direct Zakharov-Shabat problem"](https://doi.org/10.1364/OE.377140), Optics Express, vol. 28, pp. 20--39, 2020.
109+
- J. Mertsching, ["Quasiperiodie Solutions of the Nonlinear Schroedinger Equation"](https://doi.org/10.1002/prop.2190350704), Fortschritte der Physik, vol. 35, pp. 519--536, 1987.

examples/fnft_nsep_example.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int main()
3636
FNFT_COMPLEX q[D];
3737

3838
// Location of the 1st time-domain sample and the beginning of the next
39-
// period. Note: The last sample is thus located at t=T[1]-(T[1]-T[0])/D.
39+
// period. Location of last sample is T[1]-eps_t
4040
FNFT_REAL T[2] = { 0.0, 2.0*FNFT_PI };
4141

4242
// Define a simple rectangular signal
@@ -63,8 +63,11 @@ int main()
6363
FNFT_COMPLEX aux_spec[M];
6464

6565
// Focusing nonlinear Schroedinger equation
66-
int kappa = +1;
66+
FNFT_INT kappa = +1;
6767

68+
// Phase shift over one period
69+
FNFT_REAL phase_shift = 0.0;
70+
6871
// Default options
6972
fnft_nsep_opts_t opts = fnft_nsep_default_opts();
7073

@@ -78,9 +81,9 @@ int main()
7881

7982
// See the header file fnft_nsep.h for other options
8083

81-
/** Step 3: Call fnft_nsev and check for errors **/
84+
/** Step 3: Call fnft_nsep and check for errors **/
8285

83-
int ret_code = fnft_nsep(D, q, T, &K, main_spec, &M, aux_spec, NULL, kappa,
86+
FNFT_INT ret_code = fnft_nsep(D, q, T, phase_shift, &K, main_spec, &M, aux_spec, NULL, kappa,
8487
&opts);
8588
if (ret_code != FNFT_SUCCESS) {
8689
printf("An error occured!\n");

examples/fnft_nsev_example_2.c

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* This file is part of FNFT.
3+
*
4+
* FNFT is free software; you can redistribute it and/or
5+
* modify it under the terms of the version 2 of the GNU General
6+
* Public License as published by the Free Software Foundation.
7+
*
8+
* FNFT is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*
16+
* Contributors:
17+
* Sander Wahls (TU Delft) 2018.
18+
* Shrinivas Chimmalgi (TU Delft) 2020.
19+
*/
20+
21+
// This example demonstrates the use of the function fnft_nsev, which
22+
// implements the nonlinear Fourier transform with respect to the nonlinear
23+
// Schroedinger equation with vanishing boundary conditions. The signal is the
24+
// same rectangular pulse as in Sec. VI.B of the paper
25+
// https://doi.org/10.1109/TIT.2014.2321151
26+
27+
#include <stdio.h> // for printf
28+
#include "fnft_nsev.h"
29+
30+
int main()
31+
{
32+
/** Step 1: Set up the signal **/
33+
34+
// Number of time-domain samples. Increase to improve precision of results.
35+
FNFT_UINT D = 256;
36+
37+
// Contains the samples of q(t)
38+
FNFT_COMPLEX q[D];
39+
40+
// Location of the 1st and last time-domain sample
41+
FNFT_REAL T[2] = { -1.0, 1.0 };
42+
43+
// Define a simple rectangular signal
44+
for (FNFT_UINT i=0; i<D; i++) {
45+
// The line below would determine the location of the current sample
46+
//FNFT_REAL t = T[0] + i*(T[1]-T[0])/(D-1);
47+
q[i] = 2.0 + 0.0*I;
48+
}
49+
50+
// The types FNFT_UINT, FNFT_INT, FNFT_REAL and FNFT_COMPLEX are defined
51+
// in the header fnft_numtypes.h
52+
53+
/** Step 2: Prepare calling fnft_nsev_slow **/
54+
55+
// Location of the 1st and last sample of the continuous spectrum
56+
FNFT_REAL XI[2] = {-2.0, 2.0 };
57+
58+
// Number of samples of the continuous spectrum
59+
FNFT_UINT M = 8;
60+
61+
// Buffer for result: Samples of the continuous spectrum
62+
FNFT_COMPLEX contspec[M];
63+
64+
// Maximum number of bound states we expect = size of the two arrays below
65+
FNFT_UINT K = 1;
66+
67+
// Buffer for result: Bound states
68+
FNFT_COMPLEX bound_states[K];
69+
70+
// Buffer for result: Norming constants
71+
FNFT_COMPLEX normconsts[K];
72+
73+
// Focusing nonlinear Schroedinger equation
74+
int kappa = +1;
75+
76+
// Default options
77+
fnft_nsev_opts_t opts = fnft_nsev_default_opts();
78+
79+
// Selecting options to use Newton search to find the eigenvalues with
80+
// CF4_2 discretization
81+
opts.bound_state_localization = fnft_nsev_bsloc_NEWTON;
82+
opts.discretization = fnft_nse_discretization_CF4_2;
83+
84+
// Supplying the initial guesses for the bound state.
85+
bound_states[0] = 1*I;
86+
87+
// Uncomment the next line to compute residues instead of norming constants
88+
//opts.discspec_type = fnft_nsev_dstype_RESIDUES;
89+
90+
// See the header file fnft_nsev.h for other options
91+
92+
/** Step 3: Call fnft_nsev and check for errors **/
93+
94+
int ret_code = fnft_nsev(D, q, T, M, contspec, XI, &K, bound_states,
95+
normconsts, kappa, &opts);
96+
if (ret_code != FNFT_SUCCESS) {
97+
printf("An error occured!\n");
98+
return EXIT_FAILURE;
99+
}
100+
101+
/** Step 4: Print the results **/
102+
103+
printf("Number of samples:\n D = %u\n", (unsigned int)D);
104+
105+
FNFT_REAL eps_xi = (XI[1] - XI[0]) / (M - 1);
106+
printf("Continuous spectrum:\n");
107+
for (FNFT_UINT i=0; i<M; i++) {
108+
FNFT_REAL xi = XI[0] + i*eps_xi;
109+
printf(" continuous_spectrum(xi=%f) \t= %g + %gI\n",
110+
(double)xi,
111+
(double)FNFT_CREAL(contspec[i]),
112+
(double)FNFT_CIMAG(contspec[i])
113+
);
114+
}
115+
116+
printf("Discrete spectrum:\n");
117+
for (FNFT_UINT i=0; i<K; i++) {
118+
printf(" bound state at %g + %gI with norming constant %g + %gI\n",
119+
(double)FNFT_CREAL(bound_states[i]),
120+
(double)FNFT_CIMAG(bound_states[i]),
121+
(double)FNFT_CREAL(normconsts[i]),
122+
(double)FNFT_CIMAG(normconsts[i])
123+
);
124+
}
125+
126+
return EXIT_SUCCESS;
127+
}

examples/mex_fnft_nsep_example.m

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,47 @@
1313
% along with this program. If not, see <http://www.gnu.org/licenses/>.
1414
%
1515
% Contributors:
16-
% Sander Wahls (TU Delft) 2017-2018, 2020.
16+
% Sander Wahls (TU Delft) 2017-2018.
17+
% Shrinivas Chimmalgi (TU Delft) 2020.
1718

1819
% This examples demonstrates how the nonlinear Fourier transform with
1920
% respect to the nonlinear Schroedinger equation with periodic boundary
20-
% conditions can be computed using mex_fnft_nsev. The signal is the same
21-
% plane wave as in Section VII.A of the paper
22-
% https://doi.org/10.1109/TIT.2015.2485944
21+
% conditions can be computed using mex_fnft_nsep. The signal is the same
22+
% plane wave as in the paper https://doi.org/10.1109/TIT.2015.2485944
23+
2324

2425
clear all;
2526
close all;
2627

2728
%%% Setup parameters %%%
2829

2930
T = [0, 2*pi]; % T(1) is the beginning of the period, T(2) is the end
30-
D = 2^8; % number of samples
31+
D = 300; % number of samples(NOTE: This has to be a even positive integer)
3132
kappa = +1; % focusing nonlinear Schroedinger equation
3233

3334
%%% Setup the signal %%%
3435

3536
t = T(1) + (0:D-1)*(T(2) - T(1))/D;
36-
% Note: The location of the 1st sample is T(1), but the location of the
37-
% sample if T(2) - (T(2)-T(1)/D.
37+
% Note: The location of the 1st sample is
38+
% T(1), but the location of the last sample is T(2) - (T(2)-T(1)/D,
3839
q = 3*exp(3j*t);
3940

41+
q_T1 = 3*exp(3j*T(1));
42+
q_T2 = 3*exp(3j*T(2));
43+
phase_shift = angle(q_T2/q_T1); % This is the phase shift in q over
44+
% on period. It will be 0 for exactly periodic signals.
45+
4046
%%% Compute the nonlinear Fourier transform %%%
4147

42-
[main_spec, aux_spec] = mex_fnft_nsep(q, T, kappa);
48+
[main_spec, aux_spec] = mex_fnft_nsep(q, T, kappa, 'phase_shift', phase_shift);
4349

4450
%%% Compute the spines %%%
4551

4652
% This signal has one non-degenerate spine, i.e., the imaginary
4753
% interval [-3j, 3j]. Furthermore, there are degenerate spines
4854
% of length zero at the degenerate points of the main spectrum.
4955

50-
spines = mex_fnft_nsep(q, T, kappa, 'points_per_spine', 100);
56+
spines = mex_fnft_nsep(q, T, kappa, 'phase_shift', phase_shift, 'points_per_spine', 100);
5157

5258
% Increase the number of points per spine above to improve the
5359
% resolution of the spine (at the cost of increased run times).

0 commit comments

Comments
 (0)