/// Checks whether `$matrix` is `$side` triangular with `$flag` options
/// @access private
/// @group checkers
/// @param {Matrix} $matrix - matrix
/// @param {String} $side (top) - side either `top` or `bottom`
/// @param {String | Null} $flag (null) - advanced option, either `null` or `strict` or `unit` or `atom`
/// @return {Bool}
/// @require {function} rows
/// @require {function} columns
/// @require {function} get-entry
@function _is-triangular($matrix, $side: top, $flag: null) {
  @for $i from 1 through rows($matrix) {
    @for $j from 1 through columns($matrix) {
      $entry: get-entry($matrix, ($i $j));
      @if $i > $j {
        @if $side == top and $entry != 0 { @return false; }
      }
      @else if $i < $j {
        @if $side == bottom and $entry != 0 { @return false; }
      }
      @else {
        @if $flag == strict and $entry != 0 { @return false; }
        @if $flag == unit and $entry != 1 { @return false; }
      }
    }
  }
  @return true;
}
