41 CDistance::init(l, r);
49 "Number of dimension mismatch (l:%d vs. r:%d)!\n",
73 result=casted_lhs->
dot(idx_a, casted_rhs, idx_b);
75 result=casted_rhs->
dot(idx_b, casted_lhs, idx_a);
85 REQUIRE(
lhs,
"Left hand side feature cannot be NULL!\n");
92 #pragma omp parallel for
93 for(
index_t i =0; i<num_vec; ++i)
99 REQUIRE(
rhs,
"Right hand side feature cannot be NULL!\n");
106 #pragma omp parallel for
107 for(
index_t i =0; i<num_vec; ++i)
136 void CEuclideanDistance::register_params()
148 "Left hand side (was %s) has to be CDenseFeatures instance!\n",
lhs->
get_name());
150 "Right hand side (was %s) has to be CDenseFeatures instance!\n",
rhs->
get_name());
153 "Left hand side (was %s) has to be of double type!\n",
lhs->
get_name());
155 "Right hand side (was %s) has to be double type!\n",
rhs->
get_name());
160 upper_bound*=upper_bound;
168 for (int32_t i=0; i<avec.
vlen; i++)
171 if (result>upper_bound)
virtual CFeatures * replace_rhs(CFeatures *rhs)
virtual const char * get_name() const =0
virtual bool support_compatible_class() const
virtual void reset_precompute()
ST * get_feature_vector(int32_t num, int32_t &len, bool &dofree)
Class Distance, a base class for all the distances used in the Shogun toolbox.
virtual CFeatures * replace_lhs(CFeatures *lhs)
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)=0
virtual int32_t get_num_vectors() const =0
Features that support dot products among other operations.
virtual int32_t get_dim_feature_space() const =0
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual float64_t distance_upper_bounded(int32_t idx_a, int32_t idx_b, float64_t upper_bound)
virtual CFeatures * replace_lhs(CFeatures *lhs)
virtual bool init(CFeatures *l, CFeatures *r)
virtual void precompute_lhs()
virtual EFeatureClass get_feature_class() const =0
virtual CFeatures * replace_rhs(CFeatures *rhs)
all of classes and functions are contained in the shogun namespace
SGVector< float64_t > m_lhs_squared_norms
CFeatures * lhs
feature vectors to occur on the left hand side
The class Features is the base class of all feature objects.
CFeatures * rhs
feature vectors to occur on the right hand side
virtual void precompute_rhs()
virtual ~CEuclideanDistance()
SGVector< float64_t > m_rhs_squared_norms
static float32_t sqrt(float32_t x)
bool has_property(EFeatureProperty p) const
virtual EFeatureType get_feature_type() const =0