Program Listing for File OneDimDistance.h
↰ Return to documentation for file (include/gwmodelpp/spatialweight/OneDimDistance.h
)
#ifndef ONEDIMDISTANCE_H
#define ONEDIMDISTANCE_H
#include "Distance.h"
namespace gwm
{
class OneDimDistance : public Distance
{
public:
struct Parameter : public Distance::Parameter
{
arma::vec focusPoints;
arma::vec dataPoints;
Parameter(const arma::vec& fp, const arma::vec& dp) : Distance::Parameter()
, focusPoints(fp)
, dataPoints(dp)
{
total = fp.n_rows;
}
};
public:
static arma::vec AbstractDistance(const double& out_loc, const arma::vec& in_locs)
{
// arma::vec d = abs(in_locs - out_loc);
// d.print("d");
return abs(in_locs - out_loc);
}
public:
OneDimDistance();
explicit OneDimDistance(bool isGeographic);
OneDimDistance(const OneDimDistance& distance);
virtual Distance * clone() const override
{
return new OneDimDistance(*this);
}
DistanceType type() override { return DistanceType::OneDimDistance; }
public:
virtual void makeParameter(std::initializer_list<DistParamVariant> plist) override;
virtual arma::vec distance(arma::uword focus) override;
arma::vec noAbsdistance(arma::uword focus);
virtual double maxDistance() override;
virtual double minDistance() override;
protected:
std::unique_ptr<Parameter> mParameter = nullptr;
};
}
#endif // ONEDIMDISTANCE_H