Class TensorFunction<NAMETYPE extends Name>

  • Direct Known Subclasses:
    CompositeTensorFunction, PrimitiveTensorFunction

    public abstract class TensorFunction<NAMETYPE extends Name>
    extends java.lang.Object
    A representation of a tensor function which is able to be translated to a set of primitive tensor functions if necessary. All tensor functions are immutable.
    Author:
    bratseth
    • Constructor Detail

      • TensorFunction

        public TensorFunction()
    • Method Detail

      • arguments

        public abstract java.util.List<TensorFunction<NAMETYPE>> arguments()
        Returns the function arguments of this node in the order they are applied
      • withArguments

        public abstract TensorFunction<NAMETYPE> withArguments​(java.util.List<TensorFunction<NAMETYPE>> arguments)
        Returns a copy of this tensor function with the arguments replaced by the given list of arguments.
        Throws:
        java.lang.IllegalArgumentException - if the argument list has the wrong size for this function
      • toPrimitive

        public abstract PrimitiveTensorFunction<NAMETYPE> toPrimitive()
        Translate this function - and all of its arguments recursively - to a tree of primitive functions only.
        Returns:
        a tree of primitive functions implementing this
      • evaluate

        public abstract Tensor evaluate​(EvaluationContext<NAMETYPE> context)
        Evaluates this tensor.
        Parameters:
        context - a context which must be passed to all nested functions when evaluating
      • type

        public abstract TensorType type​(TypeContext<NAMETYPE> context)
        Returns the type of the tensor this produces given the input types in the context
        Parameters:
        context - a context which must be passed to all nexted functions when evaluating
      • evaluate

        public final Tensor evaluate()
        Evaluate with no context
      • toString

        public abstract java.lang.String toString​(ToStringContext context)
        Return a string representation of this context.
        Parameters:
        context - a context which must be passed to all nested functions when requesting the string value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object