private static void leftMultByVectorTranspose(List<ColGroup> colGroups,MatrixBlock vector,MatrixBlock result,boolean doTranspose,int k) throws DMLRuntimeException {
  int kuc=Math.max(1,k - colGroups.size() + 1);
  MatrixBlock rowVector=vector;
  if (doTranspose) {
    rowVector=new MatrixBlock(1,vector.getNumRows(),false);
    LibMatrixReorg.transpose(vector,rowVector);
  }
  result.reset();
  result.allocateDenseBlock();
  try {
    ExecutorService pool=Executors.newFixedThreadPool(Math.min(colGroups.size(),k));
    ArrayList<LeftMatrixMultTask> tasks=new ArrayList<LeftMatrixMultTask>();
    for (    ColGroup grp : colGroups)     tasks.add(new LeftMatrixMultTask(grp,rowVector,result,kuc));
    pool.invokeAll(tasks);
    pool.shutdown();
  }
 catch (  Exception ex) {
    throw new DMLRuntimeException(ex);
  }
  result.recomputeNonZeros();
}

private static void leftMultByVectorTranspose ( List < ColGroup > colGroups , MatrixBlock vector , MatrixBlock result , boolean doTranspose , int k ) throws DMLRuntimeException { int kuc = Math . max ( 1 , k - colGroups . size ( ) + 1 ) ; MatrixBlock rowVector = vector ; if ( doTranspose ) { rowVector = new MatrixBlock ( 1 , vector . getNumRows ( ) , false ) ; LibMatrixReorg . transpose ( vector , rowVector ) ; } result . reset ( ) ; result . allocateDenseBlock ( ) ; try { ExecutorService pool = Executors . newFixedThreadPool ( Math . min ( colGroups . size ( ) , k ) ) ; ArrayList < LeftMatrixMultTask > tasks = new ArrayList < LeftMatrixMultTask > ( ) ; for ( ColGroup grp : colGroups ) tasks . add ( new LeftMatrixMultTask ( grp , rowVector , result , kuc ) ) ; pool . invokeAll ( tasks ) ; pool . shutdown ( ) ; } catch ( Exception ex ) { throw new DMLRuntimeException ( ex ) ; } result . recomputeNonZeros ( ) ; }
multi - thread version of leftmultbyvectortranspose .
