Matrix.reshapeFromList constructor

Matrix.reshapeFromList(
  1. List<double> data, {
  2. required int n,
  3. required int m,
})

Implementation

Matrix.reshapeFromList(List<double> data,
    {required this.n, required this.m}) {
  if (data.length == n * m) {
    _base = List<List<double>>.generate(
        n, (index) => data.sublist(m * index, m * (index + 1)));
  } else {
    throw Exception('Dimension error: ${data.length} != $n*$m');
  }
}