matrixMultiply method Null safety

List<double> matrixMultiply(
  1. List<double> row,
  2. List<List<double>> matrix
)

Multiplies a 1x3 row vector with a 3x3 matrix.

Implementation

static List<double> matrixMultiply(
    List<double> row, List<List<double>> matrix) {
  final a =
      row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
  final b =
      row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];
  final c =
      row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
  return [a, b, c];
}