This reverts commit 798a0ca3b3
This commit is contained in:
Magnus Fischer
2026-02-02 12:12:33 +00:00
parent 005e821131
commit 9093fb2452
31 changed files with 385 additions and 2067 deletions

View File

@@ -24,8 +24,6 @@ classdef DP_Fiber
SS_dzmax % [m] max dz (adaptive SSFM)
SS_dzmin % [m] min dz (adaptive SSFM)
n_waveplates % number of PMD waveplates
useGPU % GPU acceleration: true, false, or 'auto' (default)
useSingle % Use single precision on GPU (default: false)
% ---- Internal state (persistent between calls) ----
state % struct mirroring legacy 'state'
@@ -58,8 +56,6 @@ classdef DP_Fiber
options.SS_dzmax = 2e4 % m
options.SS_dzmin = 100 % m
options.n_waveplates = 100
options.useGPU = 'auto' % 'auto', true, or false
options.useSingle = false % single precision GPU
end
% Copy provided options into properties
@@ -212,7 +208,7 @@ classdef DP_Fiber
% Frequency-dependent PMD phase term (legacy form)
st.brf.db0 = (R.rand(st.wave_plates,1)*2*pi - pi) * brf_multiplier;
st.brf.db1 = sqrt(3*pi/8)*(st.dgd/obj.fa)/st.wave_plates .* st.omega;
st.brf.simdgd = 0;
st.brf.simdgd = 0;
% cumsum used in legacy only for debug; keep compatibility variable:
~cumsum(st.brf.db0); % no-op to mirror legacy path
@@ -232,18 +228,7 @@ classdef DP_Fiber
x_in = signal_in(:,1).';
y_in = signal_in(:,2).';
% Determine GPU usage
if ischar(obj.useGPU) || isstring(obj.useGPU)
if strcmpi(obj.useGPU, 'auto')
gpuFlag = []; % Let CNLSE_plain auto-detect
else
error('DP_Fiber:InvalidGPU', 'useGPU must be true, false, or ''auto''');
end
else
gpuFlag = logical(obj.useGPU);
end
[x_out, y_out, obj.state] = CNLSE_plain(x_in, y_in, obj.state, gpuFlag, obj.useSingle);
[x_out, y_out, obj.state] = CNLSE_plain(x_in, y_in, obj.state);
obj.state.propagated_length = obj.state.propagated_length + obj.state.L;