diff options
author | Lester Solbakken <lesters@oath.com> | 2019-02-20 12:46:24 +0100 |
---|---|---|
committer | Lester Solbakken <lesters@oath.com> | 2019-02-20 12:46:24 +0100 |
commit | 085b6922c07f4626c61e2ed2e6dde6beec0855de (patch) | |
tree | 597fc14c08199339c9ab9286c365af6e8d4cdcdb /vespajlib/src/main/java/com/yahoo/tensor/Tensor.java | |
parent | 85e394563c8b711a1a0307c8ac5953c1817f5629 (diff) |
TensorAddUpdate support for mixed tensors
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/Tensor.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/Tensor.java | 14 |
1 files changed, 14 insertions, 0 deletions
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<TensorAddress, Double> cells); + +// Tensor remove(Tensor other); + // ----------------- Primitive tensor functions default Tensor map(DoubleUnaryOperator mapper) { |