private double dotProduct(Tensor tensor, List<Tensor> tensors) {
        double largest = Double.MIN_VALUE;
        TensorFunction<Name> dotProductFunction = new Reduce<>(
                new Join<>(new ConstantTensor<>(tensor),
                        new VariableTensor<>("argument"), (a, b) -> a * b
                ),
                Reduce.Aggregator.sum
        ).toPrimitive();
        MapEvaluationContext<Name> context = new MapEvaluationContext<>();

        for (Tensor tensorElement : tensors) { // tensors.size() = 1 for larger tensor
            context.put("argument", tensorElement);
            double dotProduct = dotProductFunction.evaluate(context).asDouble();
            if (dotProduct > largest) {
                largest = dotProduct;
            }
        }
        return largest;
    }
Microbenchmark of tensor operations.

@author bratseth
vespajlib/src/test/java/com/yahoo/tensor/TensorFunctionBenchmark.java