 Package

org.taffy.core.maths
 Object Hierarchy
 What is it?

A Matrix is a representation of a mathematical matrix. It supports all Taffy mathematical operators.
 Quick Example
matrix = 1, 2 3, 4
Table of Contents:
Constructing a Matrix
A Matrix that is n rows by m columns is constructed like so:
matrix1 = 1, 2 ; 3, 4
we can separate rows with an endline instead of a semicolon:
matrix2 = 1, 2 3, 4 matrix1 == matrix2 ==> true
Arithmetic
The Matrix class supports many Taffy mathematical operators. Some operators support both Matrix and nonMatrix rightsides, while some operators, such as divide (/) support only nonMatrix rightsides.
// we can add numbers, or matrices of the same size matrix1 = 1, 2, 3 ; 4, 5, 6 matrix1 + 1 ==> 2, 3, 4 ; 5, 6, 7 matrix2 = 1, 2, 3 ; 4, 5, 6 matrix1 + matrix2 ==> 0, 0, 0 ; 0, 0, 0
Setting and Getting
We use the [] operator to get values from a Matrix, and the []= operator to set values. The [] operator takes two arguments: {row, column}:
matrix = 1, 2, 3 ; 4, 5, 6 matrix[0, 0] ==> 1 matrix[0, 1] ==> 2 matrix[1, 2] ==> 6
For matrixes with one row, the [] and []= operators take a single value: {column},
but they also accept the standard twoargument syntax:
matrix = "one", "two", "three" matrix[0] ==> "one" matrix[1] = "four" ==> "one", "four", "three"
Vectorization
The vectorize: method takes one argument, a Function to apply to each element in the Matrix:
f(x) = x^3 a = 1, 2, 3 a vectorize: f ==> 1, 8, 27
Supported Arithmetic
MatrixonMatrix Operators
+ (add)
 (subtract)
* (multiply)
~= (deltaequal)
MatrixonnonMatrix Operators
+ (add)
* (multiply)
+= (addequals)
 (subtract)
= (subtractequals)
/ (divide)
/= (divideequals)
* (multiply)
*= (multiplyequals)
^ (raise)
^= (raiseequals)
% (modulus)
Operators Requiring Whole Left and Right Values (MatrixonnonMatrix)
// operators requiring whole left and right values
<< (leftshift)
<<= (leftshiftself)
>> (rightshift)
>>= (rightshiftself)
 (bitor)
= (bitorself)
& (bitand)
&= (bitandself)
^^ (bitxor)
^^= (bitxorself)
Standalone Operators
++ (addonetoself)
 (subtractselfbyone)
! (factorial)