use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testSignum.
@Test
public void testSignum() throws Exception {
UpdateFunc func = new Signum(w2Client.getMatrixId(), 1, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.signum(localArray1[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testAxpy.
@Test
public void testAxpy() throws Exception {
w2Client.update(new Fill(w2Client.getMatrixId(), 3, 1.0)).get();
UpdateFunc func = new Axpy(w2Client.getMatrixId(), 0, 3, -2.0);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], localArray0[i] * -2.0 + 1, delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testMinV.
@Test
public void testMinV() throws Exception {
UpdateFunc func = new MinV(w2Client.getMatrixId(), 0, 1, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.min(localArray1[i], localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testRound.
@Test
public void testRound() throws Exception {
UpdateFunc func = new Round(w2Client.getMatrixId(), 0, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.round(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testPut.
@Test
public void testPut() throws Exception {
UpdateFunc func = new Push(w2Client.getMatrixId(), 3, localArray0);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], localArray0[i], delta);
}
}
Aggregations