Package com.yahoo.tensor.functions
Class DynamicTensor
- java.lang.Object
-
- com.yahoo.tensor.functions.TensorFunction
-
- com.yahoo.tensor.functions.PrimitiveTensorFunction
-
- com.yahoo.tensor.functions.DynamicTensor
-
public abstract class DynamicTensor extends PrimitiveTensorFunction
A function which is a tensor whose values are computed by individual lambda functions on evaluation.- Author:
- bratseth
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<TensorFunction>
arguments()
Returns the function arguments of this node in the order they are appliedstatic DynamicTensor
from(TensorType type, java.util.List<java.util.function.Function<EvaluationContext<?>,java.lang.Double>> cells)
Creates a dynamic tensor function for a bound, indexed tensorstatic DynamicTensor
from(TensorType type, java.util.Map<TensorAddress,java.util.function.Function<EvaluationContext<?>,java.lang.Double>> cells)
Creates a dynamic tensor function.PrimitiveTensorFunction
toPrimitive()
Translate this function - and all of its arguments recursively - to a tree of primitive functions only.<NAMETYPE extends TypeContext.Name>
TensorTypetype(TypeContext<NAMETYPE> context)
Returns the type of the tensor this produces given the input types in the contextTensorFunction
withArguments(java.util.List<TensorFunction> arguments)
Returns a copy of this tensor function with the arguments replaced by the given list of arguments.-
Methods inherited from class com.yahoo.tensor.functions.TensorFunction
evaluate, evaluate, toString, toString
-
-
-
-
Method Detail
-
type
public <NAMETYPE extends TypeContext.Name> TensorType type(TypeContext<NAMETYPE> context)
Description copied from class:TensorFunction
Returns the type of the tensor this produces given the input types in the context- Specified by:
type
in classTensorFunction
- Parameters:
context
- a context which must be passed to all nexted functions when evaluating
-
arguments
public java.util.List<TensorFunction> arguments()
Description copied from class:TensorFunction
Returns the function arguments of this node in the order they are applied- Specified by:
arguments
in classTensorFunction
-
withArguments
public TensorFunction withArguments(java.util.List<TensorFunction> arguments)
Description copied from class:TensorFunction
Returns a copy of this tensor function with the arguments replaced by the given list of arguments.- Specified by:
withArguments
in classTensorFunction
-
toPrimitive
public PrimitiveTensorFunction toPrimitive()
Description copied from class:TensorFunction
Translate this function - and all of its arguments recursively - to a tree of primitive functions only.- Specified by:
toPrimitive
in classTensorFunction
- Returns:
- a tree of primitive functions implementing this
-
from
public static DynamicTensor from(TensorType type, java.util.Map<TensorAddress,java.util.function.Function<EvaluationContext<?>,java.lang.Double>> cells)
Creates a dynamic tensor function. The cell addresses must match the type.
-
from
public static DynamicTensor from(TensorType type, java.util.List<java.util.function.Function<EvaluationContext<?>,java.lang.Double>> cells)
Creates a dynamic tensor function for a bound, indexed tensor
-
-