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
`final 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

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 Details

### fn

public final ValueFunction fn

## Constructor Details

### ScalarOperator

public ScalarOperator(ValueFunction p, double cst)

## Method Details

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