From 085b6922c07f4626c61e2ed2e6dde6beec0855de Mon Sep 17 00:00:00 2001 From: Lester Solbakken Date: Wed, 20 Feb 2019 12:46:24 +0100 Subject: TensorAddUpdate support for mixed tensors --- vespajlib/src/main/java/com/yahoo/tensor/Tensor.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vespajlib/src/main/java/com/yahoo/tensor/Tensor.java') diff --git a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java index 8002990e5c6..175e6b41daa 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java @@ -113,6 +113,20 @@ public interface Tensor { return builder.build(); } + /** + * Returns a new tensor where existing cells in this tensor have been + * modified according to the given operation and cells in the given map. + * In contrast to {@link #modify}, previously non-existing cells are added + * to this tensor. Only valid for sparse or mixed tensors. + * + * @param op how to update overlapping cells + * @param cells cells to merge with this tensor + * @return a new tensor where this tensor is merged with the other + */ + Tensor merge(DoubleBinaryOperator op, Map cells); + +// Tensor remove(Tensor other); + // ----------------- Primitive tensor functions default Tensor map(DoubleUnaryOperator mapper) { -- cgit v1.2.3