Isis Developer Reference
Isis::LinearAlgebra Class Reference

This class holds all static methods to perform linear algebra operations on vectors and matrices. More...

#include <LinearAlgebra.h>

Collaboration diagram for Isis::LinearAlgebra:
Collaboration graph

Public Types

typedef boost::numeric::ublas::matrix< double > Matrix
 Definition for an Isis::LinearAlgebra::Matrix of doubles.
 
typedef boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > SymmetricMatrix
 Definition for an Isis::LinearAlgebra::SymmetrixMatrix of doubles with an upper configuration.
 
typedef boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > MatrixUpperTriangular
 Definition for an Isis::LinearAlgebra::MatrixUpperTriangular of doubles with an upper configuration.
 
typedef boost::numeric::ublas::vector< double > Vector
 Definition for an Isis::LinearAlgebra::Vector of doubles.
 
typedef boost::numeric::ublas::compressed_vector< double > VectorCompressed
 Definition for an Isis::LinearAlgebra::VectorCompressed of doubles.
 
typedef QPair< Vector, AngleAxisAngle
 Definition for an Axis-Angle pair.
 
typedef QPair< Angle, int > EulerAngle
 Definition for an EulerAngle pair.
 

Static Public Member Functions

static bool isIdentity (const Matrix &matrix)
 Determines whether the given matrix is the identity.
 
static bool isOrthogonal (const Matrix &matrix)
 Determines whether the given matrix is orthogonal by verifying that the matrix and its tranpose are inverses.
 
static bool isRotationMatrix (const Matrix &matrix)
 Determines whether the given matrix is a rotation matrix.
 
static bool isZero (const Matrix &matrix)
 Determines whether the given matrix is filled with zereos.
 
static bool isZero (const Vector &vector)
 Determines whether the given vector is filled with zereos.
 
static bool isEmpty (const Vector &vector)
 Determines whether the given vector is empty (i.e.
 
static bool isUnit (const Vector &vector)
 Determines whether the given vector is a unit vector.
 
static Matrix identity (int size)
 Returns the identity matrix of size NxN.
 
static Matrix transpose (const Matrix &matrix)
 Returns the transpose of the given matrix.
 
static Matrix inverse (const Matrix &matrix)
 Returns the inverse of a 2x2 or 3x3 matrix.
 
static Matrix pseudoinverse (const Matrix &matrix)
 Returns the pseudoinverse of a matrix.
 
static Matrix zeroMatrix (int rows, int columns)
 Returns a matrix with given dimensions that is filled with zeroes.
 
static Vector zeroVector (int size)
 Returns a vector of given length that is filled with zeroes.
 
static double determinant (const Matrix &matrix)
 Returns the determinant of the given 3x3 matrix.
 
static Vector normalize (const Vector &vector)
 Returns a unit vector that is codirectional with the given vector by dividing each component of the vector by the vector magnitude.
 
static double magnitude (const Vector &vector)
 Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm).
 
static double absoluteMaximum (const Vector &vector)
 Returns the maximum norm (L-infinity norm) for the given vector.
 
static Matrix multiply (const Matrix &matrix1, const Matrix &matrix2)
 Returns the product of two matrices.
 
static Vector multiply (const Matrix &matrix, const Vector &vector)
 Computes the product of the given matrix and vector.
 
static Vector multiply (double scalar, const Vector &vector)
 Multiplies the given scalar and vector.
 
static Matrix multiply (double scalar, const Matrix &matrix)
 Multiplies the given scalar and matrix.
 
static Vector add (const Vector &vector1, const Vector &vector2)
 Adds the two given vectors.
 
static Vector subtract (const Vector &vector1, const Vector &vector2)
 Subtracts the right vector from the left vector.
 
static Vector crossProduct (const Vector &vector1, const Vector &vector2)
 Returns the cross product of two vectors.
 
static Vector normalizedCrossProduct (const Vector &vector1, const Vector &vector2)
 Divides each vector by its corresponding absolute maximum, computes the cross product of the new vectors, and normalizes the resultant vector from the cross product.
 
static Matrix outerProduct (const Vector &vector1, const Vector &vector2)
 Computes the outer product of the given vectors.
 
static double dotProduct (const Vector &vector1, const Vector &vector2)
 Computes the dot product of the given vectors.
 
static double innerProduct (const Vector &vector1, const Vector &vector2)
 Computes the inner product of the given vectors.
 
static Vector project (const Vector &vector1, const Vector &vector2)
 Compute the vector projection of vector1 onto vector2.
 
static Vector rotate (const Vector &vector, const Vector &axis, Angle angle)
 Rotates a vector about an axis vector given a specified angle.
 
static Vector perpendicular (const Vector &vector1, const Vector &vector2)
 Finds the unique vector P such that A = V + P, V is parallel to B and P is perpendicular to B, where A is the first vector (vector1) and B is the second vector (vector2) passed in by the user.
 
static AxisAngle toAxisAngle (const Matrix &rotationMatrix)
 Converts a rotation's representation from a matrix to a axis of rotation and its corresponding rotation angle.
 
static Matrix toMatrix (const AxisAngle &axisAngle)
 Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
 
static Matrix toMatrix (const Vector &axis, Angle angle)
 Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
 
static QList< EulerAngletoEulerAngles (const Matrix &rotationMatrix, const QList< int > axes)
 Converts a rotation's representation from a matrix to a set of Euler angles with corresponding axes.
 
static Matrix toMatrix (const QList< EulerAngle > &eulerAngles)
 Converts a rotation's representation from a list of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
 
static Matrix toMatrix (const EulerAngle &angle3, const EulerAngle &angle2, const EulerAngle &angle1)
 Converts a rotation's representation from a set of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
 
static Vector toQuaternion (const Matrix &rotationMatrix)
 Converts a rotation's representation from a matrix to a unit quaternion.
 
static Matrix toMatrix (const Vector &quaternion)
 Converts a rotation's representation from a quaternion to a 3x3 matrix.
 
static void setRow (Matrix &matrix, const Vector &vector, int rowIndex)
 Sets the row of the given matrix to the values of the given vector.
 
static void setColumn (Matrix &matrix, const Vector &vector, int columnIndex)
 Sets the column of the given matrix to the values of the given vector.
 
static Vector row (const Matrix &matrix, int rowIndex)
 Returns a vector whose components match those of the given matrix row.
 
static Vector column (const Matrix &matrix, int columnIndex)
 Returns a vector whose components match those of the given matrix column.
 
static void setVec3 (Vector *v, double v0, double v1, double v2)
 Fills the first three elements of the given vector with the given values.
 
static void setVec4 (Vector *v, double v0, double v1, double v2, double v3)
 Fills the first four elements of the given vector with the given values.
 
static Vector vector (double v0, double v1, double v2)
 Constructs a 3 dimensional vector with the given component values.
 
static Vector vector (double v0, double v1, double v2, double v3)
 Constructs a 4 dimensional vector with the given component values.
 
static Vector subVector (const Vector &v, int start, int size)
 Constructs a vector of given size using the given vector and starting index.
 

Protected Member Functions

 LinearAlgebra ()
 Default constructor for a LinearAlgebra object.
 
 ~LinearAlgebra ()
 Destructor for a LinearAlgebra object.
 

Detailed Description

This class holds all static methods to perform linear algebra operations on vectors and matrices.

This class has 4 representations of a 3 dimensional rotation

  • A 3 X 3 rotation matrix
  • An angle/axis pair - This pair is made up of a vector (axis) and angle of rotation about that axis.
  • A quaternion - This is saved as a 4-valued unit vector of the form q = (q0, q1, q2, q3) where for the angle/axis pair of the form (A, (ux, uy, uz)), we have q0 = cos(A/2), q1 = ux*sin(A/2), q2 = uy*sin(A/2), q3 = uz*sin(A/2).
  • A set of Euler angles - This is a set of three angles and their corresponding axis of rotation. In this case, each axis must be one of the x, y, or z axes for the coordinate system.
Author
2013-06-01 Jeannie Backer

Member Typedef Documentation

◆ AxisAngle

Definition for an Axis-Angle pair.

This is a three dimensional rotation represented as an axis of rotation and a corresponding rotation angle. AxisAngle is a typedef for a QPair of an Isis::LinearAlgebra::Vector and an Isis::Angle.

◆ EulerAngle

Definition for an EulerAngle pair.

This is a three dimensional rotation represented as an Euler angle and the number corresponding to its rotation axis. EulerAngle is a typedef for a QPair of an Isis::Angle and an integer (1, 2, or 3).

◆ Matrix

typedef boost::numeric::ublas::matrix<double> Isis::LinearAlgebra::Matrix

Definition for an Isis::LinearAlgebra::Matrix of doubles.

This is a typedef for a boost matrix.

Note: This typedef is used so that we can add functionality to an existing matrix type and/or change which third party library's matrix we are using without changing all references to this type in the ISIS API.

◆ MatrixUpperTriangular

typedef boost::numeric::ublas::symmetric_matrix<double, boost::numeric::ublas::upper> Isis::LinearAlgebra::MatrixUpperTriangular

Definition for an Isis::LinearAlgebra::MatrixUpperTriangular of doubles with an upper configuration.

This is a typedef for a boost symmetric_matrix.

Note: This typedef is used so that we can add functionality to an existing matrix type and/or change which third party library's matrix we are using without changing all references to this type in the ISIS API.

◆ SymmetricMatrix

typedef boost::numeric::ublas::symmetric_matrix<double, boost::numeric::ublas::upper> Isis::LinearAlgebra::SymmetricMatrix

Definition for an Isis::LinearAlgebra::SymmetrixMatrix of doubles with an upper configuration.

This is a typedef for a boost symmetric_matrix.

Note: This typedef is used so that we can add functionality to an existing matrix type and/or change which third party library's matrix we are using without changing all references to this type in the ISIS API.

◆ Vector

typedef boost::numeric::ublas::vector<double> Isis::LinearAlgebra::Vector

Definition for an Isis::LinearAlgebra::Vector of doubles.

This is a typedef for a boost vector.

Note: This typedef is used so that we can add functionality to an existing vector type and/or change which third party library's vector we are using without changing all references to this type in the ISIS API.

◆ VectorCompressed

typedef boost::numeric::ublas::compressed_vector<double> Isis::LinearAlgebra::VectorCompressed

Definition for an Isis::LinearAlgebra::VectorCompressed of doubles.

This is a typedef for a boost vector. It stores the vector in a more memory efficient form.

Note: This typedef is used so that we can add functionality to an existing vector type and/or change which third party library's vector we are using without changing all references to this type in the ISIS API.

Constructor & Destructor Documentation

◆ LinearAlgebra()

Isis::LinearAlgebra::LinearAlgebra ( )
protected

Default constructor for a LinearAlgebra object.

This is protected so it can never be constructed. The static methods and typedefs in this class are meant to be used without a LinearAlgebra object.

◆ ~LinearAlgebra()

Isis::LinearAlgebra::~LinearAlgebra ( )
protected

Destructor for a LinearAlgebra object.

Member Function Documentation

◆ absoluteMaximum()

double Isis::LinearAlgebra::absoluteMaximum ( const Vector & vector)
static

Returns the maximum norm (L-infinity norm) for the given vector.

The maximum norm is defined by the absolute values of the vector components:

\( \| v \|_\infty = \max_{i=1}^n \{ \mid v_i \mid \} \)

Parameters
vectorThe vector whose absolute maximum will be returned.
Returns
double The maximum of the absolute values of the vector components.

Referenced by magnitude(), normalizedCrossProduct(), and perpendicular().

◆ add()

LinearAlgebra::Vector Isis::LinearAlgebra::add ( const Vector & vector1,
const Vector & vector2 )
static

Adds the two given vectors.

Parameters
vector1The first vector.
vector2The second vector.
Returns
LinearAlgebra::Vector The sum of the vectors.
Exceptions
IException::Programmer"Unable to add vectors with mismatched sizes."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

◆ column()

LinearAlgebra::Vector Isis::LinearAlgebra::column ( const Matrix & matrix,
int columnIndex )
static

Returns a vector whose components match those of the given matrix column.

Parameters
matrixThe matrix to pull values from.
columnIndexThe index of the matrix column to grab.
Returns
LinearAlgebra::Vector A vector whose values match the given column of the given matrix.
Exceptions
IException::Programmer"Unable to get the matrix column to the given vector. Column index is out of bounds."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().

◆ crossProduct()

LinearAlgebra::Vector Isis::LinearAlgebra::crossProduct ( const Vector & vector1,
const Vector & vector2 )
static

Returns the cross product of two vectors.

Note: the cross-product requires the vectors to have exactly three components each.

Parameters
vector1The vector to the left of the cross product operator.
vector2The vector to the right of the cross product operator.
Returns
LinearAlgebra::Vector The cross product of the given vectors (i.e. vector1 x vector2).
Exceptions
IException::Programmer"Unable to calculate the cross product on vectors that are not size 3. "

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

Referenced by normalizedCrossProduct(), and rotate().

◆ determinant()

double Isis::LinearAlgebra::determinant ( const Matrix & matrix)
static

Returns the determinant of the given 3x3 matrix.

Parameters
LinearAlgebra::MatrixThe 3x3 matrix whose determinant will be calculated.
Returns
double The determinant of the given matrix.
Exceptions
IException::Programmer"Unable to calculate the determinant for the given matrix. This method only calculates the determinant for 2x2 or 3x3 matrices."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

Referenced by inverse(), and isRotationMatrix().

◆ dotProduct()

double Isis::LinearAlgebra::dotProduct ( const Vector & vector1,
const Vector & vector2 )
static

Computes the dot product of the given vectors.

For Euclidean space, this is the same as the inner product, so these methods are interchangeable.

See also
innerProduct()
Parameters
vector1The first vector.
vector2The second vector.
Returns
double The dot product of the vectors.

References innerProduct().

Referenced by isUnit(), project(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().

◆ identity()

LinearAlgebra::Matrix Isis::LinearAlgebra::identity ( int size)
static

Returns the identity matrix of size NxN.

Parameters
intThe size of the square matrix.
Returns
LinearAlgebra::Matrix The NxN square matrix.
Exceptions
IException::Programmer"Can not create identity matrix of negative size."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

Referenced by inverse(), and toMatrix().

◆ innerProduct()

double Isis::LinearAlgebra::innerProduct ( const Vector & vector1,
const Vector & vector2 )
static

Computes the inner product of the given vectors.

For Euclidean space, this is the same as the dot product, so these methods are interchangeable.

See also
dotProduct()
Parameters
vector1The first vector.
vector2The second vector.
Returns
double The inner product of the vectors.
Exceptions
IException::Programmer"Unable to compute the dot product for vectors with mismatched sizes."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

Referenced by dotProduct().

◆ inverse()

LinearAlgebra::Matrix Isis::LinearAlgebra::inverse ( const Matrix & matrix)
static

Returns the inverse of a 2x2 or 3x3 matrix.

Throws an error if the given matrix is not invertible.

Parameters
matrixThe matrix to inverse.
Returns
LinearAlgebra::Matrix The inverse matrix.
Exceptions
IException::Programmer"The given matrix is not invertible. The determinant is 0.0."
IException::Programmer"Unable to invert the given matrix."

References _FILEINFO_, determinant(), identity(), inverse(), isOrthogonal(), Isis::IException::Programmer, transpose(), and vector().

Referenced by inverse(), and pseudoinverse().

◆ isEmpty()

bool Isis::LinearAlgebra::isEmpty ( const Vector & vector)
static

Determines whether the given vector is empty (i.e.

size 0).

Parameters
vectorThe vector to check.
Returns
bool Returns true if the size of the given vector is zero.

◆ isIdentity()

bool Isis::LinearAlgebra::isIdentity ( const Matrix & matrix)
static

Determines whether the given matrix is the identity.

Non-square matrices always return false. A qfuzzycompare is used when checking the zeroes and ones.

Parameters
matrixThe matrix to check. Automatically returns false if not square.
Returns
bool Returns true if the matrix is a square identity matrix (i.e. there are ones down the diagonal and zeroes elsewhere).

References row(), and vector().

Referenced by isOrthogonal().

◆ isOrthogonal()

bool Isis::LinearAlgebra::isOrthogonal ( const Matrix & matrix)
static

Determines whether the given matrix is orthogonal by verifying that the matrix and its tranpose are inverses.

Parameters
matrixThe matrix to check. Automatically returns false if not square.
Returns
bool Returns true if the matrix is orthogonal.

References isIdentity(), multiply(), and transpose().

Referenced by inverse().

◆ isRotationMatrix()

bool Isis::LinearAlgebra::isRotationMatrix ( const Matrix & matrix)
static

Determines whether the given matrix is a rotation matrix.

Parameters
matrixThe matrix to check. Automatically returns false if not 2x2 or 3x3.
Returns
bool Returns true if the given matrix represents a rotation.
Exceptions
IException::Programmer"Unable to determine whether the given matrix is a rotation matrix."

References _FILEINFO_, column(), determinant(), magnitude(), Isis::IException::Programmer, setColumn(), and vector().

Referenced by toAxisAngle(), toEulerAngles(), and toQuaternion().

◆ isUnit()

bool Isis::LinearAlgebra::isUnit ( const Vector & vector)
static

Determines whether the given vector is a unit vector.

Parameters
vectorThe vector to check.
Returns
bool Returns true if the vector is a unit vector.

References dotProduct(), and vector().

Referenced by toMatrix(), and toQuaternion().

◆ isZero() [1/2]

bool Isis::LinearAlgebra::isZero ( const Matrix & matrix)
static

Determines whether the given matrix is filled with zereos.

Parameters
vectorThe matrix to check.
Returns
bool Returns true if the matrix is all zereos.

References vector().

Referenced by magnitude(), normalize(), perpendicular(), project(), rotate(), toAxisAngle(), and toMatrix().

◆ isZero() [2/2]

bool Isis::LinearAlgebra::isZero ( const Vector & vector)
static

Determines whether the given vector is filled with zereos.

Parameters
vectorThe vector to check.
Returns
bool Returns true if the vector is all zereos.

References vector().

◆ magnitude()

double Isis::LinearAlgebra::magnitude ( const Vector & vector)
static

Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm).

The maximum norm (L-infinity) is also used to stabilize the solution in order to avoid overflow. This method uses the computation

\( \| v \| = \| v \|_\infty \| \frac{v}{\| v \|_\infty} \|_2 \) where \( \| u \|_\infty = \max_{i=1}^n \{ \mid u_i \mid \} \) is the maximum norm and \( \| u \|_2 = \sqrt{\sum_{i=1}^n u_1^2} \) is the Euclidean norm.

See also
absoluteMaximum()
Parameters
vectorThe vector whose magnitude will be computed.
Returns
double The magnitude (length) of the given vector.

References absoluteMaximum(), isZero(), and magnitude().

Referenced by Isis::EmbreeShapeModel::intersectSurface(), Isis::EmbreeShapeModel::intersectSurface(), isRotationMatrix(), Isis::EmbreeShapeModel::isVisibleFrom(), Isis::EmbreeShapeModel::localRadius(), magnitude(), Isis::EmbreeTargetShape::maximumSceneDistance(), normalize(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toAxisAngle().

◆ multiply() [1/4]

LinearAlgebra::Vector Isis::LinearAlgebra::multiply ( const Matrix & matrix,
const Vector & vector )
static

Computes the product of the given matrix and vector.

The vector will be multiplied on the right side of the given matrix. Will throw an error if the two are not properly sized (matrix columns not equal to vector size).

Parameters
matrixThe matrix to be multiplied.
vectorThe column vector to be multiplied on the right side of the matrix.
Returns
LinearAlgebra::Vector The resultant vector.
Exceptions
IException::Programmer"Unable to multiply matrix and vector with mismatched dimensions."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

◆ multiply() [2/4]

LinearAlgebra::Matrix Isis::LinearAlgebra::multiply ( const Matrix & matrix1,
const Matrix & matrix2 )
static

Returns the product of two matrices.

Will throw an error if the matrices are not properly sized (the number of columns of the first matrix must match the number or rows of the second matrix).

Parameters
matrix1The left matrix.
matrix2The right matrix.
Returns
LinearAlgebra::Matrix The resultant matrix product.
Exceptions
IException::Programmer"Unable to multiply matrices with mismatched dimensions."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

Referenced by isOrthogonal(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().

◆ multiply() [3/4]

LinearAlgebra::Matrix Isis::LinearAlgebra::multiply ( double scalar,
const Matrix & matrix )
static

Multiplies the given scalar and matrix.

Parameters
scalarThe scalar to be multiplied by each element of the matrix.
matrixThe matrix to be scaled.
Returns
LinearAlgebra::Matrix The resultant scaled matrix.

◆ multiply() [4/4]

LinearAlgebra::Vector Isis::LinearAlgebra::multiply ( double scalar,
const Vector & vector )
static

Multiplies the given scalar and vector.

Parameters
scalarThe scalar to be multiplied by each component of the vector.
vectorThe vector to be scaled.
Returns
LinearAlgebra::Vector The resultant scaled vector.

References vector().

◆ normalize()

LinearAlgebra::Vector Isis::LinearAlgebra::normalize ( const Vector & vector)
static

Returns a unit vector that is codirectional with the given vector by dividing each component of the vector by the vector magnitude.

\( \hat{v} = \frac{v}{\| v \|} \) where \( \| u \|_ \) is the magnitude of u.

See also
magnitude()
Parameters
vectorThe vector to be normalized.
Returns
LinearAlgebra::Vector A unit vector from the given vector.
Exceptions
IException::Programmer"Unable to normalize the zero vector."

References _FILEINFO_, isZero(), magnitude(), and Isis::IException::Unknown.

Referenced by Isis::EmbreeTargetShape::getHitInformation(), Isis::EmbreeShapeModel::intersectSurface(), Isis::EmbreeShapeModel::intersectSurface(), normalizedCrossProduct(), rotate(), toAxisAngle(), toEulerAngles(), toMatrix(), and toQuaternion().

◆ normalizedCrossProduct()

LinearAlgebra::Vector Isis::LinearAlgebra::normalizedCrossProduct ( const Vector & vector1,
const Vector & vector2 )
static

Divides each vector by its corresponding absolute maximum, computes the cross product of the new vectors, and normalizes the resultant vector from the cross product.

Note: the cross-product requires the vectors to have exactly three components each.

Parameters
vector1The vector to the left of the cross product operator.
vector2The vector to the right of the cross product operator.
Returns
LinearAlgebra::Vector The normalized cross product of the given vectors (i.e. normalize(vector1/absoluteMaximum(vector1) x vector2/absoluteMaximum(vector2))).

References absoluteMaximum(), crossProduct(), normalize(), and vector().

◆ outerProduct()

LinearAlgebra::Matrix Isis::LinearAlgebra::outerProduct ( const Vector & vector1,
const Vector & vector2 )
static

Computes the outer product of the given vectors.

The outer product operation is defined as the cross product of vector1 and the conjugate transpose of vector2.

Parameters
vector1The vector to the left side of the outer product operator.
vector2The vector to the right side of the outer product operator.
Returns
LinearAlgebra::Matrix The outer product matrix of the given vectors.
Exceptions
IException::Programmer"Unable to compute the outer product for vectors with mismatched sizes."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

◆ perpendicular()

LinearAlgebra::Vector Isis::LinearAlgebra::perpendicular ( const Vector & vector1,
const Vector & vector2 )
static

Finds the unique vector P such that A = V + P, V is parallel to B and P is perpendicular to B, where A is the first vector (vector1) and B is the second vector (vector2) passed in by the user.

For all vectors A and B, there exists unique vectors V and P such that 1) A = V + P 2) V is parallel to B 3) P is perpendicular to B

Parameters
vector1The first vector, denoted A in the description.
vector2The second vector, denoted B in the description.
Returns
LinearAlgebra::Vector A vector perpendicular to vector2 and equal to vector1-parallel2 (where parallel2 is some vector that is parallel to vector2).

References absoluteMaximum(), isZero(), project(), and vector().

◆ project()

LinearAlgebra::Vector Isis::LinearAlgebra::project ( const Vector & vector1,
const Vector & vector2 )
static

Compute the vector projection of vector1 onto vector2.

This is the orthogonal projection of vector1 onto a line that is parallel to vector2.

It is defined by \( proj_{v_2} v_1 = \frac{v_1 \cdot v_2}{\| v_2 \|^2}v_2 \) where \( \| u \|_ \) is the magnitude of u.

Parameters
vector1The vector to the left of the project operator.
vector2The vector to the right of the project operator.
Returns
LinearAlgebra::Vector The resultant vector that is the orthogonal projection of vector1 onto vector2.
Exceptions
IException::Programmer"Unable to project vector1 onto vector2 with mismatched sizes."

References _FILEINFO_, dotProduct(), isZero(), Isis::IException::Programmer, Isis::toString(), and vector().

Referenced by perpendicular(), and rotate().

◆ pseudoinverse()

LinearAlgebra::Matrix Isis::LinearAlgebra::pseudoinverse ( const Matrix & matrix)
static

Returns the pseudoinverse of a matrix.

Parameters
matrixThe matrix to compute the pseudoinverse of.
Returns
LinearAlgebra::Matrix The pseudoinverse matrix.

References inverse(), and vector().

◆ rotate()

LinearAlgebra::Vector Isis::LinearAlgebra::rotate ( const Vector & vector,
const Vector & axis,
Angle angle )
static

Rotates a vector about an axis vector given a specified angle.

Note: this method only rotates a vector with three components since the cross product calculation requires this.

Parameters
vectorThe vector to rotate, which must have three components.
axisA vector defining the axis, which must also have three components.
angleThe angle to rotate.
Returns
LinearAlgebra::Vector The rotated vector.
Exceptions
IException::Programmer"Unable to rotate vector about the given axis and angle. Vectors must be of size 3 to perform rotation. "

References _FILEINFO_, crossProduct(), isZero(), normalize(), Isis::IException::Programmer, project(), Isis::Angle::radians(), Isis::toString(), and vector().

Referenced by toMatrix().

◆ row()

LinearAlgebra::Vector Isis::LinearAlgebra::row ( const Matrix & matrix,
int rowIndex )
static

Returns a vector whose components match those of the given matrix row.

Parameters
matrixThe matrix to pull values from.
rowIndexThe index of the matrix row to grab.
Returns
LinearAlgebra::Vector A vector whose values match the given row of the given matrix.
Exceptions
IException::Programmer"Unable to get the matrix row to the given vector. Row index is out of bounds."

References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().

Referenced by isIdentity().

◆ setColumn()

void Isis::LinearAlgebra::setColumn ( Matrix & matrix,
const Vector & vector,
int columnIndex )
static

Sets the column of the given matrix to the values of the given vector.

Parameters
matrixThe address of the matrix to be altered.
vectorThe vector with the new values.
columnIndexThe index of the column to be altered.
Exceptions
IException::Programmer"Unable to set the matrix column to the given vector. Column index is out of bounds."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().

◆ setRow()

void Isis::LinearAlgebra::setRow ( Matrix & matrix,
const Vector & vector,
int rowIndex )
static

Sets the row of the given matrix to the values of the given vector.

Parameters
matrixThe address of the matrix to be altered.
vectorThe vector with the new values.
rowIndexThe index of the row to be altered.
Exceptions
IException::Programmer"Unable to set the matrix row to the given vector. Row index is out of bounds."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

◆ setVec3()

void Isis::LinearAlgebra::setVec3 ( Vector * v,
double v0,
double v1,
double v2 )
static

Fills the first three elements of the given vector with the given values.

Parameters
vA pointer to a 3-dimensional vector to be filled.
v0The first component of the vector.
v1The second component of the vector.
v2The third component of the vector.

◆ setVec4()

void Isis::LinearAlgebra::setVec4 ( Vector * v,
double v0,
double v1,
double v2,
double v3 )
static

Fills the first four elements of the given vector with the given values.

Parameters
vA pointer to a 4-dimensional vector to be filled.
v0The first component of the vector.
v1The second component of the vector.
v2The third component of the vector.
v3The fourth component of the vector.

References vector().

◆ subtract()

LinearAlgebra::Vector Isis::LinearAlgebra::subtract ( const Vector & vector1,
const Vector & vector2 )
static

Subtracts the right vector from the left vector.

Parameters
vector1The vector to the left of the subtraction operator.
vector2The vector to the right of the subtraction operator.
Returns
LinearAlgebra::Vector The difference of the vectors (i.e. vector1 - vector2).
Exceptions
IException::Programmer"Unable to subtract vectors with mismatched sizes."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

◆ subVector()

LinearAlgebra::Vector Isis::LinearAlgebra::subVector ( const Vector & v,
int startIndex,
int size )
static

Constructs a vector of given size using the given vector and starting index.

Parameters
vThe original vector to get values from.
startIndexThe index of the original vector, used to indicate the first value that will be copied to the new vector.
sizeThe number of elements from the original vector to copy to the new vector.
Returns
LinearAlgebra::Vector A sub-vector containing values from the original vector.

References vector().

◆ toAxisAngle()

LinearAlgebra::AxisAngle Isis::LinearAlgebra::toAxisAngle ( const Matrix & rotationMatrix)
static

Converts a rotation's representation from a matrix to a axis of rotation and its corresponding rotation angle.

Parameters
rotationMatrixA matrix representing a rotation.
Returns
LinearAlgebra::AxisAngle The axis-angle pair representing the rotation.
Exceptions
IException::Programmer"Unable to convert the given matrix to an axis of rotation and a rotation angle. A 3x3 matrix is required."
IException::Programmer"Unable to convert the given matrix to an axis of rotation and a rotation angle. The given matrix is not a rotation matrix."

References _FILEINFO_, isRotationMatrix(), isZero(), magnitude(), normalize(), Isis::PI, Isis::IException::Programmer, Isis::Angle::setRadians(), toQuaternion(), Isis::toString(), and vector().

◆ toEulerAngles()

QList< LinearAlgebra::EulerAngle > Isis::LinearAlgebra::toEulerAngles ( const Matrix & rotationMatrix,
const QList< int > axes )
static

Converts a rotation's representation from a matrix to a set of Euler angles with corresponding axes.

Parameters
rotationMatrixA matrix representing a rotation.
axesA list containing the order of axes.
Returns
QList< LinearAlgebra::EulerAngle> The list of 3 Euler angles with their axes representing the rotation.
Exceptions
IException::Programmer"Unable to convert the given matrix to Euler angles. Exactly 3 axis codes are required."
IException::Programmer"Unable to convert the given matrix to Euler angles using the given axis codes. Axis codes must be 1, 2, or 3."
IException::Programmer"Unable to convert the given matrix to Euler angles using the given axis codes. The middle axis code must differ from its neighbors."
IException::Programmer"Unable to convert the given matrix to Euler angles. A 3x3 matrix is required."
IException::Programmer"Unable to convert the given matrix to Euler angles. The given matrix is not a rotation matrix."

References _FILEINFO_, column(), isRotationMatrix(), multiply(), normalize(), Isis::IException::Programmer, setColumn(), Isis::toString(), transpose(), vector(), and zeroMatrix().

◆ toMatrix() [1/5]

LinearAlgebra::Matrix Isis::LinearAlgebra::toMatrix ( const AxisAngle & axisAngle)
static

Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.

Parameters
axisAngleThe axis-angle pair representation of a rotation
Returns
LinearAlgebra::Matrix The matrix representation of the rotation.

References toMatrix().

Referenced by toMatrix(), and toMatrix().

◆ toMatrix() [2/5]

LinearAlgebra::Matrix Isis::LinearAlgebra::toMatrix ( const EulerAngle & angle3,
const EulerAngle & angle2,
const EulerAngle & angle1 )
static

Converts a rotation's representation from a set of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.

Parameters
angle3The third angle and its axis.
angle2The second angle and its axis.
angle1The first angle and its axis.
Returns
LinearAlgebra::Matrix The matrix representation of the rotation.
Exceptions
IException::Programmer"Unable to convert the given Euler angles to a matrix using the given axis codes. Axis codes must be 1, 2, or 3."

References _FILEINFO_, Isis::IException::Programmer, Isis::toString(), and vector().

◆ toMatrix() [3/5]

LinearAlgebra::Matrix Isis::LinearAlgebra::toMatrix ( const QList< EulerAngle > & eulerAngles)
static

Converts a rotation's representation from a list of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.

Parameters
eulerAnglesThe Euler angle representation of a rotation.
Returns
LinearAlgebra::Matrix The matrix representation of the rotation.
Exceptions
IException::Programmer"Unable to convert the given Euler angles to a matrix. Exactly 3 Euler angles are required."

References _FILEINFO_, Isis::IException::Programmer, toMatrix(), and Isis::toString().

◆ toMatrix() [4/5]

LinearAlgebra::Matrix Isis::LinearAlgebra::toMatrix ( const Vector & axis,
Angle angle )
static

Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.

Parameters
axisThe axis of rotation for a rotation.
angleThe rotation angle.
Returns
LinearAlgebra::Matrix The matrix representing the rotation.
Exceptions
IException::Programmer"Unable to convert the given vector and angle to a rotation matrix. The given vector is not a 3D axis vector."

References _FILEINFO_, column(), identity(), Isis::IException::Programmer, rotate(), setColumn(), Isis::toString(), and vector().

◆ toMatrix() [5/5]

LinearAlgebra::Matrix Isis::LinearAlgebra::toMatrix ( const Vector & quaternion)
static

Converts a rotation's representation from a quaternion to a 3x3 matrix.

Note, if the given vector is not a unit vector or the zero vector, this method will normalize it before computing the corresponding matrix.

Parameters
quaternionA unit quaternion representation of a rotation.
Returns
LinearAlgebra::Matrix The matrix representation of the rotation.
Exceptions
IException::Programmer"Unable to convert the given vector to a rotation matrix. The given vector is not a quaternion."

References _FILEINFO_, isUnit(), isZero(), normalize(), Isis::IException::Programmer, Isis::toString(), and vector().

◆ toQuaternion()

LinearAlgebra::Vector Isis::LinearAlgebra::toQuaternion ( const Matrix & rotationMatrix)
static

Converts a rotation's representation from a matrix to a unit quaternion.

Parameters
rotationMatrixA matrix representing a rotation.
Returns
LinearAlgebra::Vector A unit quaternion representing the rotation.
Exceptions
IException::Programmer"Unable to convert the given matrix to a quaternion. A 3x3 matrix is required. @throw IException::Programmer "Unable to convert the given matrix to an axis of rotation and a rotation angle. The given matrix is not a rotation matrix."

References _FILEINFO_, isRotationMatrix(), isUnit(), normalize(), Isis::IException::Programmer, Isis::toString(), and vector().

Referenced by toAxisAngle().

◆ transpose()

LinearAlgebra::Matrix Isis::LinearAlgebra::transpose ( const Matrix & matrix)
static

Returns the transpose of the given matrix.

Parameters
matrixThe matrix to transpose.
Returns
LinearAlgebra::Matrix The transposed matrix.

Referenced by inverse(), isOrthogonal(), and toEulerAngles().

◆ vector() [1/2]

LinearAlgebra::Vector Isis::LinearAlgebra::vector ( double v0,
double v1,
double v2 )
static

◆ vector() [2/2]

LinearAlgebra::Vector Isis::LinearAlgebra::vector ( double v0,
double v1,
double v2,
double v3 )
static

Constructs a 4 dimensional vector with the given component values.

Parameters
v0The first component of the vector.
v1The second component of the vector.
v2The third component of the vector.
v3The fourth component of the vector.
Returns
LinearAlgebra::Vector A vector containing the given values.

References vector().

◆ zeroMatrix()

LinearAlgebra::Matrix Isis::LinearAlgebra::zeroMatrix ( int rows,
int columns )
static

Returns a matrix with given dimensions that is filled with zeroes.

Parameters
rowsThe number of rows in the returned matrix.
columnsThe number of colums in the returned matrix.
Returns
LinearAlgebra::Matrix A zero-filled matrix.

References vector().

Referenced by Isis::RosettaOsirisCamera::initDistortion(), Isis::RosettaOsirisCameraDistortionMap::RosettaOsirisCameraDistortionMap(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().

◆ zeroVector()

LinearAlgebra::Vector Isis::LinearAlgebra::zeroVector ( int size)
static

Returns a vector of given length that is filled with zeroes.

Parameters
sizeSize of the vector.
Returns
LinearAlgebra::Vector A zero-filled vector.

References vector().

Referenced by Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().


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