private void runMatrixVectorMultiplicationTest(boolean sparseM1,ExecType instType){
  RUNTIME_PLATFORM platformOld=rtplatform;
  rtplatform=(instType == ExecType.MR) ? RUNTIME_PLATFORM.HADOOP : RUNTIME_PLATFORM.HYBRID;
  try {
    TestConfiguration config=getTestConfiguration(TEST_NAME);
    double sparsityA=sparseM1 ? sparsity2 : sparsity1;
    String TEST_CACHE_DIR="";
    if (TEST_CACHE_ENABLED) {
      TEST_CACHE_DIR="mv" + String.valueOf(sparsityA) + "/";
    }
    loadTestConfiguration(config,TEST_CACHE_DIR);
    String HOME=SCRIPT_DIR + TEST_DIR;
    fullDMLScriptName=HOME + TEST_NAME + ".dml";
    programArgs=new String[]{"-args",input("A"),Integer.toString(rowsA),Integer.toString(colsA),input("B"),Integer.toString(rowsB),Integer.toString(1),output("C")};
    fullRScriptName=HOME + TEST_NAME + ".R";
    rCmd="Rscript" + " " + fullRScriptName + " "+ inputDir()+ " "+ expectedDir();
    double[][] A=getRandomMatrix(rowsA,colsA,0,1,sparsityA,7);
    writeInputMatrix("A",A,true);
    double[][] B=getRandomMatrix(rowsB,1,0,1,sparsity1,3);
    writeInputMatrix("B",B,true);
    boolean exceptionExpected=false;
    runTest(true,exceptionExpected,null,-1);
    runRScript(true);
    HashMap<CellIndex,Double> dmlfile=readDMLMatrixFromHDFS("C");
    HashMap<CellIndex,Double> rfile=readRMatrixFromFS("C");
    TestUtils.compareMatrices(dmlfile,rfile,eps,"Stat-DML","Stat-R");
  }
  finally {
    rtplatform=platformOld;
  }
}

private void runMatrixVectorMultiplicationTest ( boolean sparseM1 , ExecType instType ) { RUNTIME_PLATFORM platformOld = rtplatform ; rtplatform = ( instType == ExecType . MR ) ? RUNTIME_PLATFORM . HADOOP : RUNTIME_PLATFORM . HYBRID ; try { TestConfiguration config = getTestConfiguration ( TEST_NAME ) ; double sparsityA = sparseM1 ? sparsity2 : sparsity1 ; String TEST_CACHE_DIR = "" ; if ( TEST_CACHE_ENABLED ) { TEST_CACHE_DIR = "mv" + String . valueOf ( sparsityA ) + "/" ; } loadTestConfiguration ( config , TEST_CACHE_DIR ) ; String HOME = SCRIPT_DIR + TEST_DIR ; fullDMLScriptName = HOME + TEST_NAME + ".dml" ; programArgs = new String [ ] { "-args" , input ( "A" ) , Integer . toString ( rowsA ) , Integer . toString ( colsA ) , input ( "B" ) , Integer . toString ( rowsB ) , Integer . toString ( 1 ) , output ( "C" ) } ; fullRScriptName = HOME + TEST_NAME + ".R" ; rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir ( ) + " " + expectedDir ( ) ; double [ ] [ ] A = getRandomMatrix ( rowsA , colsA , 0 , 1 , sparsityA , 7 ) ; writeInputMatrix ( "A" , A , true ) ; double [ ] [ ] B = getRandomMatrix ( rowsB , 1 , 0 , 1 , sparsity1 , 3 ) ; writeInputMatrix ( "B" , B , true ) ; boolean exceptionExpected = false ; runTest ( true , exceptionExpected , null , - 1 ) ; runRScript ( true ) ; HashMap < CellIndex , Double > dmlfile = readDMLMatrixFromHDFS ( "C" ) ; HashMap < CellIndex , Double > rfile = readRMatrixFromFS ( "C" ) ; TestUtils . compareMatrices ( dmlfile , rfile , eps , "Stat-DML" , "Stat-R" ) ; } finally { rtplatform = platformOld ; } }
note : second matrix is always dense if vector .
