@Override
    public TensorFunction<NAMETYPE> withArguments(List<TensorFunction<NAMETYPE>> arguments) {
        if ( arguments.size() != 2)
            throw new IllegalArgumentException("ReduceJoin must have 2 arguments, got " + arguments.size());
        return new ReduceJoin<>(arguments.get(0), arguments.get(1), combinator, aggregator, dimensions);
    }
An optimization for tensor expressions where a join immediately follows a
reduce. Evaluating this as one operation is significantly more efficient
than evaluating each separately.

This implementation optimizes the case where the reduce is done on the same
dimensions as the join. A particularly efficient evaluation is done if there
is one common dimension that is joined and reduced on, which is a common
case as it covers vector and matrix like multiplications.

@author lesters
vespajlib/src/main/java/com/yahoo/tensor/functions/ReduceJoin.java