public static INDArrayIndex [ ] adjustIndices ( int [ ] originalShape , INDArrayIndex ... indexes ) { if ( Shape . isVector ( originalShape ) && indexes . length == 1 ) return indexes ; if ( indexes . length < originalShape . length ) indexes = fillIn ( originalShape , indexes ) ; if ( indexes . length > originalShape . length ) { INDArrayIndex [ ] ret = new INDArrayIndex [ originalShape . length ] ; System . arraycopy ( indexes , 0 , ret , 0 , originalShape . length ) ; return ret ; } if ( indexes . length == originalShape . length ) return indexes ; for ( int i = 0 ; i < indexes . length ; i ++ ) { if ( indexes [ i ] . end ( ) >= originalShape [ i ] || indexes [ i ] instanceof NDArrayIndexAll ) indexes [ i ] = NDArrayIndex . interval ( 0 , originalShape [ i ] - 1 ) ; } return indexes ; }
Prunes indices of greater length than the shape and fills in missing indices if there are any