private void rightMultByVector(MatrixBlock vector,MatrixBlock result,int k) throws DMLRuntimeException {
  result.allocateDenseBlock();
  try {
    ExecutorService pool=Executors.newFixedThreadPool(k);
    int rlen=getNumRows();
    int seqsz=BitmapEncoder.BITMAP_BLOCK_SZ;
    int blklen=(int)(Math.ceil((double)rlen / k));
    blklen+=(blklen % seqsz != 0) ? seqsz - blklen % seqsz : 0;
    ArrayList<RightMatrixMultTask> tasks=new ArrayList<RightMatrixMultTask>();
    for (int i=0; i < k & i * blklen < getNumRows(); i++)     tasks.add(new RightMatrixMultTask(_colGroups,vector,result,i * blklen,Math.min((i + 1) * blklen,rlen)));
    pool.invokeAll(tasks);
    pool.shutdown();
  }
 catch (  Exception ex) {
    throw new DMLRuntimeException(ex);
  }
  result.recomputeNonZeros();
}

private void rightMultByVector ( MatrixBlock vector , MatrixBlock result , int k ) throws DMLRuntimeException { result . allocateDenseBlock ( ) ; try { ExecutorService pool = Executors . newFixedThreadPool ( k ) ; int rlen = getNumRows ( ) ; int seqsz = BitmapEncoder . BITMAP_BLOCK_SZ ; int blklen = ( int ) ( Math . ceil ( ( double ) rlen / k ) ) ; blklen += ( blklen % seqsz != 0 ) ? seqsz - blklen % seqsz : 0 ; ArrayList < RightMatrixMultTask > tasks = new ArrayList < RightMatrixMultTask > ( ) ; for ( int i = 0 ; i < k & i * blklen < getNumRows ( ) ; i ++ ) tasks . add ( new RightMatrixMultTask ( _colGroups , vector , result , i * blklen , Math . min ( ( i + 1 ) * blklen , rlen ) ) ) ; pool . invokeAll ( tasks ) ; pool . shutdown ( ) ; } catch ( Exception ex ) { throw new DMLRuntimeException ( ex ) ; } result . recomputeNonZeros ( ) ; }
multi - threaded version of rightmultbyvector .
