org.apache.sysds.runtime.matrix.operators

## Class ScalarOperator

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

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  LeftScalarOperator, RightScalarOperator

    public abstract class ScalarOperator
    extends Operator

Base class for all scalar operators.

See Also:
  Serialized Form

### Field Summary

Fields
`ValueFunction` `fn`

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

`sparseSafe`

### Constructor Summary

Constructors
Constructor and Description
`ScalarOperator(ValueFunction p, double cst)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract double` `executeScalar(double in)` Apply the scalar operator over a given input value.
`double` `getConstant()`
`int` `getNumThreads()`
`abstract ScalarOperator` `setConstant(double cst)`
`abstract ScalarOperator` `setConstant(double cst, int numThreads)`
`void` `setNumThreads(int k)`

### 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()

#### setNumThreads

    public void setNumThreads(int k)

#### getNumThreads

    public int getNumThreads()

#### 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