isMatrix method

bool isMatrix({
  1. dynamic throwIfIsNot = true,
})

Implementation

bool isMatrix({throwIfIsNot = true}) {
  // check if all the columns has the same length
  var columns = this[0].length;
  for (var c in this) {
    if (c.length != columns) {
      if (throwIfIsNot) {
        throw FormatException(
            'Array2d is not a matrix. All the rows of the Array2d must have the same length of columns.');
      } else {}
      return false;
    }
  }
  return true;
}