isUpperTriangular property

bool isUpperTriangular

Tests if this Matrix is a upper triangular matrix, with non-zero values only in the upper-triangle of the matrix.

Implementation

bool get isUpperTriangular {
  final isEqual = dataType.equality.isEqual;
  final additiveIdentity = dataType.field.additiveIdentity;
  for (var r = 1; r < rowCount; r++) {
    for (var c = 0; c < colCount && c < r; c++) {
      if (!isEqual(getUnchecked(r, c), additiveIdentity)) {
        return false;
      }
    }
  }
  return true;
}