20 #ifndef GAIA_FROZENEXPONENTIALCOMPRESSDISTANCE_H 21 #define GAIA_FROZENEXPONENTIALCOMPRESSDISTANCE_H 23 #include "frozendistance.h" 33 validParams <<
"distance" <<
"params" <<
"alpha";
35 if (params.empty())
throw GaiaException(
"Cannot create an exponential compress distance with no params...");
37 QString dname = params[
"distance"].toString().toLower();
38 ParameterMap dparams = params[
"params"].toParameterMap();
40 _dist = FrozenMetricFactory::create(dname, dataset, dparams);
41 _alpha = params.value(
"alpha", 1.0).toDouble();
49 void prepare(
const FrozenPoint& query) {
50 _dist->prepare(query);
53 Real operator()(
int i,
const FrozenPoint& query)
const {
54 return 1 - exp(-_alpha * (*_dist)(i, query));
66 #endif // GAIA_FROZENEXPONENTIALCOMPRESSDISTANCE_H Definition: frozendistance.h:33
Definition: frozenexponentialcompressdistance.h:28
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
Definition: parameter.h:34
A FrozenDataSet is a dataset that has been flagged as immutable.
Definition: frozendataset.h:49
Exception class that can take up to 3 arguments of any type, which will be serialized into a QString ...
Definition: gaiaexception.h:46