95 void updateScale()
const {
139 double operator()(
double x)
const {
182 this->parameters.link(
"position", this->range.tuple());
183 this->parameters.link(
"scale", this->
scale);
184 this->parameters.link(
"bias", this->
bias);
189 this->parameters.
copyStruct(f.getParameters(), f, *
this);
196 void set(
double rangeMin,
double rangeMax,
double scale=1.0,
double bias=0.0){
197 this->range.set(rangeMin, rangeMax);
216 this->INVERSE = (range.min > range.max);
219 rangeFinal.min = range.min;
220 rangeFinal.max = range.max;
221 span = range.max - range.min;
225 rangeFinal.min = range.max;
226 rangeFinal.max = range.min;
227 span = range.min - range.max;
238 double operator()(
double x)
const {
240 if (x <= rangeFinal.min)
242 else if (x >= rangeFinal.max)
246 return this->
biasFinal + this->scaleFinal*(x-rangeFinal.min) / span;
284 this->parameters.link(
"position", this->
range.tuple());
285 this->parameters.link(
"peakPos", this->
peakPos);
286 this->parameters.link(
"scale", this->
scale);
287 this->parameters.link(
"bias", this->
bias);
294 this->parameters.link(
"position", this->range.tuple());
295 this->parameters.link(
"peakPos", this->
peakPos);
296 this->parameters.link(
"scale", this->
scale);
297 this->parameters.link(
"bias", this->
bias);
304 this->parameters.
copyStruct(f.getParameters(), f, *
this);
313 void set(
double startPos,
double endPos,
double peakPos=std::numeric_limits<double>::min,
double scale=1.0,
double bias=0.0){
315 this->range.set(startPos, endPos);
359 double operator()(
double x)
const {
366 else if (x > span.min)
420 this->parameters.link(
"location", this->location = location);
421 this->parameters.link(
"width", this->width = width);
422 this->parameters.link(
"scale", this->
scale =
scale);
423 this->parameters.link(
"bias", this->
bias =
bias);
429 this->parameters.
copyStruct(f.getParameters(), f, *
this);
436 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0){
437 this->location = location;
445 this->location = 0.5 * (range[0] + range[1]);
446 this->width = (range[1] - range[0]);
454 this->widthInv = 1.0/width;
455 this->INVERSE = (width<0.0);
460 double operator()(
double x)
const {
462 x = widthInv * (x - this->location);
467 double location = 0.0;
474 double widthInv = 1.0;
501 this->parameters.link(
"location", this->location = location);
502 this->parameters.link(
"width", this->width = width);
503 this->parameters.link(
"scale", this->
scale =
scale);
504 this->parameters.link(
"bias", this->
bias =
bias);
509 this->parameters.
copyStruct(f.getParameters(), f, *
this);
517 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
518 this->location = location;
527 this->location = 0.5 * (range[0] + range[1]);
528 this->width = (range[1] - range[0]);
535 double operator()(
double x)
const {
536 x = steepness * (x - location);
544 steepness = sqrt(sqrt(2.0)-1.0)/width;
545 this->INVERSE = (width<0.0);
549 double location = 0.0;
555 double steepness = 1.0;
577 this->parameters.link(
"location", this->location = location);
578 this->parameters.link(
"width", this->width = width);
579 this->parameters.link(
"scale", this->
scale =
scale);
580 this->parameters.link(
"bias", this->
bias =
bias);
586 this->parameters.
copyStruct(f.getParameters(), f, *
this);
595 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
596 this->location = location;
605 double operator()(
double x)
const {
606 x = x - this->location;
615 double location = 0.0;
622 void updateScale()
const {
624 this->INVERSE = (width<0.0);
629 this->absWidth = width;
634 this->absWidth = -width;
661 this->parameters.link(
"location", this->location = location);
662 this->parameters.link(
"width", this->width = width);
663 this->parameters.link(
"scale", this->
scale =
scale);
664 this->parameters.link(
"bias", this->
bias =
bias);
669 this->parameters.
copyStruct(f.getParameters(), f, *
this);
676 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
677 this->location = location;
685 this->INVERSE = (width<0.0);
687 widthFinal = fabs(width);
694 double operator()(
double x)
const {
695 x = x - this->location;
704 double location = 0.0;
711 void updateScale()
const {
747 this->parameters.link(
"location", this->location = location);
748 this->parameters.link(
"width", this->width = width);
749 this->parameters.link(
"scale", this->
scale =
scale);
750 this->parameters.link(
"bias", this->
bias =
bias);
755 this->parameters.
copyStruct(f.getParameters(), f, *
this);
763 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
764 this->location = location;
772 this->INVERSE = (width<0.0);
773 steepness = 1.0/fabs(width);
779 double operator()(
double x)
const {
780 x = steepness * (x - location);
786 double location = 0.0;
793 void updateScale()
const {
795 if (this->width >= 0.0){
806 double steepness = 1.0;
double scale
Relative scale, typically 1. Optional.
Definition Functor.h:99
double scaleFinal
Scaling factor after encodings of src and dst images are known.
Definition Functor.h:106
double bias
"Relative" bias, typically 0. Optional.
Definition Functor.h:102
virtual void updateBean() const override
Called after setParameters()
Definition Functor.h:65
double biasFinal
Scaling factor after encodings of src and dst images are known.
Definition Functor.h:110
A base class for fuzzy functions; also an unary functor.
Definition Fuzzy.h:62
bool isInversed()
Updates internal variables. Should be called after modifying public members.
Definition Fuzzy.h:85
A smooth symmetric peak function that resembles the Gaussian bell curve. Diminishes quicker than Fuzz...
Definition Fuzzy.h:495
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:543
void set(const UniTuple< double, 2 > &range, double scale=1.0, double bias=0.0)
Set peak to a given half-width range.
Definition Fuzzy.h:526
A smooth symmetric peak function that resembles the Gaussian bell curve.
Definition Fuzzy.h:414
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:453
Identity function - returns the input value.
Definition Fuzzy.h:128
A smooth step function, by default from -1.0 to +1.0.
Definition Fuzzy.h:571
A simple linear transition from 0 to 1 .
Definition Fuzzy.h:170
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:212
FuzzyStep(T startPos=-1.0, T endPos=1.0, double scale=1.0, double bias=0.0)
Constructor.
Definition Fuzzy.h:181
A smooth step function between 0.0 and 1.0. Increasing (decreasing) with positive (negative) width....
Definition Fuzzy.h:654
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:684
A basic triangular peak function with linear around the peak.
Definition Fuzzy.h:279
void set(double startPos, double endPos, double peakPos=std::numeric_limits< double >::min, double scale=1.0, double bias=0.0)
Sets the parameters of the membership function.
Definition Fuzzy.h:313
double peakPos
Peak position.
Definition Fuzzy.h:378
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:339
drain::Range< double > range
Start and end position.
Definition Fuzzy.h:374
A function taking shape of two peaks, with a zero in the middle .
Definition Fuzzy.h:740
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:771
FuzzyTwinPeaks(double location=0.0, double width=1.0, double scale=1.0, double bias=0.0)
Definition Fuzzy.h:744
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Logger & debug2(const TT &... args)
Debug information.
Definition Log.h:676
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition ReferenceMap.h:407
Tuple of N elements of type T.
Definition UniTuple.h:65
Definition DataSelector.cpp:1277