Open 3D Engine PhysX Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
NumericalMethods::Eigenanalysis Namespace Reference

Classes

struct  Eigenpair
 
struct  SolverResult
 
class  SquareMatrix
 

Typedefs

using Real = double
 Real scalar type used by requests within this interface.
 
using Complex = std::complex< double >
 Complex scalar type used by requests within this interface.
 

Enumerations

enum class  SolverOutcome { Invalid , Success , Failure , FailureInvalidInput }
 

Functions

SolverResult< Real, 3 > Solver3x3RealSymmetric (const SquareMatrix< Real, 3 > &matrix)
 
SolverResult< Real, 3 > NonIterativeSymmetricEigensolver3x3 (double a00, double a01, double a02, double a11, double a12, double a22)
 
VectorVariable CrossProduct (const VectorVariable &lhs, const VectorVariable &rhs)
 
void ComputeOrthogonalComplement (const VectorVariable &vecW, VectorVariable &vecU, VectorVariable &vecV)
 
VectorVariable ComputeEigenvector0 (double a00, double a01, double a02, double a11, double a12, double a22, double val)
 
VectorVariable ComputeEigenvector1 (double a00, double a01, double a02, double a11, double a12, double a22, double val, const VectorVariable &vec)
 
VectorVariable ComputeEigenvector2 (const VectorVariable &vec0, const VectorVariable &vec1)
 

Detailed Description

Namespace for methods for finding eigenvalues and unit-length eigenvectors of matrices. The 3x3 symmetric eigensolver algorithm was adapted from A Robust Eigensolver for 3x3 Symmetric Matrices by Eberly.

Enumeration Type Documentation

◆ SolverOutcome

Used when returning the solver result to indicate if the solver was successful or to indicate failure reasons.

Enumerator
Invalid 

Default value to which fields of this type should be initialized.

Success 

The solver successfully found the eigenvalues and vectors.

Failure 

The solver failed for unspecified reasons.

FailureInvalidInput 

The solver failed because the input matrix was not valid.

Function Documentation

◆ ComputeEigenvector0()

VectorVariable NumericalMethods::Eigenanalysis::ComputeEigenvector0 ( double  a00,
double  a01,
double  a02,
double  a11,
double  a12,
double  a22,
double  val 
)

Given elements of a symmetric 3x3 matrix and one of its eigenvalues, computes the corresponding eigenvector. For numerical stability, this function should only be used to find the eigenvector corresponding to eigenvalues that are unique and numerically not close to other eigenvalues.

Parameters
a<ij>The element of the matrix in row i, column j.
valOne of the eigenvalues of the matrix.
Returns
The corresponding eigenvector.

◆ ComputeEigenvector1()

VectorVariable NumericalMethods::Eigenanalysis::ComputeEigenvector1 ( double  a00,
double  a01,
double  a02,
double  a11,
double  a12,
double  a22,
double  val,
const VectorVariable vec 
)

Given elements of a symmetric 3x3 matrix, one of its eigenvalues and an unrelated eigenvector, computes the eigenvector corresponding to the eigenvalue. This algorithm is numerically stable even if the eigenvalue is repeated.

Parameters
a<ij>The element of the matrix in row i, column j.
valThe eigenvalue whose corresponding eigenvector is to be found.
vecThe unrelated eigenvector that is already known.
Returns
The eigenvector corresponding to the given eigenvalue.

◆ ComputeEigenvector2()

VectorVariable NumericalMethods::Eigenanalysis::ComputeEigenvector2 ( const VectorVariable vec0,
const VectorVariable vec1 
)
Parameters
vec0The first of the already known eigenvectors.
vec1The second of the already known eigenvectors.
Returns
The computed eigenvector.

◆ ComputeOrthogonalComplement()

void NumericalMethods::Eigenanalysis::ComputeOrthogonalComplement ( const VectorVariable vecW,
VectorVariable vecU,
VectorVariable vecV 
)

Robustly computes a right-handed orthonormal basis containing a given unit-length 3D input vector.

Parameters
vecW[in]A 3D input vector which must be of unit length.
vecU[out]The first of the computed unit-length orthogonal vectors.
vecV[out]The second of the computed unit-length orthogonal vectors.
Returns
{vecU, vecV, vecW} will be a right-handed orthogonal set.

◆ CrossProduct()

VectorVariable NumericalMethods::Eigenanalysis::CrossProduct ( const VectorVariable lhs,
const VectorVariable rhs 
)

Compute the cross product between two 3D vectors.

Parameters
lhsThe left-hand side vector.
rhsThe right-hand side vector.
Returns
The 3D vector equal to the cross product if both input vectors are 3-dimensional.

◆ NonIterativeSymmetricEigensolver3x3()

SolverResult< Real, 3 > NumericalMethods::Eigenanalysis::NonIterativeSymmetricEigensolver3x3 ( double  a00,
double  a01,
double  a02,
double  a11,
double  a12,
double  a22 
)

Finds the eigenvalues and vectors of the symmetric matrix whose unique elements are given (see Eberly).

Parameters
a<ij>The element of the matrix in row i, column j.
Returns
Orthonormal eigenbasis of the matrix and the corresponding eigenvalues.

◆ Solver3x3RealSymmetric()

SolverResult< Real, 3 > NumericalMethods::Eigenanalysis::Solver3x3RealSymmetric ( const SquareMatrix< Real, 3 > &  matrix)

Compute the eigenvalues and a corresponding eigenbasis for a real symmetric 3x3 matrix. The eigenvalues in this case are guaranteed to be real and the eigenbasis returned is guaranteed to be right-handed and orthonormal (within numerical precision).

Parameters
matrixThe input matrix which must be real and symmetric.
Returns
An instance of SolverResult. The SolverResult::m_outcome will be set to SolverOutcome::FailureInvalidInput if the given matrix is not real and symmetric. Otherwise, SolverResult::m_eigenpairs will contain an orthonormal basis.