Matrix: type: custom debug: false values: li@ tags: value: # Usage: # Returns the value of the Matrix in the position specified. - define row "" - define column "" - determine "].split_by[,].get[]>" rows: # Returns the number of rows in the Matrix. - determine "" columns: # Returns the number of columns in the Matrix. - determine "" row: # Usage: # Returns the values contained in the specified row, in a li@a|b|c format. - determine "].split_by[,]||li@>" column: # Usage: # Returns the values contained in the specified column, in a li@a|b|c format. - define column li@ - foreach "": - define row "" - define column "]>]>" - determine "" add: # Usage: # Adds two matrices by adding the corresponding entries together. - define matrix "" - repeat "": - define row "" - repeat "": - define column "" - define value "|]>" - define value "|]>]>" - adjust ">" "value:||" "save:m" - determine "" scale: # Usage: # Returns the product of a matrix and a scalar value. - define scalar "" - repeat "": - define row "" - repeat "": - define column "" - define value "|].mul[]>" - adjust ">" "value:||" "save:m" - determine "" mul: # Usage: # Returns the product of two matrices with entries in a field. # The number of columns of the first matrix must be equal # to the number of rows of the second one. - define matrix "" - define aux li@ - repeat "": - define row "" - repeat "": - define column "" - define r "0" - foreach "]>": - define i "" - define r "].get[]>]>]>" #- adjust ">" "value:||" "save:m" - define aux "]>]:||,>" - define aux "" - adjust "" "values:" "save:m" - determine "" power: # Usage: # Returns the product of a matrix power. - define power "" - define matrix "" - repeat "": - define matrix "]>" - determine "" mechanisms: value: # Adjusts the value in a certain position of a matrix. # Usage: adjust value:%row%|%column%|%value% - define row "" - define column "" - define value "" - define newRow "]>" - define newRow "].at[].separated_by[,]>" - define values "].at[]>" - adjust "" "values:" "save:matrix" - determine "" MatrixTest: type: command debug: false usage: /matrix description: See what can the script do in a test matrix! name: matrix script: - define matrix "custom@matrix[values=li@0.6,2.4,0.5|0.5,0,0|0,0.6,0]" - narrate "" # - define matrix "custom@matrix[values=li@1,2,3|4,5,6]" # - announce "" # # Narrates "2". # - announce "" # # Narrates "3". # - announce "" # # Narrates "li@1,2,3|4,5,6" # - announce "" # # Narrates "6". # - define matrixB "custom@matrix[values=li@4,5,6|7,8,9]" # - announce "]>" # # Narrates "custom@MATRIX[values=li@5,7,9|11,13,15]" # - announce "" # # Narrates "custom@MATRIX[values=li@3,6,9|12,15,18]" # - define matrixC "custom@matrix[values=li@1,2,3|4,5,6|7,8,9]" # - announce "]>" # # Narrates "custom@MATRIX[values=li@30,36,42|66,81,96]" # - announce "" # # Narrates "custom@MATRIX[values=li@30,36,42|66,81,96|102|126|150]" #