Package com.yahoo.tensor.functions
Class Merge<NAMETYPE extends Name>
java.lang.Object
com.yahoo.tensor.functions.TensorFunction<NAMETYPE>
com.yahoo.tensor.functions.PrimitiveTensorFunction<NAMETYPE>
com.yahoo.tensor.functions.Merge<NAMETYPE>
The merge tensor operation produces from two argument tensors having equal types
a tensor having the same type where the values are the union of the values of both tensors. In the cases where both
tensors contain a value for a given cell, and only then, the lambda scalar expression is evaluated to produce
the resulting cell value.
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionMerge
(TensorFunction<NAMETYPE> argumentA, TensorFunction<NAMETYPE> argumentB, DoubleBinaryOperator merger) -
Method Summary
Modifier and TypeMethodDescriptionReturns the function arguments of this node in the order they are appliedevaluate
(EvaluationContext<NAMETYPE> context) Evaluates this tensor.int
hashCode()
Returns a hashcode computed from the data in thismerger()
static TensorType
outputType
(TensorType a, TensorType b) Returns the type resulting from applying Merge to the two given typesTranslate this function - and all of its arguments recursively - to a tree of primitive functions only.toString
(ToStringContext<NAMETYPE> context) Return a string representation of this context.type
(TypeContext<NAMETYPE> context) Returns the type of the tensor this produces given the input types in the contextwithArguments
(List<TensorFunction<NAMETYPE>> 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
asScalarFunction, evaluate, toString, withTransformedFunctions
-
Constructor Details
-
Merge
public Merge(TensorFunction<NAMETYPE> argumentA, TensorFunction<NAMETYPE> argumentB, DoubleBinaryOperator merger)
-
-
Method Details
-
outputType
Returns the type resulting from applying Merge to the two given types -
merger
-
arguments
Description copied from class:TensorFunction
Returns the function arguments of this node in the order they are applied- Specified by:
arguments
in classTensorFunction<NAMETYPE extends Name>
-
withArguments
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<NAMETYPE extends Name>
-
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<NAMETYPE extends Name>
- Returns:
- a tree of primitive functions implementing this
-
type
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<NAMETYPE extends Name>
- Parameters:
context
- a context which must be passed to all nexted functions when evaluating
-
evaluate
Description copied from class:TensorFunction
Evaluates this tensor.- Specified by:
evaluate
in classTensorFunction<NAMETYPE extends Name>
- Parameters:
context
- a context which must be passed to all nested functions when evaluating
-
toString
Description copied from class:TensorFunction
Return a string representation of this context.- Specified by:
toString
in classTensorFunction<NAMETYPE extends Name>
- Parameters:
context
- a context which must be passed to all nested functions when requesting the string value
-
hashCode
public int hashCode()Description copied from class:TensorFunction
Returns a hashcode computed from the data in this- Specified by:
hashCode
in classTensorFunction<NAMETYPE extends Name>
-