PARP Research Group University of Murcia


QVVector Class Reference
[Math extensions]

Implementation of numerical vectors. More...

#include <QVVector>

Inherited by QV3DPointF, and QVQuaternion.

List of all members.

Public Member Functions

 QVVector ()
 Default constructor for QVVector.
 QVVector (const int size, const double defaultValue=0)
 Constructor for QVVector.
 QVVector (const int size, const double *defaultValues)
 Constructor for QVVector.
 QVVector (const QVVector &vector)
 Copy constructor for QVVector.
 QVVector (const QVector< double > &vector)
 Copy constructor for QVector.
 QVVector (const QList< double > &list)
 Convert constructor from QList.
 QVVector (const QVMatrix &matrix)
 Convert constructor from QVMatrix.
 QVVector (const gsl_vector *vector)
 Copy constructor for gsl_vector.
 QVVector (const QPoint &point)
 Convert constructor for QPoint.
 QVVector (const QPointF &point)
 Convert constructor for QPointF.
double operator* (const QVVector &vector) const
 Vector dot product.
QVVector operator^ (const QVVector &vector) const
 Vector cross product.
QVVector operator+ (const QVVector &vector) const
 Vector add.
QVVector operator- (const QVVector &vector) const
 Vector substraction.
QVVector operator* (const double value) const
 Scalar multiplication.
QVVector operator/ (const double value) const
 Scalar division.
QVVector operator* (const QVMatrix &matrix) const
 Vector-matrix product.
bool operator== (const QVVector &vector) const
 Compare operator.
QVVectoroperator+= (const QVVector &vector)
 Add compound assignment operator.
 operator QPointF () const
 Convert to QPointF operator.
 operator gsl_vector * () const
 Convert to gsl_vector * operator.
int maxIndex () const
 Gets the location of the element with the maximal value.
int minIndex () const
 Gets the location of the element with the minimal value.
int maxAbsIndex () const
 Gets the index of the element with the maximal absolute value.
int minAbsIndex () const
 Gets the index of the element with the minimal absolute value.
void set (const double value)
 Set vector elements to a value.
QVVector subVector (const int firstIndex, const int lastIndex)
 Set vector elements to a value.
QVVector scalarDivision (const double value) const
 Scalar division.
QVVector scalarMultiplication (const double value) const
 Scalar multiplication.
double norm2 () const
 Norm 2 of the vector.
QVVector normalize () const
 Normalize vector.
double max () const
 Maximal value contained in the vector.
double min () const
 Minimal value contained in the vector.
double sum () const
 Accumulated value.
double mean () const
 Mean value.
double median () const
 Median value.
double variance () const
 Standard deviation.
double entropy (const double base=2) const
 Shannon's entropy of a probability state vector.
double dotProduct (const QVVector &vector) const
 Vector dot product.
QVVector crossProduct (const QVVector &vector) const
 Vector cross product.
QVVector add (const QVVector &vector) const
 Vector add.
QVVector substract (const QVVector &vector) const
 Vector substraction.
bool equals (const QVVector &vector) const
 Compare operator.
QVVector homogeneousCoordinates () const
 Obtains the vector in homogeneous coordinates.
QVMatrix crossProductMatrix () const
 Obtain the matrix corresponding to the matrix multiplication notation for the vector cross product.
QVMatrix toRowMatrix () const
 Returns this vector in the form of a row matrix.
QVMatrix toColumnMatrix () const
 Returns this vector in the form of a column matrix.

Static Public Member Functions

static const QVVector gaussianVector (const int radius, const double sigma)
 Vector of Gaussian distributed values.
static const QVVector mexicanHatWaveletVector (const int radius, const double sigma)
 Vector of mexican hat wavelet distributed values.
static const QVVector homogeneousCoordinates (const QPointF &point)
 Creates vector corresponding to the homogeneous coordinates of a 2D point.


Detailed Description

Implementation of numerical vectors.

Definition at line 45 of file qvvector.h.


Constructor & Destructor Documentation

QVVector::QVVector (  )  [inline]

Default constructor for QVVector.

Parameters:
vector operand for the product

Definition at line 51 of file qvvector.h.

Referenced by homogeneousCoordinates().

QVVector::QVVector ( const int  size,
const double  defaultValue = 0 
) [inline]

Constructor for QVVector.

Parameters:
int initializing size for the vector
defaultValue default value to set all elements of the vector

Definition at line 57 of file qvvector.h.

QVVector::QVVector ( const int  size,
const double *  defaultValues 
) [inline]

Constructor for QVVector.

Parameters:
int initializing size for the vector
defaultValues array of doubles, containing the inizialization data

Definition at line 63 of file qvvector.h.

QVVector::QVVector ( const QVVector vector  )  [inline]

Copy constructor for QVVector.

Parameters:
vector vector to be copied

Definition at line 72 of file qvvector.h.

QVVector::QVVector ( const QVector< double > &  vector  )  [inline]

Copy constructor for QVector.

Parameters:
vector vector to be copied

Definition at line 77 of file qvvector.h.

QVVector::QVVector ( const QList< double > &  list  )  [inline]

Convert constructor from QList.

Parameters:
list List of double values to be converted to QVVector

Definition at line 82 of file qvvector.h.

QVVector::QVVector ( const QVMatrix matrix  ) 

Convert constructor from QVMatrix.

This function generates a vector containing the elements of a matrix in a row mayor order.

Parameters:
matrix matrix to be converted.

Definition at line 29 of file qvvector.cpp.

QVVector::QVVector ( const gsl_vector *  vector  )  [inline]

Copy constructor for gsl_vector.

Parameters:
vector vector to be copied

Definition at line 95 of file qvvector.h.

QVVector::QVVector ( const QPoint &  point  )  [inline]

Convert constructor for QPoint.

Parameters:
vector vector to be copied

Definition at line 104 of file qvvector.h.

QVVector::QVVector ( const QPointF &  point  )  [inline]

Convert constructor for QPointF.

Parameters:
vector vector to be copied

Definition at line 109 of file qvvector.h.


Member Function Documentation

double QVVector::operator* ( const QVVector vector  )  const [inline]

Vector dot product.

Parameters:
vector operand for the product
See also:
dotProduct

Definition at line 117 of file qvvector.h.

QVVector QVVector::operator^ ( const QVVector vector  )  const [inline]

Vector cross product.

Parameters:
vector operand for the product
See also:
crossProduct

Definition at line 123 of file qvvector.h.

QVVector QVVector::operator+ ( const QVVector vector  )  const [inline]

Vector add.

Parameters:
vector term for the operation
See also:
add

Definition at line 129 of file qvvector.h.

QVVector QVVector::operator- ( const QVVector vector  )  const [inline]

Vector substraction.

Parameters:
vector subtrahend for the operation
See also:
substract

Definition at line 135 of file qvvector.h.

QVVector QVVector::operator* ( const double  value  )  const [inline]

Scalar multiplication.

Parameters:
value value to multiply each component of the vector
See also:
operator*(const double)

Definition at line 141 of file qvvector.h.

QVVector QVVector::operator/ ( const double  value  )  const [inline]

Scalar division.

Parameters:
value value to divide each component of the vector
See also:
scalarDivide

Definition at line 147 of file qvvector.h.

Referenced by normalize().

QVVector QVVector::operator* ( const QVMatrix matrix  )  const

Vector-matrix product.

Parameters:
matrix operand for the product

Definition at line 66 of file qvvector.cpp.

bool QVVector::operator== ( const QVVector vector  )  const [inline]

Compare operator.

Parameters:
vector vector to compare
See also:
equals

Definition at line 158 of file qvvector.h.

QVVector& QVVector::operator+= ( const QVVector vector  )  [inline]

Add compound assignment operator.

Parameters:
vector vector to add

Definition at line 163 of file qvvector.h.

QVVector::operator QPointF (  )  const [inline]

Convert to QPointF operator.

Cast from homogeneous coordinates.

Definition at line 170 of file qvvector.h.

QVVector::operator gsl_vector * (  )  const [inline]

Convert to gsl_vector * operator.

Parameters:
value gsl_vector

Definition at line 183 of file qvvector.h.

int QVVector::maxIndex (  )  const [inline]

Gets the location of the element with the maximal value.

Returns:
-1 if the vector has zero elements, else the index of the largest element.

Definition at line 197 of file qvvector.h.

Referenced by maxAbsIndex().

int QVVector::minIndex (  )  const [inline]

Gets the location of the element with the minimal value.

Returns:
-1 if the vector has zero elements, else the index of the lowest element.

Definition at line 212 of file qvvector.h.

Referenced by minAbsIndex().

int QVVector::maxAbsIndex (  )  const [inline]

Gets the index of the element with the maximal absolute value.

Returns:
-1 if the vector has zero elements, else the index of the element with the greatest absolute value.

Definition at line 227 of file qvvector.h.

int QVVector::minAbsIndex (  )  const [inline]

Gets the index of the element with the minimal absolute value.

Returns:
-1 if the vector has zero elements, else the index of the element with the lowest absolute value.

Definition at line 243 of file qvvector.h.

void QVVector::set ( const double  value  )  [inline]

Set vector elements to a value.

Parameters:
value value to set all the elements of the vector

Definition at line 260 of file qvvector.h.

QVVector QVVector::subVector ( const int  firstIndex,
const int  lastIndex 
) [inline]

Set vector elements to a value.

Parameters:
value value to set all the elements of the vector

Definition at line 269 of file qvvector.h.

QVVector QVVector::scalarDivision ( const double  value  )  const [inline]

Scalar division.

Parameters:
value value to divide each component of the vector
See also:
operator/(const double)

Definition at line 286 of file qvvector.h.

Referenced by operator/().

QVVector QVVector::scalarMultiplication ( const double  value  )  const [inline]

Scalar multiplication.

Parameters:
value value to multiply each component of the vector
See also:
operator*(const double)

Definition at line 298 of file qvvector.h.

Referenced by operator*().

double QVVector::norm2 (  )  const [inline]

QVVector QVVector::normalize (  )  const [inline]

Normalize vector.

Divides each element of the vector by its second norm.

See also:
norm

Definition at line 316 of file qvvector.h.

double QVVector::sum (  )  const

Accumulated value.

This function returns the sumatory of the elements of the vector.

$ \bar{x} = \sum_{i=1}^n{x_i} $

Definition at line 199 of file qvvector.cpp.

Referenced by entropy(), and mean().

double QVVector::mean (  )  const

Mean value.

This function returns the standard average value of the vector:

$ \bar{x} = \frac{1}{n} \sum_{i=1}^n{x_i} $

Definition at line 208 of file qvvector.cpp.

Referenced by variance().

double QVVector::median (  )  const

Median value.

This function returns the middle element in the list of sorted elements of the vector:

Definition at line 213 of file qvvector.cpp.

double QVVector::variance (  )  const

Standard deviation.

This function returns a variance estimation of the elements in the vector:

$ s^2 = \frac{1}{n-1} \sum_{i=1}^n\left(x_i - \overline{x} \right)^ 2 $

Definition at line 221 of file qvvector.cpp.

double QVVector::entropy ( const double  base = 2  )  const

Shannon's entropy of a probability state vector.

This function calculates the entropy of the elements of the vector. These elements are considered as the probabilities of a random variable, over a set domain. Thus the sum of the vector elements must be equal to $ 1 $. The entropy is computed with the following formula:

$ H(X) = - \sum_{i=1}^n p(x_i) \log_b p(x_i) $

If the sum of the elements of the vector is not $ 1 $, they are normalized before computing the entropy. In the case of $ x_i = 0 $ for some $ x_i $ element of the vector, the value of the corresponding summand $ 0 \cdot log_b(0) $ is taken to be $ 0 $, which is consistent with the limit

$ \lim_{p\to0+}p\log p = 0 $

Parameters:
base base of the logarithm in the entropy equation.

Definition at line 231 of file qvvector.cpp.

double QVVector::dotProduct ( const QVVector vector  )  const

Vector dot product.

Parameters:
vector operand for the product
See also:
operator*

Definition at line 38 of file qvvector.cpp.

Referenced by operator*().

QVVector QVVector::crossProduct ( const QVVector vector  )  const

Vector cross product.

Computes the cross product for two vectors of size 3

Parameters:
vector operand for the product
See also:
operator^

Definition at line 49 of file qvvector.cpp.

Referenced by operator^().

QVVector QVVector::add ( const QVVector vector  )  const

Vector add.

Parameters:
vector term for the operation
See also:
operator+

Definition at line 80 of file qvvector.cpp.

QVVector QVVector::substract ( const QVVector vector  )  const

Vector substraction.

Parameters:
vector subtrahend for the operation
See also:
operator-

Definition at line 91 of file qvvector.cpp.

Referenced by operator-().

bool QVVector::equals ( const QVVector vector  )  const

Compare operator.

Parameters:
vector vector to compare
See also:
equals

Definition at line 102 of file qvvector.cpp.

Referenced by operator==().

const QVVector QVVector::gaussianVector ( const int  radius,
const double  sigma 
) [static]

Vector of Gaussian distributed values.

This function generates a vector containing homogeneously sampled values of a gaussian distribution. The size of the vector will equal the double of the radius of the gaussian distribution plus one. The standart deviation must be explicitally provided.

gaussvector.png

Parameters:
radius Radius of the gaussian distribution.
sigma Sigma of the gaussian distribution.

Definition at line 146 of file qvvector.cpp.

const QVVector QVVector::mexicanHatWaveletVector ( const int  radius,
const double  sigma 
) [static]

Vector of mexican hat wavelet distributed values.

This function generates a vector containing homogeneously sampled values of a mexican hat wavelet distribution. The size of the vector will equal the double of the radius of the wavelet distribution plus one. The standart deviation must be explicitally provided.

mexicanhatvector.png

Parameters:
radius Radius of the wavelet distribution.
sigma Sigma of the wavelet distribution.

Definition at line 160 of file qvvector.cpp.

const QVVector QVVector::homogeneousCoordinates ( const QPointF &  point  )  [static]

Creates vector corresponding to the homogeneous coordinates of a 2D point.

Parameters:
point 2D input point.

Definition at line 174 of file qvvector.cpp.

QVVector QVVector::homogeneousCoordinates (  )  const

Obtains the vector in homogeneous coordinates.

This method simply copies the actual vector and adds an extra element containing the value 1.

Returns:
The vector in homogeneous coordinates.

Definition at line 114 of file qvvector.cpp.

QVMatrix QVVector::crossProductMatrix (  )  const

Obtain the matrix corresponding to the matrix multiplication notation for the vector cross product.

This function returns a matrix which can be used in the cross product multiplication rewritten as a matrix product. The cross product between two vectors:

$ \mathbf{a} \times \mathbf{b} = \mathbf{c} $

Can be rewritten as the following matrix multiplication:

$ [\mathbf{a}]_\times \mathbf{b} = \mathbf{c} $

Where $ [\mathbf{a}]_\times $ is the so called cross product matrix for vector $ \mathbf{a} $, which has the following structure:

$ [\mathbf{a}]_{\times} = \left( \begin{array}{ccc} 0 & -a_3 & a_2 \\ a_3 & 0 & -a_1 \\ -a_2 & a_1 & 0\end{array} \right)$

This function only works on vectors of size 3.

Parameters:
vector vector to compare
See also:
equals

Definition at line 119 of file qvvector.cpp.

Referenced by getEssentialMatrixFromCanonicalCameraMatrix().


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



QVision framework. PARP research group. Copyright © 2007, 2008, 2009, 2010.