Index permute(int[] dims) {
    if (dims.length != shape.length)
      throw new IllegalArgumentException();
    for (int dim : dims)
      if ((dim < 0) || (dim >= rank))
        throw new IllegalArgumentException();

    boolean isPermuted = false;
    Index newIndex = (Index) this.clone();
    for (int i = 0; i < dims.length; i++) {
      newIndex.stride[i] = stride[dims[i]];
      newIndex.shape[i] = shape[dims[i]];
      //if (name != null) newIndex.name[i] = name[dims[i]];
      if (i != dims[i]) isPermuted = true;
    }

    newIndex.fastIterator = fastIterator && !isPermuted; // useful optimization
    newIndex.precalc(); // any subclass-specific optimizations
    return newIndex;
  }
Index permute(int[] dims) {
    if (dims.length != shape.length)
      throw new IllegalArgumentException();
    for (int dim : dims)
      if ((dim < 0) || (dim >= rank))
        throw new IllegalArgumentException();

    boolean isPermuted = false;
    Index newIndex = (Index) this.clone();
    for (int i = 0; i < dims.length; i++) {
      newIndex.stride[i] = stride[dims[i]];
      newIndex.shape[i] = shape[dims[i]];
      
      if (i != dims[i]) isPermuted = true;
    }

    newIndex.fastIterator = fastIterator && !isPermuted; 
    newIndex.precalc(); 
    return newIndex;
  }
Index permute ( int [ ] dims ) { if ( dims . length != shape . length ) throw new IllegalArgumentException ( ) ; for ( int dim : dims ) if ( ( dim < 0 ) || ( dim >= rank ) ) throw new IllegalArgumentException ( ) ; boolean isPermuted = false ; Index newIndex = ( Index ) this . clone ( ) ; for ( int i = 0 ; i < dims . length ; i ++ ) { newIndex . stride [ i ] = stride [ dims [ i ] ] ; newIndex . shape [ i ] = shape [ dims [ i ] ] ; //if (name != null) newIndex.name[i] = name[dims[i]];
 if ( i != dims [ i ] ) isPermuted = true ; } newIndex . fastIterator = fastIterator && ! isPermuted ; // useful optimization
 newIndex . precalc ( ) ; // any subclass-specific optimizations
 return newIndex ; }
create a new Index based on a permutation of the current indices; vlen fails.

@param dims: the old index dim[k] becomes the new kth index.
@return new Index with permuted indices
create a new Index based on a permutation of the current indices ; vlen fails .