16#ifndef R8BUTIL_INCLUDED
17#define R8BUTIL_INCLUDED
32 return( 4.34294481903251828 * log( re * re + im * im + 1e-100 ));
50 double& prevg_log,
const double prec,
const double maxstep,
51 const double minstep = 1e-11 )
53 double curg_log = 4.34294481903251828 * log( curg + 1e-100 );
54 curg_log += ( prevg_log - curg_log ) * 0.7;
56 const double slope = fabs( curg_log - prevg_log );
62 step =
max(
min( step, maxstep ), minstep );
85 const int fltlen,
double& ming,
double& minth,
const double thend )
87 const double maxstep = minth * 2e-3;
105 const double curg = re * re + im * im;
141 const int fltlen,
double& maxg,
double& maxth,
const double thend )
143 const double maxstep = maxth * 1e-4;
144 double premaxth = maxth;
145 double premaxg = maxg;
146 double postmaxth = maxth;
147 double postmaxg = maxg;
149 double prevth = maxth;
151 double curth = maxth;
158 bool WasPeak =
false;
159 int AfterPeakCount = 0;
171 const double curg = re * re + im * im;
185 if( AfterPeakCount == 0 )
191 if( AfterPeakCount == 5 )
197 for( k = 0; k < 2; k++ )
199 double l = ( k == 0 ? premaxth : maxth );
200 double curgl = ( k == 0 ? premaxg : maxg );
201 double r = ( k == 0 ? maxth : postmaxth );
202 double curgr = ( k == 0 ? maxg : postmaxg );
206 const double c = ( l + r ) * 0.5;
210 const double curg = re * re + im * im;
271 const int fltlen,
const double maxg,
double& th,
const double thend )
280 const double c = ( l + r ) * 0.5;
291 const double curg = re * re + im * im;
The "base" inclusion file with basic classes and functions.
#define R8B_PI
Definition: r8bbase.h:119
The "r8brain-free-src" library namespace.
Definition: CDSPBlockConvolver.h:21
void findFIRFilterResponseMaxLtoR(const double *const flt, const int fltlen, double &maxg, double &maxth, const double thend)
Definition: r8butil.h:140
double convertResponseToLog(const double re, const double im)
Definition: r8butil.h:30
void calcFIRFilterResponse(const double *flt, int fltlen, const double th, double &re0, double &im0, const int fltlat=0)
Definition: r8bbase.h:817
void findFIRFilterResponseLevelRtoL(const double *const flt, const int fltlen, const double maxg, double &th, const double thend)
Definition: r8butil.h:270
T min(const T &v1, const T &v2)
Definition: r8bbase.h:1063
T max(const T &v1, const T &v2)
Definition: r8bbase.h:1080
void updateScanStep(double &step, const double curg, double &prevg_log, const double prec, const double maxstep, const double minstep=1e-11)
Definition: r8butil.h:49
void findFIRFilterResponseMinLtoR(const double *const flt, const int fltlen, double &ming, double &minth, const double thend)
Definition: r8butil.h:84