Search in sources :

Example 6 with ScalarAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.

the class AggrFuncTest method testMin.

@Test
public void testMin() throws InvalidParameterException, InterruptedException, ExecutionException {
    GetFunc func = new Min(w2Client.getMatrixId(), 1);
    double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
    double min = Double.MAX_VALUE;
    for (double x : localArray1) {
        if (min > x)
            min = x;
    }
    Assert.assertEquals(result, min, delta);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) ScalarAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)

Example 7 with ScalarAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.

the class AggrFuncTest method testAsum.

@Test
public void testAsum() throws InvalidParameterException, InterruptedException, ExecutionException {
    GetFunc func = new Asum(w2Client.getMatrixId(), 1);
    double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
    double sum = 0.0;
    for (double x : localArray1) {
        sum += Math.abs(x);
    }
    Assert.assertEquals(result, sum, delta);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) ScalarAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)

Example 8 with ScalarAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.

the class AggrFuncTest method testNrm2.

@Test
public void testNrm2() throws InvalidParameterException, InterruptedException, ExecutionException {
    GetFunc func = new Nrm2(w2Client.getMatrixId(), 1);
    double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
    double nrm2 = 0;
    for (double x : localArray1) {
        nrm2 += x * x;
    }
    nrm2 = Math.sqrt(nrm2);
    Assert.assertEquals(result, nrm2, delta);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) ScalarAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)

Example 9 with ScalarAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.

the class AggrFuncTest method testMax.

@Test
public void testMax() throws InvalidParameterException, InterruptedException, ExecutionException {
    GetFunc func = new Max(w2Client.getMatrixId(), 1);
    double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
    double max = Double.MIN_VALUE;
    for (double x : localArray1) {
        if (max < x)
            max = x;
    }
    Assert.assertEquals(result, max, delta);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) ScalarAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)

Example 10 with ScalarAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.

the class AggrFuncTest method testAmin.

@Test
public void testAmin() throws InvalidParameterException, InterruptedException, ExecutionException {
    GetFunc func = new Amin(w2Client.getMatrixId(), 1);
    double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
    double min = Double.MAX_VALUE;
    for (double x : localArray1) {
        if (min > Math.abs(x))
            min = Math.abs(x);
    }
    Assert.assertEquals(result, min, delta);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) ScalarAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)

Aggregations

ScalarAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult)10 GetFunc (com.tencent.angel.ml.matrix.psf.get.base.GetFunc)9 PartitionGetParam (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam)1 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)1 Int2ObjectArrayMap (it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap)1