summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-06-26 09:51:35 +0000
committerArne Juul <arnej@yahooinc.com>2023-06-26 09:51:35 +0000
commit9faebe628164657eaad3de625b9b799a385aea6e (patch)
tree89948953068dab47de25d1c789c38886944f70b9 /vespajlib/src/test/java/com
parent643a09268b71ea0ebf128552874f1a3ee15aca2e (diff)
add class comment and test expansion
Diffstat (limited to 'vespajlib/src/test/java/com')
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java
index 9d06c313ecc..4fae432b3ca 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java
@@ -3,6 +3,7 @@ package com.yahoo.tensor.functions;
import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
+import com.yahoo.tensor.evaluation.VariableTensor;
import org.junit.Test;
import java.util.List;
@@ -40,4 +41,14 @@ public class EuclideanDistanceTestCase {
assertEquals(expect, result);
}
+ @Test
+ public void testExpansion() {
+ var tType = TensorType.fromSpec("tensor(vecdim[128])");
+ var a = new VariableTensor<>("left", tType);
+ var b = new VariableTensor<>("right", tType);
+ var op = new EuclideanDistance<>(a, b, "vecdim");
+ assertEquals("map(reduce(map(join(left, right, f(a,b)(a - b)), f(a)(a * a)), sum, vecdim), f(a)(sqrt(a)))",
+ op.toPrimitive().toString());
+ }
+
}