LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::cosinus2Similarity< T > Class Template Reference

Quadratic Cosinus Similarity. More...

#include <ltiCosinusSimilarity.h>

Inheritance diagram for lti::cosinus2Similarity< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::cosinus2Similarity< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 cosinus2Similarity ()
 cosinus2Similarity (const cosinus2Similarity< T > &other)
virtual ~cosinus2Similarity ()
virtual const char * getTypeName () const
apply (const vector< T > &a, const vector< T > &b) const
apply (const matrix< T > &a, const matrix< T > &b) const
vector< T > & apply (const matrix< T > &a, const vector< T > &b, vector< T > &dest) const
cosinus2Similaritycopy (const cosinus2Similarity &other)
virtual functorclone () const

Detailed Description

template<class T>
class lti::cosinus2Similarity< T >

Quadratic Cosinus Similarity.

This class computes the similarity of two vectors or matrices by means of the quadratic cosinus of the angle between the two vectors.


Constructor & Destructor Documentation

template<class T>
lti::cosinus2Similarity< T >::cosinus2Similarity (  ) 

default constructor

template<class T>
lti::cosinus2Similarity< T >::cosinus2Similarity ( const cosinus2Similarity< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied
template<class T>
virtual lti::cosinus2Similarity< T >::~cosinus2Similarity (  )  [virtual]

destructor


Member Function Documentation

template<class T>
vector<T>& lti::cosinus2Similarity< T >::apply ( const matrix< T > &  a,
const vector< T > &  b,
vector< T > &  dest 
) const

Compute the similarity for each row-vector in the matrix a and b.

If b.size() != a.columns() an empty vector will be returned. Otherwise, the element i of the vector dest will contain the cos2 similarity between the i-th row of a and b.

Returns:
always null
template<class T>
T lti::cosinus2Similarity< T >::apply ( const matrix< T > &  a,
const matrix< T > &  b 
) const [virtual]

Take the matrices as vectors and compute the similarity of them.

Returns:
the cos2-type of similarity of a and b

Implements lti::similarityFunctor< T >.

template<class T>
T lti::cosinus2Similarity< T >::apply ( const vector< T > &  a,
const vector< T > &  b 
) const [virtual]

calculates the quadratic cosinus-type of similarity of the vectors a and b.

If both vectors have different sizes, the returned value will be negative!

Parameters:
a the first vector<T>
b the second vector<T>
Returns:
the cos2-type similarity of a and b

Implements lti::similarityFunctor< T >.

template<class T>
virtual functor* lti::cosinus2Similarity< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

template<class T>
cosinus2Similarity& lti::cosinus2Similarity< T >::copy ( const cosinus2Similarity< T > &  other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::similarityFunctor< T >.

template<class T>
virtual const char* lti::cosinus2Similarity< T >::getTypeName (  )  const [virtual]

returns the name of this type ("cosinus2Similarity")

Reimplemented from lti::similarityFunctor< T >.


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

Generated on Sat Apr 10 15:28:12 2010 for LTI-Lib by Doxygen 1.6.1