org.apache.sysds.runtime.controlprogram.parfor

## Class ResultMerge

- java.lang.Object
- - org.apache.sysds.runtime.controlprogram.parfor.ResultMerge

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  ResultMergeLocalAutomatic, ResultMergeLocalFile, ResultMergeLocalMemory, ResultMergeRemoteSpark, ResultMergeRemoteSparkWCompare

    public abstract class ResultMerge
    extends Object
    implements Serializable

Due to independence of all iterations, any result has the following properties: (1) non local var, (2) matrix object, and (3) completely independent. These properties allow us to realize result merging in parallel without any synchronization.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`ResultMerge(MatrixObject out, MatrixObject[] in, String outputFilename, boolean accum)`

### Method Summary

All Methods Instance Methods Abstract Methods
`abstract MatrixObject` `executeParallelMerge(int par)` Merge all given input matrices in parallel into the given output matrix.
`abstract MatrixObject` `executeSerialMerge()` Merge all given input matrices sequentially into the given output matrix.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ResultMerge

    public ResultMerge(MatrixObject out,
                       MatrixObject[] in,
                       String outputFilename,
                       boolean accum)

### Method Detail

#### executeSerialMerge

    public abstract MatrixObject executeSerialMerge()

Merge all given input matrices sequentially into the given output matrix. The required space in-memory is the size of the output matrix plus the size of one input matrix at a time.

Returns:
  output (merged) matrix

#### executeParallelMerge

    public abstract MatrixObject executeParallelMerge(int par)

Merge all given input matrices in parallel into the given output matrix. The required space in-memory is the size of the output matrix plus the size of all input matrices.

Parameters:
  `par` - degree of parallelism
Returns:
  output (merged) matrix