24 use,
intrinsic :: iso_fortran_env
33 integer,
parameter :: &
34 SPECTRUM_TRANSFORM_LAPLACE = 1, &
53 type(bpdn_matrix) :: fourier_matrix
59 type(compressed_sensing_t),
intent(out) :: this
60 integer,
intent(in) :: transform_type
61 integer,
intent(in) :: ntime
62 real(real64),
intent(in) :: dtime
63 real(real64),
intent(in) :: stime
64 integer,
intent(in) :: nfreq
65 real(real64),
intent(in) :: dfreq
66 real(real64),
intent(in) :: sfreq
67 real(real64),
intent(in) :: noise
69 integer :: itime, ifreq, type
70 real(real64) :: time, freq
83 if (transform_type == spectrum_transform_laplace)
then
85 call bpdn_matrix_init(this%fourier_matrix, this%ntime, this%nfreq, explicit_matrix)
87 do ifreq = 1, this%nfreq
88 freq = (ifreq - 1)*this%dfreq + this%sfreq
90 do itime = 1, this%ntime
91 time = (itime - 1)*this%dtime + this%stime
92 this%fourier_matrix%matrix(itime, ifreq) =
exp(-freq*time)
99 select case (transform_type)
106 call bpdn_matrix_init(this%fourier_matrix, this%ntime, this%nfreq, type)
107 call bpdn_matrix_set_delta(this%fourier_matrix, this%dtime, this%dfreq)
117 type(compressed_sensing_t),
intent(inout) :: this
121 call bpdn_matrix_end(this%fourier_matrix)
130 real(real64),
intent(in) :: time_function(:)
131 real(real64),
intent(out) :: freq_function(:)
134 real(real64),
allocatable :: tf_normalized(:)
139 safe_allocate(tf_normalized(1:this%ntime))
142 nrm = dnrm2(this%ntime, time_function(1), 1)
144 if (nrm > 1e-8_real64)
then
145 tf_normalized(1:this%ntime) = time_function(1:this%ntime)/nrm
147 tf_normalized(1:this%ntime) = time_function(1:this%ntime)
151 call bpdn(this%ntime, this%nfreq, this%fourier_matrix, tf_normalized, this%sigma, freq_function, ierr, activesetit = 50)
153 safe_deallocate_a(tf_normalized)
156 freq_function(1:this%nfreq) = nrm/(this%dfreq*
m_two/
m_pi)*freq_function(1:this%nfreq)
159 message(1) =
'The Basis Pursuit Denoising process failed to converge.'
double exp(double __x) __attribute__((__nothrow__
This module contains interfaces for BLAS routines You should not use these routines directly....
subroutine, public compressed_sensing_init(this, transform_type, ntime, dtime, stime, nfreq, dfreq, sfreq, noise)
integer, parameter spectrum_transform_cos
integer, parameter spectrum_transform_sin
subroutine, public compressed_sensing_spectral_analysis(this, time_function, freq_function)
subroutine, public compressed_sensing_end(this)
real(real64), parameter, public m_two
real(real64), parameter, public m_pi
some mathematical constants
real(real64), parameter, public m_one
subroutine, public messages_warning(no_lines, all_nodes, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning