Libraries.Compute.MatrixTransform.Reshape Documentation

This is a MatrixTransform class to reshape the size of a Matrix and fill empty values. Attribute Returns A new matrix after the operation is performed. Attribute Parameter offsetRow The row offset for the first element in the new matrix. Attribute Parameter offsetColumn The column offset for the first element in the new matrix. Attribute Parameter rows The number of rows to extract. Attribute Parameter columns The number of columns to extract. Attribute Parameter fillValue The value to fill in any undefined cells in the new matrix. Attribute Returns A new matrix after the operation is performed.

Example Code

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Matrix matrix
        matrix:Fill(4, 4, 0.0)
        matrix:SetColumn(0, 1.1)
        matrix:SetColumn(1, 2.1)
        matrix:SetColumn(2, 3.1)
        matrix:SetColumn(3, 4.1)
        Reshape reshape
        reshape:SetValues(1, 1, 6, 6, 0.0)
        Matrix result = reshape:Transform(matrix)
        output result:ToText()
    end
end

Inherits from: Libraries.Language.Object, Libraries.Compute.MatrixTransform.MatrixTransform

Actions Documentation

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)

GetColumns()

This method get the number of columns for the matrix transform. Attribute Returns The number of columns to extract.

Return

integer:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetColumns(6)
        output reshape:GetColumns()
    end
end

GetFillValue()

This method returns the FillValue of the matrix transform. Attribute Returns The FillValue of the matrix transform.

Return

number:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetFillValue(0.0)
        output reshape:GetFillValue()
    end
end

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

GetOffsetColumn()

This method gets the offsetColumn for the matrix transform. Attribute Returns The column offset for the first element in the new matrix.

Return

integer:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetOffsetColumn(1)
        output reshape:GetOffsetColumn()
    end
end

GetOffsetRow()

This method gets the offsetRow for the matrix transform. Attribute Returns The row offset for the first element in the new matrix.

Return

integer:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetOffsetRow(1)
        output reshape:GetOffsetRow()
    end
end

GetRows()

This method gets the number of rows for the matrix transform. Attribute Returns The number of rows to extract.

Return

integer:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetRows(6)
        output reshape:GetRows()
    end
end

SetColumns(integer columns)

This method sets the columns for the matrix transform. Attribute Parameter columns The number of columns to extract.

Parameters

  • integer columns

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetColumns(6)
        output reshape:GetColumns()
    end
end

SetFillValue(number fillValue)

This method sets the FillValue of the matrix transform. Attribute Parameter The FillValue of the matrix transform.

Parameters

  • number fillValue

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetFillValue(0.0)
        output reshape:GetFillValue()
    end
end

SetOffsetColumn(integer offsetColumn)

This method sets the offsetColumn for the matrix transform. Attribute Parameter offsetColumn The column offset for the first element in the new matrix.

Parameters

  • integer offsetColumn

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetOffsetColumn(1)
        output reshape:GetOffsetColumn()
    end
end

SetOffsetRow(integer offsetRow)

This method sets the offsetRow for the matrix transform. Attribute Parameter offsetRow The row offset for the first element in the new matrix.

Parameters

  • integer offsetRow

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetOffsetRow(1)
        output reshape:GetOffsetRow()
    end
end

SetRows(integer rows)

This method sets the rows for the matrix transform. Attribute Parameter rows The number of rows to extract.

Parameters

  • integer rows

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetRows(6)
        output reshape:GetRows()
    end
end

SetValues(integer offsetRow, integer offsetColumn, integer rows, integer columns, number fillValue)

This method sets all the value parameters for the matrix transform. Attribute Parameter offsetRow The row offset for the first element in the new matrix. Attribute Parameter offsetColumn The column offset for the first element in the new matrix. Attribute Parameter rows The number of rows to extract. Attribute Parameter columns The number of columns to extract. Attribute Parameter fillValue The value to fill in any undefined cells in the new matrix.

Parameters

  • integer offsetRow
  • integer offsetColumn
  • integer rows
  • integer columns
  • number fillValue

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Reshape reshape
        reshape:SetValues(1, 1, 6, 6, 0.0)
    end
end

Transform(Libraries.Compute.Matrix matrix)

This method applies the transform to the Matrix. Attribute Parameter The matrix to transform. Attribute Returns A new matrix after the operation is performed.

Parameters

Return

Libraries.Compute.Matrix:

Example

use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.Reshape

class Main 
    action Main
        Matrix matrix
        matrix:Fill(4, 4, 0.0)
        matrix:SetColumn(0, 1.1)
        matrix:SetColumn(1, 2.1)
        matrix:SetColumn(2, 3.1)
        matrix:SetColumn(3, 4.1)
        Reshape reshape
        reshape:SetValues(1, 1, 6, 6, 0.0)
        Matrix result = reshape:Transform(matrix)
        output result:ToText()
    end
end