RobWorkProject  23.9.11-
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WeightedEuclideanMetric< T > Class Template Reference

Weighted Euclidean metric for vector types. More...

#include <MetricFactory.hpp>

Inherits Metric< T >.

Public Member Functions

 WeightedEuclideanMetric (const typename Metric< T >::value_type &weights)
 Weighted metric. More...
 
- Public Member Functions inherited from Metric< T >
virtual ~Metric ()
 Destructor.
 
scalar_type distance (const value_type &q) const
 The distance from the zero element to q.
 
scalar_type distance (const value_type &a, const value_type &b) const
 The distance from element a to b. More...
 
int size () const
 The dimension of elements on which this metric operates. More...
 

Protected Member Functions

Metric< T >::scalar_type doDistance (const typename Metric< T >::value_type &q) const
 
Metric< T >::scalar_type doDistance (const typename Metric< T >::value_type &a, const typename Metric< T >::value_type &b) const
 
int doSize () const
 Subclass implementation of the size() method. More...
 
- Protected Member Functions inherited from Metric< T >
virtual scalar_type doDistance (const value_type &q) const =0
 Subclass implementation of the distance() method.
 
virtual scalar_type doDistance (const value_type &a, const value_type &b) const =0
 Subclass implementation of the distance() method.
 
 Metric ()
 Protected constructor called by subclassed.
 
 Metric (const Metric &)
 Disable copying of superclass.
 
Metricoperator= (const Metric &)
 Disable assignment of superclass.
 

Protected Attributes

const Metric< T >::value_type _weights
 

Additional Inherited Members

- Public Types inherited from Metric< T >
typedef T value_type
 The type of element on which the metric operates.
 
typedef T::value_type scalar_type
 The type of the scalar.
 
typedef rw::core::Ptr< Metric< T > > Ptr
 A pointer to a Metric<T>.
 
typedef rw::core::Ptr< const Metric< T > > CPtr
 A pointer to a const Metric<T>.
 

Detailed Description

template<class T>
class rw::math::WeightedEuclideanMetric< T >

Weighted Euclidean metric for vector types.

Given a vector of weights \( \mathbf{\omega}\in\mathbb{R}^n \), the distance between two points \( P = (p_1, p_2, ..., p_n) \) and \( Q = (q_1, q_2, ..., q_n) \) is defined as \( \sqrt{\sum_{i=1}^{n}(\omega_i * (p_i - q_i))^2} \).

Constructor & Destructor Documentation

◆ WeightedEuclideanMetric()

WeightedEuclideanMetric ( const typename Metric< T >::value_type weights)
inline

Weighted metric.

Parameters
weights[in] Weights for the metric.

Member Function Documentation

◆ doSize()

int doSize ( ) const
inlineprotectedvirtual

Subclass implementation of the size() method.

By default the methods returns -1, i.e. valid for all elements.

Reimplemented from Metric< T >.


The documentation for this class was generated from the following files: