blob: f8ab9dfa63600c8be7041a2595224d41550ab315 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.tensor.functions;
import com.yahoo.tensor.evaluation.EvaluationContext;
import com.yahoo.tensor.evaluation.Name;
import java.util.Optional;
import java.util.function.Function;
/**
* A function which returns a scalar
*
* @author bratseth
*/
public interface ScalarFunction<NAMETYPE extends Name> extends Function<EvaluationContext<NAMETYPE>, Double> {
@Override
Double apply(EvaluationContext<NAMETYPE> context);
/** Returns this as a tensor function, or empty if it cannot be represented as a tensor function */
default Optional<TensorFunction<NAMETYPE>> asTensorFunction() { return Optional.empty(); }
default String toString(ToStringContext context) { return toString(); }
}
|