class MatrixAddFunction extends DoFn<KV<Integer, CoGbkResult>, KV<Integer, DenseMatrix>> {
   @DoFn.ProcessElement
   public void processElement(ProcessContext processContext) {
      KV<Integer,CoGbkResult> join = processContext.element();
      Integer index = join.getKey();
      DenseMatrix matrix1 = join.getValue().getOnly(BeamMain.firstmatTag);
...