PARP Research Group | Universidad de Murcia |
QVVector Class Reference
|
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 int index) |
Element access operator. | |
double | operator() (const int index) const |
Overloaded version of element access operator. | |
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 |
Obtains the additive inverse of the vector. | |
QVVector | operator+ (const double value) const |
Scalar addition. | |
QVVector | operator- (const double value) const |
Scalar 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. | |
QVVector & | operator+= (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) const |
Obtains a sub-vector containing a given range of elements from the original vector. | |
QVVector | scalarDivision (const double value) const |
Scalar division. | |
QVVector | scalarAdd (const double value) const |
Scalar addition. | |
QVVector | scalarSubstract (const double value) const |
Scalar substraction. | |
QVVector | scalarMultiplication (const double value) const |
Scalar multiplication. | |
QVVector | scalarProduct (const double value) const |
Scalar multiplication. | |
double | norm2 () const |
Norm 2 of the vector. | |
bool | containsNaN () const |
Checks whether the vector contains a NaN value or not. | |
QVVector | normalize () const |
Normalize vector. | |
QVVector | abs () const |
Gets the absolute values of the vector elements. | |
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. | |
QVMatrix | outerProduct (const QVVector &vector) const |
Outer product with another vector (to obtain a matrix). | |
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 QVVector | random (const int elements) |
Creates a vector of random 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 (appending a value 1.0 on an added dimension). |
Implementation of numerical vectors.
Definition at line 58 of file qvvector.h.
QVVector::QVVector | ( | ) | [inline] |
Default constructor for QVVector.
vector | operand for the product |
Definition at line 64 of file qvvector.h.
Referenced by homogeneousCoordinates().
QVVector::QVVector | ( | const int | size, | |
const double | defaultValue = 0 | |||
) | [inline] |
Constructor for QVVector.
int | initializing size for the vector | |
defaultValue | default value to set all elements of the vector |
Definition at line 70 of file qvvector.h.
QVVector::QVVector | ( | const int | size, | |
const double * | defaultValues | |||
) | [inline] |
Constructor for QVVector.
int | initializing size for the vector | |
defaultValues | array of doubles, containing the inizialization data |
Definition at line 76 of file qvvector.h.
QVVector::QVVector | ( | const QVVector & | vector | ) | [inline] |
Copy constructor for QVVector.
vector | vector to be copied |
Definition at line 85 of file qvvector.h.
QVVector::QVVector | ( | const QVector< double > & | vector | ) | [inline] |
Copy constructor for QVector.
vector | vector to be copied |
Definition at line 90 of file qvvector.h.
QVVector::QVVector | ( | const QList< double > & | list | ) | [inline] |
Convert constructor from QList.
list | List of double values to be converted to QVVector |
Definition at line 95 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.
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.
vector | vector to be copied |
Definition at line 110 of file qvvector.h.
QVVector::QVVector | ( | const QPoint & | point | ) | [inline] |
Convert constructor for QPoint.
vector | vector to be copied |
Definition at line 120 of file qvvector.h.
QVVector::QVVector | ( | const QPointF & | point | ) | [inline] |
Convert constructor for QPointF.
vector | vector to be copied |
Definition at line 125 of file qvvector.h.
double& QVVector::operator() | ( | const int | index | ) | [inline] |
Element access operator.
index | main index value for data access |
Definition at line 132 of file qvvector.h.
double QVVector::operator() | ( | const int | index | ) | const [inline] |
Overloaded version of element access operator.
row | main index value for data access | |
col | secondary index value for data access |
Definition at line 139 of file qvvector.h.
double QVVector::operator* | ( | const QVVector & | vector | ) | const [inline] |
Vector dot product.
vector | operand for the product |
Definition at line 146 of file qvvector.h.
Referenced by operator-().
Vector cross product.
vector | operand for the product |
Definition at line 152 of file qvvector.h.
Vector add.
vector | term for the operation |
Definition at line 158 of file qvvector.h.
Vector substraction.
vector | subtrahend for the operation |
Definition at line 164 of file qvvector.h.
QVVector QVVector::operator- | ( | ) | const [inline] |
Obtains the additive inverse of the vector.
Obtains a vector changing the sign of its elements.
Definition at line 171 of file qvvector.h.
QVVector QVVector::operator+ | ( | const double | value | ) | const [inline] |
Scalar addition.
value | value to multiply each component of the vector |
Definition at line 178 of file qvvector.h.
QVVector QVVector::operator- | ( | const double | value | ) | const [inline] |
Scalar substraction.
value | value to multiply each component of the vector |
Definition at line 184 of file qvvector.h.
QVVector QVVector::operator* | ( | const double | value | ) | const [inline] |
Scalar multiplication.
value | value to multiply each component of the vector |
Definition at line 190 of file qvvector.h.
QVVector QVVector::operator/ | ( | const double | value | ) | const [inline] |
Scalar division.
value | value to divide each component of the vector |
Definition at line 196 of file qvvector.h.
Referenced by normalize().
Vector-matrix product.
matrix | operand for the product |
Definition at line 92 of file qvvector.cpp.
bool QVVector::operator== | ( | const QVVector & | vector | ) | const [inline] |
Compare operator.
vector | vector to compare |
Definition at line 207 of file qvvector.h.
Add compound assignment operator.
vector | vector to add |
Definition at line 212 of file qvvector.h.
QVVector::operator QPointF | ( | ) | const [inline] |
Convert to QPointF operator.
Cast from homogeneous coordinates.
Definition at line 229 of file qvvector.h.
QVVector::operator gsl_vector * | ( | ) | const [inline] |
Convert to gsl_vector * operator.
value | gsl_vector |
Definition at line 244 of file qvvector.h.
int QVVector::maxIndex | ( | ) | const |
Gets the location of the element with the maximal value.
Definition at line 317 of file qvvector.cpp.
Referenced by QVPermutation::fromMatrix(), and maxAbsIndex().
int QVVector::minIndex | ( | ) | const |
Gets the location of the element with the minimal value.
Definition at line 329 of file qvvector.cpp.
Referenced by minAbsIndex().
int QVVector::maxAbsIndex | ( | ) | const |
Gets the index of the element with the maximal absolute value.
Definition at line 341 of file qvvector.cpp.
int QVVector::minAbsIndex | ( | ) | const |
Gets the index of the element with the minimal absolute value.
Definition at line 354 of file qvvector.cpp.
void QVVector::set | ( | const double | value | ) |
Set vector elements to a value.
value | value to set all the elements of the vector |
Definition at line 367 of file qvvector.cpp.
QVVector QVVector::subVector | ( | const int | firstIndex, | |
const int | lastIndex | |||
) | const |
Obtains a sub-vector containing a given range of elements from the original vector.
firstIndex | First element in the value range for the resulting subvector. | |
secondIndex | Last element in the value range for the resulting subvector. |
Definition at line 373 of file qvvector.cpp.
QVVector QVVector::scalarDivision | ( | const double | value | ) | const |
Scalar division.
value | value to divide each component of the vector |
Definition at line 386 of file qvvector.cpp.
Referenced by operator/().
QVVector QVVector::scalarAdd | ( | const double | value | ) | const |
Scalar addition.
value | value to divide each component of the vector |
Definition at line 395 of file qvvector.cpp.
Referenced by operator+(), and operator+().
QVVector QVVector::scalarSubstract | ( | const double | value | ) | const |
Scalar substraction.
value | value to divide each component of the vector |
Definition at line 404 of file qvvector.cpp.
Referenced by operator-(), and operator-().
QVVector QVVector::scalarMultiplication | ( | const double | value | ) | const |
Scalar multiplication.
value | value to multiply each component of the vector |
Definition at line 413 of file qvvector.cpp.
QVVector QVVector::scalarProduct | ( | const double | value | ) | const |
Scalar multiplication.
value | value to multiply each component of the vector |
Definition at line 419 of file qvvector.cpp.
Referenced by operator*(), operator*(), and scalarMultiplication().
double QVVector::norm2 | ( | ) | const |
Norm 2 of the vector.
Reimplemented in QVQuaternion.
Definition at line 230 of file qvvector.cpp.
Referenced by getCameraPoseFromCalibratedHomography(), lnSO3(), normalize(), QVQuaternion::QVQuaternion(), saveSIFTDescriptorsInLoweSIFTFileFormat(), solveHomogeneous(), and symmetricEpipolarDistance().
bool QVVector::containsNaN | ( | ) | const |
Checks whether the vector contains a NaN value or not.
Definition at line 235 of file qvvector.cpp.
Referenced by checkForNaNValues(), QVCameraPose::compose(), QVQuaternion::conjugate(), QVCameraPose::containsNaN(), incrementalGEA(), QVQuaternion::inverse(), QVCameraPose::inverse(), linearCameraPairInitialization(), QVCameraPose::operator QVEuclideanMapping3(), QVCameraPose::operator QVVector(), QVCameraPose::operator!=(), QVCameraPose::operator==(), optimizeReprojectionErrorForCameraPoseCauchy(), QVCameraPose::project(), QVQuaternion::quaternionProduct(), QVCameraPose::QVCameraPose(), QVQuaternion::QVQuaternion(), QVQuaternion::rotate(), QVCameraPose::toCameraReferenceCoordinates(), QVQuaternion::toEulerAngles(), QVCameraPose::toProjectionMatrix(), and QVQuaternion::toRotationMatrix().
QVVector QVVector::normalize | ( | ) | const |
Normalize vector.
Divides each element of the vector by its euclidean norm.
Definition at line 244 of file qvvector.cpp.
QVVector QVVector::abs | ( | ) | const |
Gets the absolute values of the vector elements.
Definition at line 249 of file qvvector.cpp.
double QVVector::max | ( | ) | const |
Maximal value contained in the vector.
Definition at line 258 of file qvvector.cpp.
double QVVector::min | ( | ) | const |
Minimal value contained in the vector.
Definition at line 266 of file qvvector.cpp.
double QVVector::sum | ( | ) | const |
Accumulated value.
This function returns the sumatory of the elements of the vector.
Definition at line 274 of file qvvector.cpp.
double QVVector::mean | ( | ) | const |
Mean value.
This function returns the standard average value of the vector:
Definition at line 283 of file qvvector.cpp.
Referenced by QVDirectedGraph< Element >::getMeanConnectivity(), and 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 288 of file qvvector.cpp.
double QVVector::variance | ( | ) | const |
Standard deviation.
This function returns a variance estimation of the elements in the vector:
Definition at line 296 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. Thus the sum of the vector elements must be equal to . The entropy is computed with the following formula:
If the sum of the elements of the vector is not , they are normalized before computing the entropy. In the case of for some element of the vector, the value of the corresponding summand is taken to be , which is consistent with the limit
base | base of the logarithm in the entropy equation. |
Definition at line 306 of file qvvector.cpp.
double QVVector::dotProduct | ( | const QVVector & | vector | ) | const |
Vector dot product.
vector | operand for the product |
Definition at line 38 of file qvvector.cpp.
Referenced by operator*().
Vector cross product.
Computes the cross product for two vectors of size 3
vector | operand for the product |
Definition at line 49 of file qvvector.cpp.
Referenced by operator^().
Outer product with another vector (to obtain a matrix).
Computes the matrix M which is the outer product with another vector
vector | operand for the product |
Definition at line 70 of file qvvector.cpp.
Referenced by pseudoInverse().
Vector add.
vector | term for the operation |
Definition at line 106 of file qvvector.cpp.
Referenced by operator+().
Vector substraction.
vector | subtrahend for the operation |
Definition at line 122 of file qvvector.cpp.
Referenced by operator-().
bool QVVector::equals | ( | const QVVector & | vector | ) | const |
Compare operator.
vector | vector to compare |
Definition at line 138 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.
radius | Radius of the gaussian distribution. | |
sigma | Sigma of the gaussian distribution. |
Definition at line 185 of file qvvector.cpp.
QVVector QVVector::random | ( | const int | elements | ) | [static] |
Creates a vector of random values.
This function returns a vector containing random values, from a uniform distribution [0,1].
elements | size of the vector |
Definition at line 199 of file qvvector.cpp.
Referenced by solveHomogeneous().
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 function. The size of the vector will equal the double of the radius plus one. The standart deviation must be explicitally provided.
radius | Radius of the wavelet distribution. | |
sigma | Sigma of the wavelet distribution. |
Definition at line 207 of file qvvector.cpp.
const QVVector QVVector::homogeneousCoordinates | ( | const QPointF & | point | ) | [static] |
Creates vector corresponding to the homogeneous coordinates of a 2D point (appending a value 1.0 on an added dimension).
point | 2D input point. |
Definition at line 221 of file qvvector.cpp.
Referenced by reconstructionError().
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.
Definition at line 153 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:
Can be rewritten as the following matrix multiplication:
Where is the so called cross product matrix for vector , which has the following structure:
This function only works on vectors of size 3.
vector | vector to compare |
Definition at line 158 of file qvvector.cpp.
QVMatrix QVVector::toRowMatrix | ( | ) | const |
Returns this vector in the form of a row matrix.
Definition at line 170 of file qvvector.cpp.
QVMatrix QVVector::toColumnMatrix | ( | ) | const |
Returns this vector in the form of a column matrix.
Definition at line 177 of file qvvector.cpp.
Referenced by solveByCholeskyDecomposition(), solveByLUDecomposition(), solveByQRDecomposition(), solveBySingularValueDecomposition(), solveFromCholeskyDecomposition(), solveFromLUDecomposition(), solveFromQRDecomposition(), and solveFromSingularValueDecomposition().