Libraries.Compute.MatrixTransform.OrthonormalTriangularDecomposition Documentation

This class calculates an orthonormal matrix and an upper triangular matrix from a given matrix. Classically, this is called a "QR" decomposition, which is referencing the orthonormal (Q) and the upper triangular (R). There are multiple ways to conduct this decomposition and this class uses Householder reflectors, which is a numerically stable way to conduct the calculation. This class is a port from the Apache Commons Linear algebra library, which itself is adapted from the JAMA library. In our class, we changed the names and way the programmer interacts with the class, but the primary calculations are very similar. More information on QR decomposition can be found at MathWorld or Wikipedia.

Example Code

: 

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.OrthonormalTriangularDecomposition

Matrix matrix
matrix:SetSize(3,3)
matrix:Set(0,0,12.0)
matrix:Set(1,0,6)
matrix:Set(2,0,-4)

matrix:Set(0,1,-51)
matrix:Set(1,1,167)
matrix:Set(2,1,24)

matrix:Set(0,2,4)
matrix:Set(1,2,-68)
matrix:Set(2,2,-41)

OrthonormalTriangularDecomposition decomp
decomp:Calculate(matrix)

Matrix value = decomp:GetResult()
output value:ToText()

Inherits from: Libraries.Language.Object

Actions Documentation

Calculate(Libraries.Compute.Matrix matrix)

This action does the decomposition and stores the matrices as state inside of this class. Thus, the matrices can then be copied, stored, or used as desired. To obtain the orthonormal matrix (Q), we call GetOrthonormalMatrix, and to get the upper triangular matrix (R), we call GetUpperTriangularMatrix.

Parameters

Example

: 

    use Libraries.Compute.Matrix
    use Libraries.Compute.MatrixTransform.OrthonormalTriangularDecomposition

    Matrix matrix
    matrix:SetSize(3,3)
    matrix:Set(0,0,12.0)
    matrix:Set(1,0,6)
    matrix:Set(2,0,-4)

    matrix:Set(0,1,-51)
    matrix:Set(1,1,167)
    matrix:Set(2,1,24)

    matrix:Set(0,2,4)
    matrix:Set(1,2,-68)
    matrix:Set(2,2,-41)

    OrthonormalTriangularDecomposition decomp
    decomp:Calculate(matrix)

    Matrix value = decomp:GetResult()
    output value:ToText()

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetInverse()

This action calls solve using the identity matrix as a parameter, with the size given by the transpose.

Return

Libraries.Compute.Matrix:

GetOrthonormalMatrix()

This action gets the orthonormal matrix.

Return

Libraries.Compute.Matrix:

GetOrthonormalTransposedMatrix()

This action gets the orthonormal matrix.

Return

Libraries.Compute.Matrix:

GetResult()

This action gets the orthonormal matrix.

Return

Libraries.Compute.Matrix:

GetUpperTriangularMatrix()

This action returns the upper triangular matrix.

Return

Libraries.Compute.Matrix:

Solve(Libraries.Compute.Vector vector)

fill it with zeroes

Parameters

Return

Libraries.Compute.Vector:

Solve(Libraries.Compute.Matrix matrix)

apply Householder transforms to solve Q.y = b

Parameters

Return

Libraries.Compute.Matrix: