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

Summary

Actions Summary Table

ActionsDescription
Calculate(Libraries.Compute.Matrix matrix)This action does the decomposition and stores the matrices as state inside of this class.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetHashCode()This action gets the hash code for an object.
GetOrthonormalMatrix()This action gets the orthonormal matrix.
GetOrthonormalTransposedMatrix()This action gets the orthonormal matrix.
GetResult()
GetUpperTriangularMatrix()This action returns the upper triangular matrix.
Solve(Libraries.Compute.Vector vector)

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.

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()

Parameters

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.

Example Code

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

Parameters

Return

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

Equals(Libraries.Language.Object object)

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

Example Code

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

Parameters

Return

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

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetOrthonormalMatrix()

This action gets the orthonormal matrix.

Return

Libraries.Compute.Matrix:

GetOrthonormalTransposedMatrix()

This action gets the orthonormal matrix.

Return

Libraries.Compute.Matrix:

GetResult()

Return

Libraries.Compute.Matrix

GetUpperTriangularMatrix()

This action returns the upper triangular matrix.

Return

Libraries.Compute.Matrix:

Solve(Libraries.Compute.Vector vector)

Parameters

Return

Libraries.Compute.Vector