FNFT
|
Files | |
file | fnft__nse_discretization.h |
Properties of the discretizations for the nonlinear Schroedinger equation. | |
file | fnft__nse_finvscatter.h |
Recovers the signal from a scattering matrix. | |
file | fnft__nse_fscatter.h |
Computes the polynomial approximation of the combined scattering matrix. | |
file | fnft__nse_scatter.h |
Slow forward scattering. | |
file | fnft__nsep_testcases.h |
Provides test cases for the tests of fnft_nsep. | |
file | fnft__nsev_testcases.h |
Provides test cases for the tests of fnft_nsev. | |
Enumerations | |
enum | fnft__nsep_testcases_t { fnft__nsep_testcases_PLANE_WAVE_FOCUSING , fnft__nsep_testcases_CONSTANT_DEFOCUSING } |
enum | fnft__nsev_testcases_t { fnft__nsev_testcases_SECH_FOCUSING , fnft__nsev_testcases_SECH_DEFOCUSING , fnft__nsev_testcases_TRUNCATED_SOLITON , fnft__nsev_testcases_SECH_FOCUSING2 , fnft__nsev_testcases_SECH_FOCUSING_CONTSPEC } |
Functions | |
FNFT_UINT | fnft__nse_discretization_degree (fnft_nse_discretization_t nse_discretization) |
This routine returns the max degree \(d\) of the polynomials in a single scattering matrix or zero if the discretization is unknown. | |
FNFT_REAL | fnft__nse_discretization_boundary_coeff (fnft_nse_discretization_t nse_discretization) |
This routine returns the boundary coefficient based on the discretization. | |
FNFT_UINT | fnft__nse_discretization_upsampling_factor (fnft_nse_discretization_t discretization) |
This routine returns the scaling for effective number of samples based on the discretization. | |
FNFT_UINT | fnft__nse_discretization_method_order (fnft_nse_discretization_t discretization) |
This routine returns the order of the method based on the discretization. | |
FNFT_INT | fnft__nse_discretization_to_akns_discretization (fnft_nse_discretization_t nse_discretization, fnft__akns_discretization_t *const akns_discretization) |
This routine returns akns discretization related to the given nse discretization. | |
FNFT_INT | fnft__nse_discretization_lambda_to_z (const FNFT_UINT n, const FNFT_REAL eps_t, FNFT_COMPLEX *const vals, fnft_nse_discretization_t discretization) |
This routine maps \(\lambda\) from continuous-time domain to \(z\) in the discrete-time domain based on the discretization. | |
FNFT_INT | fnft__nse_discretization_z_to_lambda (const FNFT_UINT n, const FNFT_REAL eps_t, FNFT_COMPLEX *const vals, fnft_nse_discretization_t discretization) |
This routine maps \(z\) from the discrete-time domain to \(\lambda\) in the continuous-time domain based on the discretization. | |
FNFT_INT | fnft__nse_discretization_phase_factor_rho (const FNFT_REAL eps_t, const FNFT_REAL T1, FNFT_REAL *const phase_factor_rho, fnft_nse_discretization_t nse_discretization) |
This routine returns the phase factor for reflection coefficient ( \(\rho\)). It is required for applying boundary conditions to the transfer_matrix based on the discretization. | |
FNFT_INT | fnft__nse_discretization_phase_factor_a (const FNFT_REAL eps_t, const FNFT_UINT D, FNFT_REAL const *const T, FNFT_REAL *const phase_factor_a, fnft_nse_discretization_t nse_discretization) |
This routine returns the phase factor for a coefficient. It is required for applying boundary conditions to the transfer_matrix based on the discretization. | |
FNFT_INT | fnft__nse_discretization_phase_factor_b (const FNFT_REAL eps_t, const FNFT_UINT D, FNFT_REAL const *const T, FNFT_REAL *const phase_factor_b, fnft_nse_discretization_t nse_discretization) |
This routine returns the phase factor for b coefficient. It is required for applying boundary conditions to the transfer_matrix based on the discretization. | |
FNFT_INT | fnft__nse_discretization_preprocess_signal (const FNFT_UINT D, FNFT_COMPLEX const *const q, FNFT_REAL const eps_t, const FNFT_INT kappa, FNFT_UINT *const Dsub_ptr, FNFT_COMPLEX **q_preprocessed_ptr, FNFT_COMPLEX **r_preprocessed_ptr, FNFT_UINT *const first_last_index, fnft_nse_discretization_t discretization) |
This routine preprocesses the signal by resampling and subsampling based on the discretization. The preprocessing is necessary for higher-order methods. | |
FNFT_INT | fnft__nse_discretization_method_weights (FNFT_COMPLEX **qr_weights_ptr, FNFT_COMPLEX **eps_t_weights_ptr, fnft_nse_discretization_t const nse_discretization) |
This routine computes various weights required by some methods based on the discretization. | |
FNFT_INT | fnft__nse_finvscatter (const FNFT_UINT deg, FNFT_COMPLEX *const transfer_matrix, FNFT_COMPLEX *const q, const FNFT_REAL eps_t, const FNFT_INT kappa, const fnft_nse_discretization_t discretization) |
Recovers the samples that corresponding to a transfer matrix fast. | |
FNFT_UINT | fnft__nse_fscatter_numel (FNFT_UINT D, fnft_nse_discretization_t discretization) |
Returns the length of transfer_matrix to be allocated based on the number of samples and discretization. | |
FNFT_INT | fnft__nse_fscatter (const FNFT_UINT D, FNFT_COMPLEX const *const q, FNFT_COMPLEX const *const r, const FNFT_REAL eps_t, FNFT_COMPLEX *const result, FNFT_UINT *const deg_ptr, FNFT_INT *const W_ptr, fnft_nse_discretization_t const discretization) |
Fast computation of polynomial approximation of the combined scattering matrix. | |
FNFT_INT | fnft__nse_scatter_bound_states (FNFT_UINT const D, FNFT_COMPLEX const *const q, FNFT_COMPLEX const *const r, FNFT_REAL const *const T, FNFT_UINT const K, FNFT_COMPLEX *const bound_states, FNFT_COMPLEX *const a_vals, FNFT_COMPLEX *const aprime_vals, FNFT_COMPLEX *const b, FNFT_INT *const Ws, fnft_nse_discretization_t const discretization, FNFT_UINT const skip_b_flag) |
Computes \(a(\lambda)\), \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\) and \(b(\lambda)\) for complex values \(\lambda\) assuming that they are very close to the true bound-states. | |
FNFT_INT | fnft__nse_scatter_matrix (const FNFT_UINT D, FNFT_COMPLEX const *const q, FNFT_COMPLEX const *const r, const FNFT_REAL eps_t, const FNFT_INT kappa, const FNFT_UINT K, FNFT_COMPLEX const *const lambda, FNFT_COMPLEX *const result, FNFT_INT *const W, fnft_nse_discretization_t const discretization, const FNFT_UINT derivative_flag) |
Computes the scattering matrix and its derivative. | |
FNFT_INT | fnft__nsep_testcases_test_fnft (fnft__nsep_testcases_t tc, FNFT_UINT D, FNFT_REAL error_bounds[3], fnft_nsep_opts_t *const opts) |
This routine is used by the tests for fnft_nsep. | |
FNFT_INT | fnft__nsev_testcases_test_fnft (fnft__nsev_testcases_t tc, FNFT_UINT D, const FNFT_REAL eb[6], fnft_nsev_opts_t *const opts) |
Routine to run tests for fnft_nsev. . | |
List of currently implemented test cases for the NSE with periodic boundary conditions.
fnft__nsep_testcases_PLANE_WAVE_FOCUSING : Test for focusing NSE (kappa = +1) with a plane wave signal.
fnft__nsep_testcases_CONSTANT_DEFOCUSING : Test for defocusing NSE (kappa = -1) with a constant signal.
List of currently implemented test cases for the NSE with vanishing boundary conditions.
fnft__nsev_testcases_SECH_FOCUSING : Test for focusing NSE (kappa = +1) with a sech potential.
fnft__nsev_testcases_SECH_DEFOCUSING : Test for defocusing NSE (kappa = -1) with a sech potential.
fnft__nsev_testcases_TRUNCATED_SOLITON : Test for focusing NSE (kappa = +1) with a truncated solitonic potential.
fnft__nsev_testcases_SECH_FOCUSING2 : Test for focusing NSE (kappa = +1) with a sech potential with five bound states.
fnft__nsev_testcases_SECH_FOCUSING_CONTSPEC : Test for focusing NSE (kappa = +1) with a sech potential. Only checking continuous spectrum.
FNFT_REAL fnft__nse_discretization_boundary_coeff | ( | fnft_nse_discretization_t | nse_discretization | ) |
This routine returns the boundary coefficient based on the discretization.
The boundary coefficient is the fraction of the step size that a discretized potential extends beyond the last sample. This routine returns this value based on the discretization of type fnft_nse_discretization_t.
[in] | nse_discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. |
FNFT_UINT fnft__nse_discretization_degree | ( | fnft_nse_discretization_t | nse_discretization | ) |
This routine returns the max degree \(d\) of the polynomials in a single scattering matrix or zero if the discretization is unknown.
[in] | nse_discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_lambda_to_z | ( | const FNFT_UINT | n, |
const FNFT_REAL | eps_t, | ||
FNFT_COMPLEX *const | vals, | ||
fnft_nse_discretization_t | discretization | ||
) |
This routine maps \(\lambda\) from continuous-time domain to \(z\) in the discrete-time domain based on the discretization.
This routine maps continuous-time domain value lambda to discrete-time domain value \(z = e^{2j\lambda\epsilon_t degree1step)\), where degree1step is based on the discretization of type fnft_nse_discretization_t. Changes discretization to fnft__akns_discretization_t type and calls fnft__akns_discretization_lambda_to_z.
[in] | n | Number of values to be mapped. |
[in] | eps_t | Real-valued discretization step-size. |
[in,out] | vals | Pointer to location of first element of array containing complex-valued continuous-time domain spectral parameter \(\lambda\). The values are replaced with discrete-time domain values \(z\). |
[in] | discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_UINT fnft__nse_discretization_method_order | ( | fnft_nse_discretization_t | discretization | ) |
This routine returns the order of the method based on the discretization.
Different numerical methods have different orders of accuray. This routine returns the order of the order based on the discretization of type fnft_nse_discretization_t. When the step-size of the signal samples is reduced by a factor \(s\), the error in the computed values is expected to decrease by a factor \(s^{order}\).
[in] | discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_method_weights | ( | FNFT_COMPLEX ** | qr_weights_ptr, |
FNFT_COMPLEX ** | eps_t_weights_ptr, | ||
fnft_nse_discretization_t const | nse_discretization | ||
) |
This routine computes various weights required by some methods based on the discretization.
This routing computes the special weights required for the higher-order methods CF \(^{[4]}_2\), CF \(^{[4]}_3\), CF \(^{[5]}_3\) and CF \(^{[6]}_4\). The weights are used in fnft__nse_discretization_preprocess_signal, fnft__akns_scatter_matrix and fnft__nse_scatter_bound_states. The weights for CF \(^{[4]}_3\) are taken from Alvermann and Fehske (Journal of Computational Phys. 230, 2011) and the weights for the others are from Blanes, Casas and Thalhammer(Computer Phys. Comm. 220, 2017). The weights are mentioned as matrices in the references. This routine returns them in row-major order.
[in,out] | qr_weights_ptr | Pointer to the starting location of potential weights. |
[in,out] | eps_t_weights_ptr | Pointer to the starting location of potential weights. |
[in] | nse_discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_phase_factor_a | ( | const FNFT_REAL | eps_t, |
const FNFT_UINT | D, | ||
FNFT_REAL const *const | T, | ||
FNFT_REAL *const | phase_factor_a, | ||
fnft_nse_discretization_t | nse_discretization | ||
) |
This routine returns the phase factor for a coefficient. It is required for applying boundary conditions to the transfer_matrix based on the discretization.
This routine computes the phase correction factor for the computation of the a coefficient from the transfer_matrix. phase_factor_a = -eps_t*D + (T[1]+eps_t*boundary_coeff) - (T[0]-eps_t*boundary_coeff), where eps_t is the step-size, D is the number of samples used to build the transfer_matrix, T is the 2-element time vector defining the signal support and boundary_coeff is based on the discretization of type fnft_nse_discretization_t.
[in] | eps_t | Real-valued discretization step-size. |
[in] | D | Positive interger number of samples used to build transfer_matrix. |
[in] | T | Real-valued 2-element time vector defining the signal support. |
[in,out] | phase_factor_a | Pointer to real-valued variable where the computed phase factor will be stored. |
[in] | nse_discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_phase_factor_b | ( | const FNFT_REAL | eps_t, |
const FNFT_UINT | D, | ||
FNFT_REAL const *const | T, | ||
FNFT_REAL *const | phase_factor_b, | ||
fnft_nse_discretization_t | nse_discretization | ||
) |
This routine returns the phase factor for b coefficient. It is required for applying boundary conditions to the transfer_matrix based on the discretization.
This routine computes the phase correction factor for the computation of the a coefficient from the transfer_matrix. phase_factor_b = -eps_t*D - (T[1]+eps_t*boundary_coeff) - (T[0]-eps_t*boundary_coeff), where eps_t is the step-size, D is the number of samples used to build the transfer_matrix, T is the 2-element time vector defining the signal support and boundary_coeff is based on the discretization of type fnft_nse_discretization_t. Only for fnft_nse_discretization_2SPLIT2A and fnft_nse_discretization_2SPLIT2_MODAL, phase_factor_b = -eps_t*D - (T[1]+eps_t*boundary_coeff) - (T[0]-eps_t*boundary_coeff)+ eps_t/degree1step where degree1step is based on the discretization of type fnft_nse_discretization_t.
[in] | eps_t | Real-valued discretization step-size. |
[in] | D | Positive interger number of samples used to build transfer_matrix. |
[in] | T | Real-valued 2-element time vector defining the signal support. |
[in,out] | phase_factor_b | Pointer to real-valued variable where the computed phase factor will be stored. |
[in] | nse_discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_phase_factor_rho | ( | const FNFT_REAL | eps_t, |
const FNFT_REAL | T1, | ||
FNFT_REAL *const | phase_factor_rho, | ||
fnft_nse_discretization_t | nse_discretization | ||
) |
This routine returns the phase factor for reflection coefficient ( \(\rho\)). It is required for applying boundary conditions to the transfer_matrix based on the discretization.
This routine computes the phase correction factor for the computation of the reflection coefficient from the transfer_matrix. phase_factor_rho = -2.0*(T1 + eps_t*boundary_coeff), where eps_t is the step-size, T1 is the time at the right-boundary and boundary_coeff is based on the discretization of type fnft_nse_discretization_t. Only for fnft_nse_discretization_2SPLIT2A and fnft_nse_discretization_2SPLIT2_MODAL, phase_factor_rho = -2.0*(T1 + eps_t*boundary_coeff)+eps_t/degree1step where degree1step is based on the discretization of type fnft_nse_discretization_t.
[in] | eps_t | Real-valued discretization step-size. |
[in] | T1 | Real-valued time at the right-boundary. |
[in,out] | phase_factor_rho | Pointer to real-valued variable where the computed phase factor will be stored. |
[in] | nse_discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_preprocess_signal | ( | const FNFT_UINT | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_REAL const | eps_t, | ||
const FNFT_INT | kappa, | ||
FNFT_UINT *const | Dsub_ptr, | ||
FNFT_COMPLEX ** | q_preprocessed_ptr, | ||
FNFT_COMPLEX ** | r_preprocessed_ptr, | ||
FNFT_UINT *const | first_last_index, | ||
fnft_nse_discretization_t | discretization | ||
) |
This routine preprocesses the signal by resampling and subsampling based on the discretization. The preprocessing is necessary for higher-order methods.
This routine preprocess q to generate q_preprocessed and r_preprocessed based on the discretization. The preprocessing may involve resampling and sub-sampling. The routine is based on the following papers:
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q(t_n)=q(x_0, t_n) \), where \( t_n = T[0] + n(T[1]-T[0])/(D-1) \) and \(n=0,1,\dots,D-1\), of the to-be-transformed signal in ascending order (i.e., \( q(t_0), q(t_1), \dots, q(t_{D-1}) \)) |
[in] | eps_t | Real-valued discretization step-size. |
[in] | kappa | =+1 for the focusing nonlinear Schroedinger equation, =-1 for the defocusing one |
[out] | q_preprocessed_ptr | Pointer to the starting location of preprocessed signal q_preprocessed. |
[out] | r_preprocessed_ptr | Pointer to the starting location of preprocessed signal r_preprocessed. |
[in,out] | Dsub_ptr | Pointer to number of processed samples. Upon entry, *Dsub_ptr should contain a desired number of samples. Upon exit, *Dsub_ptr has been overwritten with the actual number of samples that the routine has chosen. It is usually close to the desired one. |
[out] | first_last_index | Vector of length two. Upon exit, it contains the original index of the first and the last sample used to build q_preprocessed. |
[in] | discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_to_akns_discretization | ( | fnft_nse_discretization_t | nse_discretization, |
fnft__akns_discretization_t *const | akns_discretization | ||
) |
This routine returns akns discretization related to the given nse discretization.
The function is used by nse specific functions to convert discretization type from fnft_nse_discretization_t to fnft__akns_discretization_t.
[in] | nse_discretization | The type of nse discretization. Should be of type fnft_nse_discretization_t. |
[out] | akns_discretization | The pointer to the converted discretization of type fnft__akns_discretization_t. |
FNFT_UINT fnft__nse_discretization_upsampling_factor | ( | fnft_nse_discretization_t | discretization | ) |
This routine returns the scaling for effective number of samples based on the discretization.
Higher order methods use more than one sample per integration step. This routine returns the value upsampling_factor based on the discretization of type fnft_nse_discretization_t. D_effective = upsampling_factor * D.
[in] | discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_discretization_z_to_lambda | ( | const FNFT_UINT | n, |
const FNFT_REAL | eps_t, | ||
FNFT_COMPLEX *const | vals, | ||
fnft_nse_discretization_t | discretization | ||
) |
This routine maps \(z\) from the discrete-time domain to \(\lambda\) in the continuous-time domain based on the discretization.
This routine maps discrete-time domain value \(z\) to continuous-time domain value \(\lambda = degree1step\log(z)/(2j\epsilon_t)\), where degree1step is based on the discretization of type fnft_nse_discretization_t. Changes discretization to fnft__akns_discretization_t type and calls fnft__akns_discretization_z_to_lambda.
[in] | n | Number of values to be mapped. |
[in] | eps_t | Real-valued discretization step-size. |
[in,out] | vals | Pointer to location of first element of array containing complex-valued discrete-time domain spectral parameter \(z\). The values are replaced with continuous-time domain values \(\lambda\). |
[in] | discretization | Discretization of type fnft_nse_discretization_t. |
FNFT_INT fnft__nse_finvscatter | ( | const FNFT_UINT | deg, |
FNFT_COMPLEX *const | transfer_matrix, | ||
FNFT_COMPLEX *const | q, | ||
const FNFT_REAL | eps_t, | ||
const FNFT_INT | kappa, | ||
const fnft_nse_discretization_t | discretization | ||
) |
Recovers the samples that corresponding to a transfer matrix fast.
Recovers samples q[0], q[1], ..., q[D-1] that, when applied to fnft__nse_fscatter, the transfer matrix provided by the user is reconstructed. Note that the transfer matrix has to be (at least close to) realizable, i.e., such samples have to exist. Also, the transfer matrix has to be sufficiently nice to keep numerical errors tolerable, which in my experience means that the q[n] it corresponds to are "smooth enough" and such that |eps_t*q[n]|<<1 for all n.
More information about the algorithm used here can be found in Wahls and Poor (Proc. IEEE ISIT 2015) and McClary (Geophysics 48(10), 1983).
deg | Degree of the polynomials in the transfer matrix. | |
[in] | transfer_matrix | A transfer matrix in the same format as used by fnft__nse_fscatter. |
[out] | q | Array with D=deg/base_deg entries in which the samples are stored, where base_deg is the output of fnft__nse_discretization_degree. |
[in] | eps_t | See fnft__nse_fscatter. |
[in] | kappa | See fnft__nse_fscatter. |
[in] | discretization | See fnft__nse_fscatter. Currently, only the 2SPLIT2_MODAL and 2SPLIT2A discretizations are supported. |
FNFT_INT fnft__nse_fscatter | ( | const FNFT_UINT | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_COMPLEX const *const | r, | ||
const FNFT_REAL | eps_t, | ||
FNFT_COMPLEX *const | result, | ||
FNFT_UINT *const | deg_ptr, | ||
FNFT_INT *const | W_ptr, | ||
fnft_nse_discretization_t const | discretization | ||
) |
Fast computation of polynomial approximation of the combined scattering matrix.
This routine computes the polynomial approximation of the combined scattering matrix by multipying together individual scattering matrices.
Individual scattering matrices depend on the chosen discretization.
The main reference is Wahls and Poor (Proc. ICASSP 2013 ).
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q(t_n)=q(x_0, t_n) \), where \( t_n = T[0] + n(T[1]-T[0])/(D-1) \) and \(n=0,1,\dots,D-1\), of the to-be-transformed signal in ascending order (i.e., \( q(t_0), q(t_1), \dots, q(t_{D-1}) \)) |
[in] | r | Array of length D, contains samples \( r(t_n)=r(x_0, t_n) \), where \( t_n = T[0] + n(T[1]-T[0])/(D-1) \) and \(n=0,1,\dots,D-1\), of the auxiliary potential in the AKNS framework in ascending order (i.e., \( r(t_0), r(t_1), \dots, r(t_{D-1}) \)) |
[in] | eps_t | Step-size, eps_t \(= (T[1]-T[0])/(D-1) \). |
[out] | result | array of length nse_fscatter_numel(D,discretization) , will contain the combined scattering matrix. Result needs to be pre-allocated with malloc(nse_fscatter_numel(D,discretization)*sizeof(COMPLEX)) . |
[out] | deg_ptr | Pointer to variable containing degree of the discretization. Determined based on discretization by fnft__nse_discretization_degree. |
[out] | W_ptr | Pointer to normalization flag fnft_nsev_opts_t::normalization_flag. |
[in] | discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. Not all fnft_nse_discretization_t discretizations are supported. Check fnft_nse_discretization_t for list of supported types. |
FNFT_UINT fnft__nse_fscatter_numel | ( | FNFT_UINT | D, |
fnft_nse_discretization_t | discretization | ||
) |
Returns the length of transfer_matrix to be allocated based on the number of samples and discretization.
This routine returns the length 4*D*(nse_discretization_degree(discretization) + 1) to be allocated based on the number of samples and discretization of type discretization.
[in] | D | Number of samples. |
[in] | discretization | Type of discretization from fnft_nse_discretization_t. |
FNFT_INT fnft__nse_scatter_bound_states | ( | FNFT_UINT const | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_COMPLEX const *const | r, | ||
FNFT_REAL const *const | T, | ||
FNFT_UINT const | K, | ||
FNFT_COMPLEX *const | bound_states, | ||
FNFT_COMPLEX *const | a_vals, | ||
FNFT_COMPLEX *const | aprime_vals, | ||
FNFT_COMPLEX *const | b, | ||
FNFT_INT *const | Ws, | ||
fnft_nse_discretization_t const | discretization, | ||
FNFT_UINT const | skip_b_flag | ||
) |
Computes \(a(\lambda)\), \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\) and \(b(\lambda)\) for complex values \(\lambda\) assuming that they are very close to the true bound-states.
The function performs slow direct scattering and is primarily based on the references
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( q_0, q_1, \dots, q_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in,out] | r | Array of length D, contains samples \( r_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( r_0, r_1, \dots, r_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in] | T | Array of length 2, contains the position in time of the first and of the last sample. It should be T[0]<T[1]. |
[in] | K | Number of bound-states. |
[in] | bound_states | Array of length K, contains the bound-states \(\lambda\). |
[out] | a_vals | Array of length K, contains the values of \(a(\lambda)\). |
[out] | aprime_vals | Array of length K, contains the values of \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\). |
[out] | b | Array of length K, contains the values of \(b(\lambda)\). The \(b(\lambda)\) are calculated using the criterion from Prins and Wahls, " Soliton Phase Shift Calculation for the Korteweg–De Vries Equation,". |
[in,out] | Ws | Pass an array of size K. Upon exit, it contains scaling factors that arise due to an internal normalization of the scattering process (to deal with potential overflow issues). The returned values for a and a_prime still have to be multiplied with corresponding power of two (i.e. POW(2, Ws[i])) to obtain the final values. Note that this is not required for the values of b. No normalization is carried out if NULL is passed. |
[in] | discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. Not all nse_discretization_t discretizations are supported. Check fnft_nse_discretization_t for list of supported types. |
[in] | skip_b_flag | If set to 1 the routine will not compute \(b(\lambda)\). |
FNFT_INT fnft__nse_scatter_matrix | ( | const FNFT_UINT | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_COMPLEX const *const | r, | ||
const FNFT_REAL | eps_t, | ||
const FNFT_INT | kappa, | ||
const FNFT_UINT | K, | ||
FNFT_COMPLEX const *const | lambda, | ||
FNFT_COMPLEX *const | result, | ||
FNFT_INT *const | W, | ||
fnft_nse_discretization_t const | discretization, | ||
const FNFT_UINT | derivative_flag | ||
) |
Computes the scattering matrix and its derivative.
The function computes the scattering matrix and the derivative of the scattering matrix with respect to \(\lambda\). The function performs slow direct scattering and is primarily based on the reference Boffetta and Osborne (J. Comput. Physics 1992 ).
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( q_0, q_1, \dots, q_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in,out] | r | Array of length D, contains samples \( r_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( r_0, r_1, \dots, r_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in] | eps_t | Step-size, eps_t \(= (T[1]-T[0])/(D-1) \). |
[in] | kappa | =+1 for the focusing nonlinear Schroedinger equation, =-1 for the defocusing one. |
[in] | K | Number of values of \(\lambda\). |
[in] | lambda | Array of length K, contains the values of \(\lambda\). |
[out] | result | Array of length 8*K or 4*K, If derivative_flag=0 returns [S11 S12 S21 S22] in result where S = [S11, S12; S21, S22] is the scattering matrix computed using the chosen discretization. If derivative_flag=1 returns [S11 S12 S21 S22 S11' S12' S21' S22'] in result where S11' is the derivative of S11 w.r.t to lambda. Should be preallocated with size 4*K or 8*K accordingly. |
[in,out] | W | Pass an array of size K. Upon exit, it contains scaling factors that arise due to an internal normalization of the scattering matrix (to deal with potential overflow issues). The result has to be scaled by the power of 2 to obtain the final values. No normalization is carried out if NULL is passed. |
[in] | discretization | The type of discretization to be used. Should be of type fnft_nse_discretization_t. Not all nse_discretization_t discretizations are supported. Check fnft_nse_discretization_t for list of supported types. |
[in] | derivative_flag | Should be set to either 0 or 1. If set to 1 the derivatives [S11' S12' S21' S22'] are calculated. result should be preallocated with size 8*K if flag is set to 1. |
FNFT_INT fnft__nsep_testcases_test_fnft | ( | fnft__nsep_testcases_t | tc, |
FNFT_UINT | D, | ||
FNFT_REAL | error_bounds[3], | ||
fnft_nsep_opts_t *const | opts | ||
) |
This routine is used by the tests for fnft_nsep.
It runs the specified test case tc with the specificed number of samples D and the options opts, and tests if several errors stay below the provided error bounds in error_bounds.
[in] | tc | Type of test case. |
[in] | D | Number of samples. |
[in] | error_bounds | Real valued array with 3 elements corresponding to various error bounds. |
[in] | opts | fnft_nsep_opts_t options for the tests. |
FNFT_INT fnft__nsev_testcases_test_fnft | ( | fnft__nsev_testcases_t | tc, |
FNFT_UINT | D, | ||
const FNFT_REAL | eb[6], | ||
fnft_nsev_opts_t *const | opts | ||
) |
Routine to run tests for fnft_nsev.
.
This routine is used by the tests for fnft_nsev. It runs the specified test case tc with the specificed number of samples D and the options opts, and tests if several errors stay below the provided error bounds in eb.
[in] | tc | Type of test case. |
[in] | D | Number of samples. |
[in] | eb | Real valued array with 6 elements corresponding to various error bounds. |
[in] | opts | fnft_nsev_opts_t options for the tests. |