matMul method

Vector3 matMul(
  1. Array matrix
)

Implementation

Vector3 matMul(Array matrix) {
  var fullMatrix = Array.identity(3);

  // get a 3x3 matrix from a 2x2 matrix
  fullMatrix = fullMatrix.map((identityValue, pos) =>
      (pos.item1 >= matrix.shape.item1) || (pos.item2 >= matrix.shape.item2)
          ? identityValue
          : matrix.getValue(pos));

  var columnVector = toArray();
  var result = fullMatrix.matMul(columnVector);
  return Vector3.fromArray(result);
}