src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupFactory.java
/**
	 * The actual compression method, that handles the logic of compressing multiple columns together. This method also
	 * have the responsibility of correcting any estimation errors previously made.
	 * 
	 * @param in           The input matrix, that could have been transposed if CompSettings was set to do that
	 * @param compRatios   The previously computed Compression ratings of individual col indexes.
	 * @param groups       The column groups to consider compressing together.
	 * @param compSettings The compression settings to construct the compression based on.
	 * @param k            The degree of parallelism used.
	 * @return A Resulting array of ColGroups, containing the compressed information from the input matrix block.
	 */
The actual compression method, that handles the logic of compressing multiple columns together. This method also
have the responsibility of correcting any estimation errors previously made.

@param in           The input matrix, that could have been transposed if CompSettings was set to do that
@param compRatios   The previously computed Compression ratings of individual col indexes.
@param groups       The column groups to consider compressing together.
@param compSettings The compression settings to construct the compression based on.
@param k            The degree of parallelism used.
@return A Resulting array of ColGroups, containing the compressed information from the input matrix block.
The actual compression method that handles the logic of compressing multiple columns together . This method also have the responsibility of correcting any estimation errors previously made . @param in The input matrix that could have been transposed if CompSettings was set to do that @param compRatios The previously computed Compression ratings of individual col indexes . @param groups The column groups to consider compressing together . @param compSettings The compression settings to construct the compression based on . @param k The degree of parallelism used . @return A Resulting array of ColGroups containing the compressed information from the input matrix block .
public static ColGroup[] compressColGroups(MatrixBlock in, HashMap<Integer, Double> compRatios, List<int[]> groups,
		CompressionSettings compSettings, int k) {
		if(k <= 1) {
			return compressColGroups(in, compRatios, groups, compSettings);
		}
		else {
			try {
				ExecutorService pool = CommonThreadPool.get(k);
				ArrayList<CompressTask> tasks = new ArrayList<>();
				for(int[] colIndexes : groups)
					tasks.add(new CompressTask(in, compRatios, colIndexes, compSettings));
				List<Future<ColGroup>> rtask = pool.invokeAll(tasks);
				ArrayList<ColGroup> ret = new ArrayList<>();
				for(Future<ColGroup> lrtask : rtask)
					ret.add(lrtask.get());
				pool.shutdown();
				return ret.toArray(new ColGroup[0]);
			}
			catch(InterruptedException | ExecutionException e) {
				return compressColGroups(in, compRatios, groups, compSettings);
			}
		}
	}
public static ColGroup [ ] compressColGroups ( MatrixBlock in , HashMap < Integer , Double > compRatios , List < int [ ] > groups , CompressionSettings compSettings , int k ) { if ( k <= 1 ) { return compressColGroups ( in , compRatios , groups , compSettings ) ; } else { try { ExecutorService pool = CommonThreadPool . get ( k ) ; ArrayList < CompressTask > tasks = new ArrayList < > ( ) ; for ( int [ ] colIndexes : groups ) tasks . add ( new CompressTask ( in , compRatios , colIndexes , compSettings ) ) ; List < Future < ColGroup > > rtask = pool . invokeAll ( tasks ) ; ArrayList < ColGroup > ret = new ArrayList < > ( ) ; for ( Future < ColGroup > lrtask : rtask ) ret . add ( lrtask . get ( ) ) ; pool . shutdown ( ) ; return ret . toArray ( new ColGroup [ 0 ] ) ; } catch ( InterruptedException | ExecutionException e ) { return compressColGroups ( in , compRatios , groups , compSettings ) ; } } }
The actual compression method, that handles the logic of compressing multiple columns together.
The actual compression method that handles the logic of compressing multiple columns together .
// If there is an error in the parallel execution default to the non parallel implementation