use of java.nio.DoubleBuffer in project angel by Tencent.
the class Axpy method doUpdate.
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] scalars) {
try {
rows[1].getLock().writeLock().lock();
DoubleBuffer xData = rows[0].getData();
DoubleBuffer yData = rows[1].getData();
double a = scalars[0];
int size = rows[0].size();
for (int i = 0; i < size; i++) {
yData.put(i, a * xData.get(i) + yData.get(i));
}
} finally {
rows[1].getLock().writeLock().unlock();
}
}
use of java.nio.DoubleBuffer in project angel by Tencent.
the class Ceil method doUpdate.
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows) {
try {
rows[1].getLock().writeLock().lock();
DoubleBuffer from = rows[0].getData();
DoubleBuffer to = rows[1].getData();
int size = rows[0].size();
for (int i = 0; i < size; i++) {
to.put(i, Math.ceil(from.get(i)));
}
} finally {
rows[1].getLock().writeLock().unlock();
}
}
use of java.nio.DoubleBuffer in project angel by Tencent.
the class Copy method doUpdate.
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows) {
try {
rows[1].getLock().writeLock().lock();
DoubleBuffer source = rows[0].getData();
DoubleBuffer target = rows[1].getData();
int size = rows[0].size();
for (int i = 0; i < size; i++) {
target.put(i, source.get(i));
}
} finally {
rows[1].getLock().writeLock().unlock();
}
}
use of java.nio.DoubleBuffer in project angel by Tencent.
the class Div method doUpdate.
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows) {
try {
rows[2].getLock().writeLock().lock();
DoubleBuffer from1 = rows[0].getData();
DoubleBuffer from2 = rows[1].getData();
DoubleBuffer to = rows[2].getData();
int size = rows[0].size();
for (int i = 0; i < size; i++) {
to.put(i, from1.get(i) / from2.get(i));
}
} finally {
rows[2].getLock().writeLock().unlock();
}
}
use of java.nio.DoubleBuffer in project angel by Tencent.
the class DivS method doUpdate.
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] scalars) {
try {
rows[1].getLock().writeLock().lock();
DoubleBuffer from = rows[0].getData();
DoubleBuffer to = rows[1].getData();
double value = scalars[0];
int size = rows[0].size();
for (int i = 0; i < size; i++) {
to.put(i, from.get(i) / value);
}
} finally {
rows[1].getLock().writeLock().unlock();
}
}
Aggregations