protected void testScaleWithR(SIZE sz,RANGE rng,SPARSITY sp,RUNTIME_PLATFORM rt){
  RUNTIME_PLATFORM oldrt=rtplatform;
  rtplatform=rt;
  try {
    TestConfiguration config=getTestConfiguration("Scale");
    config.addVariable("rows1",sz.size);
    config.addVariable("rows2",rows2);
    loadTestConfiguration(config);
    String S_HOME=SCRIPT_DIR + TEST_DIR;
    fullDMLScriptName=S_HOME + "Scale" + ".dml";
    programArgs=new String[]{"-args",input("vector"),Integer.toString(sz.size),input("prob"),Integer.toString(rows2),output("mean"),output("std"),output("se"),output("var"),output("cv"),output("min"),output("max"),output("rng"),output("g1"),output("se_g1"),output("g2"),output("se_g2"),output("median"),output("iqm"),output("out_minus"),output("out_plus"),output("quantile")};
    fullRScriptName=S_HOME + "Scale" + ".R";
    rCmd="Rscript" + " " + fullRScriptName + " "+ inputDir()+ " "+ expectedDir();
    double[][] vector=getRandomMatrix(sz.size,1,rng.min,rng.max,sp.sparsity,20160124165501L);
    double[][] prob=getRandomMatrix(rows2,1,0,1,1,20160124165502L);
    writeInputMatrix("vector",vector,true);
    writeInputMatrix("prob",prob,true);
    runTest(true,false,null,-1);
    runRScript(true);
    for (    String file : config.getOutputFiles()) {
      HashMap<CellIndex,Double> dmlfile;
      HashMap<CellIndex,Double> rfile;
      if (file.endsWith(".scalar")) {
        file=file.replace(".scalar","");
        dmlfile=readDMLScalarFromHDFS(file);
        rfile=readRScalarFromFS(file);
      }
 else {
        dmlfile=readDMLMatrixFromHDFS(file);
        rfile=readRMatrixFromFS(file);
      }
      TestUtils.compareMatrices(dmlfile,rfile,epsilon,file + "-DML",file + "-R");
    }
  }
  finally {
    rtplatform=oldrt;
  }
}

protected void testScaleWithR ( SIZE sz , RANGE rng , SPARSITY sp , RUNTIME_PLATFORM rt ) { RUNTIME_PLATFORM oldrt = rtplatform ; rtplatform = rt ; try { TestConfiguration config = getTestConfiguration ( "Scale" ) ; config . addVariable ( "rows1" , sz . size ) ; config . addVariable ( "rows2" , rows2 ) ; loadTestConfiguration ( config ) ; String S_HOME = SCRIPT_DIR + TEST_DIR ; fullDMLScriptName = S_HOME + "Scale" + ".dml" ; programArgs = new String [ ] { "-args" , input ( "vector" ) , Integer . toString ( sz . size ) , input ( "prob" ) , Integer . toString ( rows2 ) , output ( "mean" ) , output ( "std" ) , output ( "se" ) , output ( "var" ) , output ( "cv" ) , output ( "min" ) , output ( "max" ) , output ( "rng" ) , output ( "g1" ) , output ( "se_g1" ) , output ( "g2" ) , output ( "se_g2" ) , output ( "median" ) , output ( "iqm" ) , output ( "out_minus" ) , output ( "out_plus" ) , output ( "quantile" ) } ; fullRScriptName = S_HOME + "Scale" + ".R" ; rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir ( ) + " " + expectedDir ( ) ; double [ ] [ ] vector = getRandomMatrix ( sz . size , 1 , rng . min , rng . max , sp . sparsity , 20160124165501L ) ; double [ ] [ ] prob = getRandomMatrix ( rows2 , 1 , 0 , 1 , 1 , 20160124165502L ) ; writeInputMatrix ( "vector" , vector , true ) ; writeInputMatrix ( "prob" , prob , true ) ; runTest ( true , false , null , - 1 ) ; runRScript ( true ) ; for ( String file : config . getOutputFiles ( ) ) { HashMap < CellIndex , Double > dmlfile ; HashMap < CellIndex , Double > rfile ; if ( file . endsWith ( ".scalar" ) ) { file = file . replace ( ".scalar" , "" ) ; dmlfile = readDMLScalarFromHDFS ( file ) ; rfile = readRScalarFromFS ( file ) ; } else { dmlfile = readDMLMatrixFromHDFS ( file ) ; rfile = readRMatrixFromFS ( file ) ; } TestUtils . compareMatrices ( dmlfile , rfile , epsilon , file + "-DML" , file + "-R" ) ; } } finally { rtplatform = oldrt ; } }
shared test driver for tests of univariate statistics over continuous , scaled , but not weighted , data
