Isis 3 Programmer Reference
|
This class holds all static methods to perform linear algebra operations on vectors and matrices. More...
#include <LinearAlgebra.h>
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, Angle > | AxisAngle |
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< EulerAngle > | toEulerAngles (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. | |
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
2013-06-01 Jeannie Backer - Original version.
2013-08-07 Kimberly Oyama - Updated documentation.
2016-07-25 Jeannie Backer - Updated documentation and test.
2016-08-05 Jeannie Backer - Replace std abs() function with qAbs() from QtGlobal.
2016-08-16 Jesse Mapel - Added BOOST_UBLAS_NO_STD_CERR definition to prevent Boost from outputing debug information to standard out when throwing exceptions. Fixes #2302.
2017-12-12 Jeannie Backer - Added SymmetricMatrix typedef.
2021-02-17 Jesse Mapel - Added pseudoinverse method.
document methods (a) add naif routine names to documentation where appropriate, (b) clean up comments within methods, (3) use naif documentation where appropriate
add links to naif documentation web pages???
add proper scopes
implement norm2 (L2 norm)?
implement trace?
common validate errors - vector size match, 3x3 matrix, 3D vector
what is more expensive - unitize vector and compare to 1 or isOrthogonal?
rename local variables m2q and q2m
implement qdq2av (Quaternion and quaternion derivative to angular velocity)?
implement qxq (Quaternion times quaternion)?
implement qderiv (Quadratic derivative)?
When converting quaternion, axis-angle, Euler angle to rot matrix, should we verify that the matrix is valid (is a rotation matrix)???
isQuaternion???
should we throw error in q2m if q = 0???
q2m - why check if sharpen when q is not unit if it is required to be a unit? throw an error?
axisar - throw error if axis is origin? If we rotate about about origin, then we get a zero matrix - not a rotation... except maybe trivially... (or do we get identity??? indicating no rotation)
double check all indexing on code copied from NAIF - indices should reverse col/row order and subtract 1
Definition at line 91 of file LinearAlgebra.h.
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.
Definition at line 151 of file LinearAlgebra.h.
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).
Definition at line 158 of file LinearAlgebra.h.
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.
Definition at line 102 of file LinearAlgebra.h.
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.
Definition at line 122 of file LinearAlgebra.h.
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.
Definition at line 112 of file LinearAlgebra.h.
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.
Definition at line 132 of file LinearAlgebra.h.
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.
Definition at line 142 of file LinearAlgebra.h.
|
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.
Definition at line 39 of file LinearAlgebra.cpp.
|
protected |
Destructor for a LinearAlgebra object.
Definition at line 46 of file LinearAlgebra.cpp.
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 \} \)
vector | The vector whose absolute maximum will be returned. |
Definition at line 531 of file LinearAlgebra.cpp.
Referenced by magnitude(), normalizedCrossProduct(), and perpendicular().
|
static |
Adds the two given vectors.
vector1 | The first vector. |
vector2 | The second vector. |
IException::Programmer | "Unable to add vectors with mismatched sizes." |
Definition at line 634 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Returns a vector whose components match those of the given matrix column.
matrix | The matrix to pull values from. |
columnIndex | The index of the matrix column to grab. |
IException::Programmer | "Unable to get the matrix column to the given vector. Column index is out of bounds." |
Definition at line 1693 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().
|
static |
Returns the cross product of two vectors.
Note: the cross-product requires the vectors to have exactly three components each.
vector1 | The vector to the left of the cross product operator. |
vector2 | The vector to the right of the cross product operator. |
IException::Programmer | "Unable to calculate the cross product on vectors that are not size 3. " |
Definition at line 688 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by normalizedCrossProduct(), and rotate().
Returns the determinant of the given 3x3 matrix.
LinearAlgebra::Matrix | The 3x3 matrix whose determinant will be calculated. |
IException::Programmer | "Unable to calculate the determinant for the given matrix. This method only calculates the determinant for 2x2 or 3x3 matrices." |
Definition at line 440 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
Referenced by inverse(), and isRotationMatrix().
Computes the dot product of the given vectors.
For Euclidean space, this is the same as the inner product, so these methods are interchangeable.
vector1 | The first vector. |
vector2 | The second vector. |
Definition at line 781 of file LinearAlgebra.cpp.
References innerProduct().
Referenced by isUnit(), project(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().
|
static |
Returns the identity matrix of size NxN.
int | The size of the square matrix. |
IException::Programmer | "Can not create identity matrix of negative size." |
Definition at line 384 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by inverse(), and toMatrix().
Computes the inner product of the given vectors.
For Euclidean space, this is the same as the dot product, so these methods are interchangeable.
vector1 | The first vector. |
vector2 | The second vector. |
IException::Programmer | "Unable to compute the dot product for vectors with mismatched sizes." |
Definition at line 801 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
Referenced by dotProduct().
|
static |
Returns the inverse of a 2x2 or 3x3 matrix.
Throws an error if the given matrix is not invertible.
matrix | The matrix to inverse. |
IException::Programmer | "The given matrix is not invertible. The determinant is 0.0." |
IException::Programmer | "Unable to invert the given matrix." |
Definition at line 282 of file LinearAlgebra.cpp.
References determinant(), identity(), inverse(), isOrthogonal(), Isis::IException::Programmer, transpose(), and vector().
Referenced by inverse(), and pseudoinverse().
Determines whether the given vector is empty (i.e.
size 0).
vector | The vector to check. |
Definition at line 250 of file LinearAlgebra.cpp.
Determines whether the given matrix is the identity.
Non-square matrices always return false. A qfuzzycompare is used when checking the zeroes and ones.
matrix | The matrix to check. Automatically returns false if not square. |
Definition at line 61 of file LinearAlgebra.cpp.
References row(), and vector().
Referenced by isOrthogonal().
Determines whether the given matrix is orthogonal by verifying that the matrix and its tranpose are inverses.
matrix | The matrix to check. Automatically returns false if not square. |
Definition at line 89 of file LinearAlgebra.cpp.
References isIdentity(), multiply(), and transpose().
Referenced by inverse().
Determines whether the given matrix is a rotation matrix.
matrix | The matrix to check. Automatically returns false if not 2x2 or 3x3. |
IException::Programmer | "Unable to determine whether the given matrix is a rotation matrix." |
Definition at line 113 of file LinearAlgebra.cpp.
References column(), determinant(), magnitude(), Isis::IException::Programmer, setColumn(), and vector().
Referenced by toAxisAngle(), toEulerAngles(), and toQuaternion().
Determines whether the given vector is a unit vector.
vector | The vector to check. |
Definition at line 262 of file LinearAlgebra.cpp.
References dotProduct(), and vector().
Referenced by toMatrix(), and toQuaternion().
Determines whether the given matrix is filled with zereos.
vector | The matrix to check. |
Definition at line 211 of file LinearAlgebra.cpp.
References vector().
Referenced by magnitude(), normalize(), perpendicular(), project(), rotate(), toAxisAngle(), and toMatrix().
Determines whether the given vector is filled with zereos.
vector | The vector to check. |
Definition at line 231 of file LinearAlgebra.cpp.
References vector().
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.
vector | The vector whose magnitude will be computed. |
Definition at line 504 of file LinearAlgebra.cpp.
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(), Isis::EmbreeShapeModel::sortHits(), and toAxisAngle().
|
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).
matrix | The matrix to be multiplied. |
vector | The column vector to be multiplied on the right side of the matrix. |
IException::Programmer | "Unable to multiply matrix and vector with mismatched dimensions." |
Definition at line 580 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
|
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).
matrix1 | The left matrix. |
matrix2 | The right matrix. |
IException::Programmer | "Unable to multiply matrices with mismatched dimensions." |
Definition at line 549 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
Referenced by isOrthogonal(), Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().
|
static |
Multiplies the given scalar and matrix.
scalar | The scalar to be multiplied by each element of the matrix. |
matrix | The matrix to be scaled. |
Definition at line 617 of file LinearAlgebra.cpp.
|
static |
Multiplies the given scalar and vector.
scalar | The scalar to be multiplied by each component of the vector. |
vector | The vector to be scaled. |
Definition at line 603 of file LinearAlgebra.cpp.
References 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.
vector | The vector to be normalized. |
IException::Programmer | "Unable to normalize the zero vector." |
Definition at line 477 of file LinearAlgebra.cpp.
References isZero(), magnitude(), and Isis::IException::Unknown.
Referenced by Isis::EmbreeTargetShape::getHitInformation(), Isis::EmbreeShapeModel::intersectSurface(), Isis::EmbreeShapeModel::intersectSurface(), normalizedCrossProduct(), Isis::EmbreeShapeModel::pointToRay(), rotate(), toAxisAngle(), toEulerAngles(), toMatrix(), and toQuaternion().
|
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.
vector1 | The vector to the left of the cross product operator. |
vector2 | The vector to the right of the cross product operator. |
Definition at line 721 of file LinearAlgebra.cpp.
References absoluteMaximum(), crossProduct(), normalize(), and vector().
|
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.
vector1 | The vector to the left side of the outer product operator. |
vector2 | The vector to the right side of the outer product operator. |
IException::Programmer | "Unable to compute the outer product for vectors with mismatched sizes." |
Definition at line 757 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
|
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
vector1 | The first vector, denoted A in the description. |
vector2 | The second vector, denoted B in the description. |
Definition at line 932 of file LinearAlgebra.cpp.
References absoluteMaximum(), isZero(), project(), and vector().
|
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.
vector1 | The vector to the left of the project operator. |
vector2 | The vector to the right of the project operator. |
IException::Programmer | "Unable to project vector1 onto vector2 with mismatched sizes." |
Definition at line 833 of file LinearAlgebra.cpp.
References dotProduct(), isZero(), Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by perpendicular(), and rotate().
|
static |
Returns the pseudoinverse of a matrix.
matrix | The matrix to compute the pseudoinverse of. |
Definition at line 339 of file LinearAlgebra.cpp.
References inverse(), and vector().
Referenced by Isis::CSMCamera::ImagePartials().
|
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.
vector | The vector to rotate, which must have three components. |
axis | A vector defining the axis, which must also have three components. |
angle | The angle to rotate. |
IException::Programmer | "Unable to rotate vector about the given axis and angle. Vectors must be of size 3 to perform rotation. " |
Definition at line 872 of file LinearAlgebra.cpp.
References crossProduct(), isZero(), normalize(), Isis::IException::Programmer, project(), Isis::Angle::radians(), Isis::toString(), and vector().
Referenced by toMatrix().
|
static |
Returns a vector whose components match those of the given matrix row.
matrix | The matrix to pull values from. |
rowIndex | The index of the matrix row to grab. |
IException::Programmer | "Unable to get the matrix row to the given vector. Row index is out of bounds." |
Definition at line 1670 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, and Isis::toString().
Referenced by isIdentity().
|
static |
Sets the column of the given matrix to the values of the given vector.
matrix | The address of the matrix to be altered. |
vector | The vector with the new values. |
columnIndex | The index of the column to be altered. |
IException::Programmer | "Unable to set the matrix column to the given vector. Column index is out of bounds." |
Definition at line 1647 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by isRotationMatrix(), toEulerAngles(), and toMatrix().
Sets the row of the given matrix to the values of the given vector.
matrix | The address of the matrix to be altered. |
vector | The vector with the new values. |
rowIndex | The index of the row to be altered. |
IException::Programmer | "Unable to set the matrix row to the given vector. Row index is out of bounds." |
Definition at line 1626 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
Fills the first three elements of the given vector with the given values.
v | A pointer to a 3-dimensional vector to be filled. |
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
Definition at line 1752 of file LinearAlgebra.cpp.
Fills the first four elements of the given vector with the given values.
v | A pointer to a 4-dimensional vector to be filled. |
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
v3 | The fourth component of the vector. |
Definition at line 1768 of file LinearAlgebra.cpp.
References vector().
|
static |
Subtracts the right vector from the left vector.
vector1 | The vector to the left of the subtraction operator. |
vector2 | The vector to the right of the subtraction operator. |
IException::Programmer | "Unable to subtract vectors with mismatched sizes." |
Definition at line 660 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Constructs a vector of given size using the given vector and starting index.
v | The original vector to get values from. |
startIndex | The index of the original vector, used to indicate the first value that will be copied to the new vector. |
size | The number of elements from the original vector to copy to the new vector. |
Definition at line 1789 of file LinearAlgebra.cpp.
References vector().
|
static |
Converts a rotation's representation from a matrix to a axis of rotation and its corresponding rotation angle.
rotationMatrix | A matrix representing a rotation. |
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." |
Definition at line 973 of file LinearAlgebra.cpp.
References isRotationMatrix(), isZero(), magnitude(), normalize(), Isis::PI, Isis::IException::Programmer, Isis::Angle::setRadians(), toQuaternion(), Isis::toString(), and vector().
|
static |
Converts a rotation's representation from a matrix to a set of Euler angles with corresponding axes.
rotationMatrix | A matrix representing a rotation. |
axes | A list containing the order of axes. |
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." |
Definition at line 1051 of file LinearAlgebra.cpp.
References column(), isRotationMatrix(), multiply(), normalize(), Isis::IException::Programmer, setColumn(), Isis::toString(), transpose(), vector(), and zeroMatrix().
|
static |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
axisAngle | The axis-angle pair representation of a rotation |
Definition at line 1442 of file LinearAlgebra.cpp.
References toMatrix().
Referenced by toMatrix(), and toMatrix().
|
static |
Converts a rotation's representation from a set of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
angle3 | The third angle and its axis. |
angle2 | The second angle and its axis. |
angle1 | The first angle and its axis. |
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." |
Definition at line 1462 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Converts a rotation's representation from a list of Euler angles (3 angles, each with a corresponding axis) to a 3x3 matrix.
eulerAngles | The Euler angle representation of a rotation. |
IException::Programmer | "Unable to convert the given Euler angles to a matrix. Exactly 3 Euler angles are required." |
Definition at line 1545 of file LinearAlgebra.cpp.
References Isis::IException::Programmer, toMatrix(), and Isis::toString().
|
static |
Converts a rotation's representation from an axis of rotation and its corresponding rotation angle to a 3x3 matrix.
axis | The axis of rotation for a rotation. |
angle | The rotation angle. |
IException::Programmer | "Unable to convert the given vector and angle to a rotation matrix. The given vector is not a 3D axis vector." |
Definition at line 1405 of file LinearAlgebra.cpp.
References column(), identity(), Isis::IException::Programmer, rotate(), setColumn(), Isis::toString(), and vector().
|
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.
quaternion | A unit quaternion representation of a rotation. |
IException::Programmer | "Unable to convert the given vector to a rotation matrix. The given vector is not a quaternion." |
Definition at line 1572 of file LinearAlgebra.cpp.
References isUnit(), isZero(), normalize(), Isis::IException::Programmer, Isis::toString(), and vector().
|
static |
Converts a rotation's representation from a matrix to a unit quaternion.
rotationMatrix | A matrix representing a rotation. |
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." |
Definition at line 1211 of file LinearAlgebra.cpp.
References isRotationMatrix(), isUnit(), normalize(), Isis::IException::Programmer, Isis::toString(), and vector().
Referenced by toAxisAngle().
|
static |
Returns the transpose of the given matrix.
matrix | The matrix to transpose. |
Definition at line 369 of file LinearAlgebra.cpp.
Referenced by inverse(), isOrthogonal(), and toEulerAngles().
|
static |
Constructs a 3 dimensional vector with the given component values.
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
Definition at line 1714 of file LinearAlgebra.cpp.
References vector().
Referenced by add(), crossProduct(), identity(), Isis::EmbreeShapeModel::intersectSurface(), Isis::EmbreeShapeModel::intersectSurface(), inverse(), isIdentity(), isRotationMatrix(), isUnit(), Isis::EmbreeShapeModel::isVisibleFrom(), isZero(), isZero(), multiply(), normalizedCrossProduct(), perpendicular(), Isis::EmbreeShapeModel::pointToRay(), project(), pseudoinverse(), Isis::RayHitInformation::RayHitInformation(), rotate(), setColumn(), setRow(), setVec4(), subtract(), subVector(), toAxisAngle(), toEulerAngles(), toMatrix(), toMatrix(), toMatrix(), toQuaternion(), vector(), vector(), zeroMatrix(), and zeroVector().
|
static |
Constructs a 4 dimensional vector with the given component values.
v0 | The first component of the vector. |
v1 | The second component of the vector. |
v2 | The third component of the vector. |
v3 | The fourth component of the vector. |
Definition at line 1734 of file LinearAlgebra.cpp.
References vector().
|
static |
Returns a matrix with given dimensions that is filled with zeroes.
rows | The number of rows in the returned matrix. |
columns | The number of colums in the returned matrix. |
Definition at line 408 of file LinearAlgebra.cpp.
References vector().
Referenced by Isis::RosettaOsirisCamera::initDistortion(), Isis::RosettaOsirisCameraDistortionMap::RosettaOsirisCameraDistortionMap(), Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane(), and toEulerAngles().
|
static |
Returns a vector of given length that is filled with zeroes.
size | Size of the vector. |
Definition at line 421 of file LinearAlgebra.cpp.
References vector().
Referenced by Isis::RosettaOsirisCameraDistortionMap::SetFocalPlane(), and Isis::RosettaOsirisCameraDistortionMap::SetUndistortedFocalPlane().