public static List < List < Double > > partitionVariable ( List < Double > arr , int chunk ) { int count = 0 ; List < List < Double > > ret = new ArrayList < List < Double > > ( ) ; while ( count < arr . size ( ) ) { List < Double > sublist = arr . subList ( count , count + chunk ) ; count += chunk ; ret . add ( sublist ) ; } //All data sets must be same size for ( List < Double > lists : ret ) { if ( lists . size ( ) < chunk ) ret . remove ( lists ) ; } return ret ; }
This will partition the given whole variable data applyTransformToDestination in to the specified chunk number .