public static void wrapScalarBlock(TensorType type,
                                       List<String> dimensionOrder,
                                       String mappedDimensionLabel,
                                       List<ExpressionNode> nodes,
                                       Map<TensorAddress, ScalarFunction<Reference>> receivingMap) {
        TensorType denseSubtype = new TensorType(type.valueType(),
                                                 type.dimensions().stream().filter(TensorType.Dimension::isIndexed).collect(Collectors.toList()));
        List<String> denseDimensionOrder = new ArrayList<>(dimensionOrder);
        denseDimensionOrder.retainAll(denseSubtype.dimensionNames());
        IndexedTensor.Indexes indexes = IndexedTensor.Indexes.of(denseSubtype, denseDimensionOrder);
        if (indexes.size() != nodes.size())
            throw new IllegalArgumentException("At '" + mappedDimensionLabel + "': Need " + indexes.size() +
                                               " values to fill a dense subspace of " + type + " but got " + nodes.size());
        for (ExpressionNode node : nodes) {
            indexes.next();

            // Insert the mapped dimension into the dense subspace address of indexes
            String[] labels = new String[type.rank()];
            int indexedDimensionsIndex = 0;
            int allDimensionsIndex = 0;
            for (TensorType.Dimension dimension : type.dimensions()) {
                if (dimension.isIndexed())
                    labels[allDimensionsIndex++] = String.valueOf(indexes.indexesForReading()[indexedDimensionsIndex++]);
                else
                    labels[allDimensionsIndex++] = mappedDimensionLabel;
            }

            receivingMap.put(TensorAddress.of(labels), wrapScalar(node));
        }
    }
Returns the tensor function wrapped by this
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/TensorFunctionNode.java