use of com.tencent.angel.ml.matrix.psf.get.getrow.GetRowResult in project angel by Tencent.
the class GetNodes method merge.
@Override
public GetResult merge(List<PartitionGetResult> partResults) {
int size = 0;
for (PartitionGetResult result : partResults) {
if (result instanceof IndexPartGetLongResult) {
size += ((IndexPartGetLongResult) result).getValues().length;
}
}
long[] values = new long[size];
int start = 0;
for (PartitionGetResult result : partResults) {
if (result instanceof IndexPartGetLongResult) {
long[] vals = ((IndexPartGetLongResult) result).getValues();
System.arraycopy(vals, 0, values, start, vals.length);
start += vals.length;
}
}
return new GetRowResult(ResponseType.SUCCESS, VFactory.denseLongVector(values));
}
use of com.tencent.angel.ml.matrix.psf.get.getrow.GetRowResult in project angel by Tencent.
the class IndexGet method merge.
@Override
public GetResult merge(List<PartitionGetResult> partResults) {
long startTs = System.currentTimeMillis();
RowType rowType = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(param.getMatrixId()).getRowType();
GetRowResult result;
switch(rowType) {
case T_DOUBLE_DENSE:
case T_DOUBLE_SPARSE:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseDoubleVector((IndexGetParam) param, partResults));
break;
case T_DOUBLE_SPARSE_COMPONENT:
case T_DOUBLE_DENSE_COMPONENT:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseDoubleCompVector((IndexGetParam) param, partResults));
break;
case T_FLOAT_DENSE:
case T_FLOAT_SPARSE:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseFloatVector((IndexGetParam) param, partResults));
break;
case T_FLOAT_SPARSE_COMPONENT:
case T_FLOAT_DENSE_COMPONENT:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseFloatCompVector((IndexGetParam) param, partResults));
break;
case T_INT_DENSE:
case T_INT_SPARSE:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseIntVector((IndexGetParam) param, partResults));
break;
case T_INT_DENSE_COMPONENT:
case T_INT_SPARSE_COMPONENT:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseIntCompVector((IndexGetParam) param, partResults));
break;
case T_LONG_DENSE:
case T_LONG_SPARSE:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseLongVector((IndexGetParam) param, partResults));
break;
case T_LONG_DENSE_COMPONENT:
case T_LONG_SPARSE_COMPONENT:
result = new GetRowResult(ResponseType.SUCCESS, ValuesCombineUtils.mergeSparseLongCompVector((IndexGetParam) param, partResults));
break;
default:
throw new UnsupportedOperationException("Unsupport operation: update " + rowType + " to " + this.getClass().getName());
}
return result;
}
use of com.tencent.angel.ml.matrix.psf.get.getrow.GetRowResult in project angel by Tencent.
the class GetNodes method merge.
@Override
public GetResult merge(List<PartitionGetResult> partResults) {
int size = 0;
for (PartitionGetResult result : partResults) {
if (result instanceof IndexPartGetLongResult) {
size += ((IndexPartGetLongResult) result).getValues().length;
}
}
long[] values = new long[size];
int start = 0;
for (PartitionGetResult result : partResults) {
if (result instanceof IndexPartGetLongResult) {
long[] vals = ((IndexPartGetLongResult) result).getValues();
System.arraycopy(vals, 0, values, start, vals.length);
start += vals.length;
}
}
return new GetRowResult(ResponseType.SUCCESS, VFactory.denseLongVector(values));
}
Aggregations