Index reduce() {
    Index c = this;
    for (int ii = 0; ii < rank; ii++)
      if (shape[ii] == 1) {  // do this on the first one you find
        Index newc = c.reduce(ii);
        return newc.reduce();  // any more to do?
      }
    return c;
  }
Index reduce ( ) { Index c = this ; for ( int ii = 0 ; ii < rank ; ii ++ ) if ( shape [ ii ] == 1 ) { Index newc = c . reduce ( ii ) ; return newc . reduce ( ) ; } return c ; }
Create a new Index based on current one by
eliminating any dimensions with length one.

@return the new Index