Libraries.Compute.MatrixTransform.LowerUpperDecomposition Documentation

This class calculates a matrix into two matrices. The first, lower, is a lower triangular matrix, which means all elements above the diagonal are zero. In the lower matrix, the diagonals are all 1s. The second matrix, Upper, has all of its lower elements as 0 and the diagonal is not guaranteed to have 1s. This type of decomposition is sometimes called, "LUDecomposition." Ultimately, this type of class is a numerical support class, where the decomposition can be used to conduct other kinds of mathematical computations. This class was adapted from the LUDecomposition class in Apache Commons. More information can be found about this kind of decomposition on wikipedia or other sources: Lower Upper Decomposition.

Example Code

: 

    use Libraries.Compute.Matrix
    use Libraries.Compute.MatrixTransform.LowerUpperDecomposition

    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)

    LowerUpperDecomposition 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.
GetInverse()This action calls solve using the identity matrix as a parameter, with the size given by the Pivot.
Solve(Libraries.Compute.Matrix matrix)This action solves the decomposition for a particular Matrix named matrix.

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 results, we call GetLowerTriangular or GetUpperTriangular. In order to obtain a solution to a problem for a particular matrix once we have decomposition, we must call Solve.

Example Code

: 
    
        use Libraries.Compute.Matrix
        use Libraries.Compute.MatrixTransform. LowerUpperDecomposition
    
        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)
    
        LowerUpperDecompositiondecomp
        decomp:Calculate(matrix)
    
        Matrix value = decomp: GetLowerTriangular ()
        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.

GetInverse()

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

Return

Libraries.Compute.Matrix:

Solve(Libraries.Compute.Matrix matrix)

This action solves the decomposition for a particular Matrix named matrix.

Example Code

: 
    
        use Libraries.Compute.Matrix
        use Libraries.Compute.MatrixTransform. LowerUpperDecomposition
    
        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)
    
        LowerUpperDecompositiondecomp
        decomp:Calculate(matrix)
    
        //Calls Solve for the pivot generated by the decomposition
        Matrix value = decomp:GetInverse()
        output value:ToText()

Parameters

Return

Libraries.Compute.Matrix: