StaticMatrix<T>.fromList constructor

StaticMatrix<T>.fromList(
  1. List<List<T>> matrix
)

Create a StaticMatrix from List

Implementation

factory StaticMatrix.fromList(List<List<T>> matrix) {
  // Verify that matrix is correct
  int height = matrix.length;
  if (height == 0) throw Exception("Invalid data matrix");
  int width = matrix[0].length;
  for (var row in matrix) {
    if (row.length != width) throw Exception("Invalid data matrix");
  }

  return StaticMatrix._allParameters(
      height: height, width: width, data: matrix);
}