Package org.apache.sysds.runtime.matrix.operators

## Class ScalarOperator

- java.lang.Object
- - org.apache.sysds.runtime.matrix.operators.Operator
  - - org.apache.sysds.runtime.matrix.operators.MultiThreadedOperator
    - - org.apache.sysds.runtime.matrix.operators.ScalarOperator

- All Implemented Interfaces:
    `Serializable`
  Direct Known Subclasses:
    `LeftScalarOperator`, `RightScalarOperator`

      public abstract class ScalarOperator
      extends MultiThreadedOperator

  Base class for all scalar operators.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `ValueFunction` | `fn` |

    - ### Fields inherited from class org.apache.sysds.runtime.matrix.operators.Operator

      `sparseSafe`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ScalarOperator​(ValueFunction p, double cst)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract double` | `executeScalar​(double in)` | Apply the scalar operator over a given input value.
    `double` | `getConstant()` |
    `abstract ScalarOperator` | `setConstant​(double cst)` |
    `abstract ScalarOperator` | `setConstant​(double cst, int numThreads)` |

    - ### Methods inherited from class org.apache.sysds.runtime.matrix.operators.MultiThreadedOperator

      `getNumThreads, setNumThreads`

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

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

- - ### Field Detail

    - #### fn

          public final ValueFunction fn

  - ### Constructor Detail

    - #### ScalarOperator

          public ScalarOperator​(ValueFunction p,
                                double cst)

  - ### Method Detail

    - #### getConstant

          public double getConstant()

    - #### setConstant

          public abstract ScalarOperator setConstant​(double cst)

    - #### setConstant

          public abstract ScalarOperator setConstant​(double cst,
                                                     int numThreads)

    - #### executeScalar

          public abstract double executeScalar​(double in)

      Apply the scalar operator over a given input value.
      Parameters:
        `in` - input value
      Returns:
        result