SubtractScalar
Package: Libraries.Compute.MatrixTransform · Inherits from: Libraries.Language.Object, Libraries.Compute.MatrixTransform.MatrixTransform
This is a Matrix Transform class to subtract a value from every element of a Matrix. Attribute Returns A new matrix after the operation is performed.
Example Code
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
matrix:Fill(3, 3, 15.0)
SubtractScalar scalar
scalar:SetValue(matrix, 10.0)
Matrix total = scalar:Transform(matrix)
output total:ToText()
end
end
Actions
GetValue()
This method gets the value that the transform function will apply. Attribute Parameter The value to apply in the transform.
Returns
number
Example
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
SubtractScalar scalar
scalar:SetValue(matrix, 10.0)
output scalar:GetValue()
end
end
GetValueMatrix()
This method gets the matrix of values that the transform function will apply. Attribute Parameter The value to apply in the transform.
Returns
Example
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
matrix:Fill(3, 3, 5.0)
SubtractScalar scalar
scalar:SetValue(matrix)
output scalar:GetValueMatrix():ToText()
end
end
SetValue(Libraries.Compute.Matrix matrix)
This method sets the a matrix of values for the transform function to apply. Attribute Parameter The value to apply in the transform.
Parameters
matrixLibraries.Compute.Matrix
Example
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
matrix:Fill(3, 3, 15.0)
SubtractScalar scalar
scalar:SetValue(matrix)
Matrix total = scalar:Transform(matrix)
output total:ToText()
end
end
SetValue(Libraries.Compute.Matrix matrix, number value)
This method sets the value for the transform function to apply. Attribute Parameter The value to apply in the transform.
Parameters
matrixLibraries.Compute.Matrixvaluenumber
Example
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
matrix:Fill(3, 3, 15.0)
SubtractScalar scalar
scalar:SetValue(matrix, 10.0)
Matrix total = scalar:Transform(matrix)
output total:ToText()
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
matrixLibraries.Compute.Matrix
Returns
Example
use Libraries.Compute.Matrix
use Libraries.Compute.MatrixTransform.SubtractScalar
class Main
action Main
Matrix matrix
matrix:Fill(3, 3, 15.0)
SubtractScalar scalar
scalar:SetValue(matrix, 10.0)
Matrix total = scalar:Transform(matrix)
output total:ToText()
end
end