org.apache.ignite.ml.math.functions

## Class Functions

- java.lang.Object
- - org.apache.ignite.ml.math.functions.Functions

-     public final class Functions
      extends Object

  Compatibility with Apache Mahout.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static IgniteDoubleFunction<Double>` | `ABS` Function that returns `Math.abs(a)`.
    `static IgniteBiFunction<Double,Double,Double>` | `COMPARE` Function that returns {@code a < b ?
    `static IgniteDoubleFunction<Double>` | `IDENTITY` Function that returns its argument.
    `static IgniteDoubleFunction<Double>` | `INV` Function that returns `1 / a`
    `static IgniteBiFunction<Double,Double,Double>` | `LG` Function that returns `Math.log(a) / Math.log(b)`.
    `static IgniteDoubleFunction<Double>` | `LOG2` Function that returns `Math.log(a) / Math.log(2)`.
    `static IgniteBiFunction<Double,Double,Double>` | `MAX_ABS` Function that returns `max(abs(a), abs(b))`.
    `static IgniteBiFunction<Double,Double,Double>` | `MIN` Function that returns `min(a, b)`.
    `static IgniteBiFunction<Double,Double,Double>` | `MIN_ABS` Function that returns `min(abs(a), abs(b))`.
    `static IgniteBiFunction<Double,Double,Double>` | `MINUS` Function that returns `a - b`.
    `static IgniteBiFunction<Double,Double,Double>` | `MINUS_ABS` Function that returns `abs(a - b)`.
    `static IgniteBiFunction<Double,Double,Double>` | `MINUS_SQUARED` Function that returns `(a - b) * (a - b)`
    `static IgniteBiFunction<Double,Double,Double>` | `MOD` Function that returns `a % b`.
    `static IgniteBiFunction<Double,Double,Double>` | `MULT` Function that returns `a * b`.
    `static IgniteDoubleFunction<Double>` | `NEGATE` Function that returns `-a`.
    `static IgniteBiFunction<Double,Double,Double>` | `PLUS` Function that returns `a + b`.
    `static IgniteBiFunction<Double,Double,Double>` | `PLUS_ABS` Function that returns `Math.abs(a) + Math.abs(b)`.
    `static IgniteDoubleFunction<Double>` | `SIGMOID` Function that returns `1 / (1 + exp(-a)`
    `static IgniteDoubleFunction<Double>` | `SIGMOIDGRADIENT` Function that returns `a * (1-a)`
    `static IgniteDoubleFunction<Double>` | `SIGN` Function that returns {@code a < 0 ?
    `static IgniteDoubleFunction<Double>` | `SQUARE` Function that returns `a * a`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Functions()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <A,B extends Comparable<B>> IgniteBiTuple<Integer,A>` | `argmin(List<A> args, IgniteFunction<A,B> f)`
    `static IgniteDoubleFunction<Double>` | `constant(Double c)` Function that returns passed constant.
    `static <A,B,C> IgniteCurriedBiFunction<A,B,C>` | `curry(BiFunction<A,B,C> f)` Curry bi-function.
    `static <A,B,C> IgniteCurriedBiFunction<A,B,C>` | `curry(IgniteBiFunction<A,B,C> f)` Transform bi-function of the form (a, b) -> c into a function of form a -> (b -> c).
    `static <A,B,C,D> IgniteCurriedTriFunction<A,B,C,D>` | `curry(IgniteTriFunction<A,B,C,D> f)` Transform tri-function of the form (a, b, c) -> d into a function of form a -> (b -> (c -> d)).
    `static IgniteDoubleFunction<Double>` | `div(double b)` Function that returns `a / b`.
    `static <T> T` | `MAX_GENERIC(T a, T b, Comparator<T> f)` Generic 'max' function.
    `static <T> T` | `MIN_GENERIC(T a, T b, Comparator<T> f)` Generic 'min' function.
    `static IgniteBiFunction<Double,Double,Double>` | `minusMult(double constant)` Function that returns `a - b*constant`.
    `static IgniteDoubleFunction<Double>` | `mult(double b)` Function that returns `a * b`.
    `static <A,B,C> IgniteBiFunction<A,B,IgniteSupplier<C>>` | `outputSupplier(IgniteBiFunction<A,B,C> f)` Transform function of form (a, b) -> c into (a, b) - () -> c.
    `static <A,B> IgniteFunction<A,IgniteSupplier<B>>` | `outputSupplier(IgniteFunction<A,B> f)` Transform function of form a -> b into a -> (() -> b).
    `static IgniteDoubleFunction<Double>` | `plus(double b)` Function that returns `a + b`.
    `static IgniteBiFunction<Double,Double,Double>` | `plusMult(double constant)` Function that returns `a + b*constant`.
    `static IgniteDoubleFunction<Double>` | `pow(double b)` Function that returns `Math.pow(a, b)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ABS

          public static final IgniteDoubleFunction<Double> ABS

      Function that returns `Math.abs(a)`.

    - #### IDENTITY

          public static final IgniteDoubleFunction<Double> IDENTITY

      Function that returns its argument.

    - #### LOG2

          public static final IgniteDoubleFunction<Double> LOG2

      Function that returns `Math.log(a) / Math.log(2)`.

    - #### NEGATE

          public static final IgniteDoubleFunction<Double> NEGATE

      Function that returns `-a`.

    - #### SIGN

          public static final IgniteDoubleFunction<Double> SIGN

      Function that returns `a < 0 ? -1 : a > 0 ? 1 : 0` .

    - #### SQUARE

          public static final IgniteDoubleFunction<Double> SQUARE

      Function that returns `a * a`.

    - #### SIGMOID

          public static final IgniteDoubleFunction<Double> SIGMOID

      Function that returns `1 / (1 + exp(-a)`

    - #### INV

          public static final IgniteDoubleFunction<Double> INV

      Function that returns `1 / a`

    - #### SIGMOIDGRADIENT

          public static final IgniteDoubleFunction<Double> SIGMOIDGRADIENT

      Function that returns `a * (1-a)`

    - #### MOD

          public static final IgniteBiFunction<Double,Double,Double> MOD

      Function that returns `a % b`.

    - #### MULT

          public static final IgniteBiFunction<Double,Double,Double> MULT

      Function that returns `a * b`.

    - #### LG

          public static final IgniteBiFunction<Double,Double,Double> LG

      Function that returns `Math.log(a) / Math.log(b)`.

    - #### PLUS

          public static final IgniteBiFunction<Double,Double,Double> PLUS

      Function that returns `a + b`.

    - #### MINUS

          public static final IgniteBiFunction<Double,Double,Double> MINUS

      Function that returns `a - b`.

    - #### MIN

          public static final IgniteBiFunction<Double,Double,Double> MIN

      Function that returns `min(a, b)`.

    - #### MINUS_ABS

          public static final IgniteBiFunction<Double,Double,Double> MINUS_ABS

      Function that returns `abs(a - b)`.

    - #### MAX_ABS

          public static final IgniteBiFunction<Double,Double,Double> MAX_ABS

      Function that returns `max(abs(a), abs(b))`.

    - #### MIN_ABS

          public static final IgniteBiFunction<Double,Double,Double> MIN_ABS

      Function that returns `min(abs(a), abs(b))`.

    - #### PLUS_ABS

          public static final IgniteBiFunction<Double,Double,Double> PLUS_ABS

      Function that returns `Math.abs(a) + Math.abs(b)`.

    - #### MINUS_SQUARED

          public static final IgniteBiFunction<Double,Double,Double> MINUS_SQUARED

      Function that returns `(a - b) * (a - b)`

    - #### COMPARE

          public static final IgniteBiFunction<Double,Double,Double> COMPARE

      Function that returns `a &lt; b ? -1 : a &gt; b ? 1 : 0`.

  - ### Constructor Detail

    - #### Functions

          public Functions()

  - ### Method Detail

    - #### MAX_GENERIC

          public static <T> T MAX_GENERIC(T a,
                                          T b,
                                          Comparator<T> f)

      Generic 'max' function.
      Type Parameters:
        `T` - Type of objects to compare.
      Parameters:
        `a` - First object to compare.
        `b` - Second object to compare.
        `f` - Comparator.
      Returns:
        Maximum between `a` and `b` in terms of comparator `f`.

    - #### MIN_GENERIC

          public static <T> T MIN_GENERIC(T a,
                                          T b,
                                          Comparator<T> f)

      Generic 'min' function.
      Type Parameters:
        `T` - Type of objects to compare.
      Parameters:
        `a` - First object to compare.
        `b` - Second object to compare.
        `f` - Comparator.
      Returns:
        Minimum between `a` and `b` in terms of comparator `f`.

    - #### argmin

          public static <A,B extends Comparable<B>> IgniteBiTuple<Integer,A> argmin(List<A> args,
                                                                                    IgniteFunction<A,B> f)

    - #### plus

          public static IgniteDoubleFunction<Double> plus(double b)

      Function that returns `a + b`. `a` is a variable, `b` is fixed.
      Parameters:
        `b` - Value to add.
      Returns:
        Function for this operation.

    - #### mult

          public static IgniteDoubleFunction<Double> mult(double b)

      Function that returns `a * b`. `a` is a variable, `b` is fixed.
      Parameters:
        `b` - Value to multiply to.
      Returns:
        Function for this operation.

    - #### div

          public static IgniteDoubleFunction<Double> div(double b)

      Function that returns `a / b`. `a` is a variable, `b` is fixed.
      Parameters:
        `b` - Value to divide to.
      Returns:
        Function for this operation.

    - #### plusMult

          public static IgniteBiFunction<Double,Double,Double> plusMult(double constant)

      Function that returns `a + b*constant`. `a` and `b` are variables, `constant` is fixed.
      Parameters:
        `constant` - Value to use in multiply.
      Returns:
        Function for this operation.

    - #### minusMult

          public static IgniteBiFunction<Double,Double,Double> minusMult(double constant)

      Function that returns `a - b*constant`. `a` and `b` are variables, `constant` is fixed.
      Parameters:
        `constant` - Value to use in multiply.
      Returns:
        Function for this operation.

    - #### constant

          public static IgniteDoubleFunction<Double> constant(Double c)

      Function that returns passed constant.

    - #### pow

          public static IgniteDoubleFunction<Double> pow(double b)

      Function that returns `Math.pow(a, b)`.
      Parameters:
        `b` - Power value.
      Returns:
        Function for given power.

    - #### curry

          public static <A,B,C> IgniteCurriedBiFunction<A,B,C> curry(BiFunction<A,B,C> f)

      Curry bi-function.
      Type Parameters:
        `A` - Type of first argument of `f`.
        `B` - Type of second argument of `f`.
        `C` - Return type of `f`.
      Parameters:
        `f` - Bi-function to curry.
      Returns:
        Curried bi-function.

    - #### curry

          public static <A,B,C> IgniteCurriedBiFunction<A,B,C> curry(IgniteBiFunction<A,B,C> f)

      Transform bi-function of the form (a, b) -> c into a function of form a -> (b -> c).
      Type Parameters:
        `A` - Type of first argument of function to be transformed.
        `B` - Type of second argument of function to be transformed.
        `C` - Type of third argument of function to be transformed.
      Parameters:
        `f` - Function to be curried.
      Returns:
        Curried bi-function.

    - #### curry

          public static <A,B,C,D> IgniteCurriedTriFunction<A,B,C,D> curry(IgniteTriFunction<A,B,C,D> f)

      Transform tri-function of the form (a, b, c) -> d into a function of form a -> (b -> (c -> d)).
      Type Parameters:
        `A` - Type of first argument of function to be transformed.
        `B` - Type of second argument of function to be transformed.
        `C` - Type of third argument of function to be transformed.
        `D` - Type output of function to be transformed.
      Parameters:
        `f` - Function to be curried.
      Returns:
        Curried tri-function.

    - #### outputSupplier

          public static <A,B> IgniteFunction<A,IgniteSupplier<B>> outputSupplier(IgniteFunction<A,B> f)

      Transform function of form a -> b into a -> (() -> b).
      Type Parameters:
        `A` - Type of input of function to be transformed.
        `B` - Type of output of function to be transformed.
      Parameters:
        `f` - Function to be transformed.
      Returns:
        Transformed function.

    - #### outputSupplier

          public static <A,B,C> IgniteBiFunction<A,B,IgniteSupplier<C>> outputSupplier(IgniteBiFunction<A,B,C> f)

      Transform function of form (a, b) -> c into (a, b) - () -> c.
      Type Parameters:
        `A` - Type of first argument of function to be transformed.
        `B` - Type of second argument of function to be transformed.
        `C` - Type of output of function to be transformed.
      Parameters:
        `f` - Function to be transformed.
      Returns:
        Transformed function.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022