Package org.apache.sysds.runtime.functionobjects

# Class KahanPlusSq

java.lang.Object
org.apache.sysds.runtime.functionobjects.FunctionObject
org.apache.sysds.runtime.functionobjects.ValueFunction
org.apache.sysds.runtime.functionobjects.KahanFunction
org.apache.sysds.runtime.functionobjects.KahanPlusSq

All Implemented Interfaces:
  `Serializable`

public class KahanPlusSq extends KahanFunction
Runtime function to perform the summation of squared values using the Kahan summation algorithm.

See Also:
  - Serialized Form

## Method Summary

Modifier and Type
Method
Description
`Data`
`execute(Data kObj, double in)`
Square the given term, then add to the existing sum using the Kahan summation algorithm.
`Data`
`execute(Data kObj, double sum, double corr)`
Add the given sum and correction factor to the existing sum in the KahanObject using the Kahan summation algorithm.
`void`
`execute2(KahanObject kObj, double in)`
Add the given term to the existing sum with a function applied using the Kahan summation algorithm.
`void`
`execute3(KahanObject kObj, double in, int count)`
`static KahanPlusSq`
`getKahanPlusSqFnObject()`
Get the KahanPlusSq singleton object.

### Methods inherited from class org.apache.sysds.runtime.functionobjects.KahanFunction

`requiresCorrection`

### Methods inherited from class org.apache.sysds.runtime.functionobjects.ValueFunction

`isBinary, toString`

### Methods inherited from class org.apache.sysds.runtime.functionobjects.FunctionObject

`clone, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute`

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

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

## Method Details

### getKahanPlusSqFnObject

public static KahanPlusSq getKahanPlusSqFnObject()
Get the KahanPlusSq singleton object.

Returns:
  KahanPlusSq singleton object

### execute

public Data execute(Data kObj, double in)
Square the given term, then add to the existing sum using the Kahan summation algorithm.

Overrides:
  `execute` in class `FunctionObject`
Parameters:
  `kObj` - A KahanObject supplied as a Data type containing the current sum and correction factor for the Kahan summation algorithm.
  `in` - The current term to be squared and added.

### execute

public Data execute(Data kObj, double sum, double corr)
Add the given sum and correction factor to the existing sum in the KahanObject using the Kahan summation algorithm.

Overrides:
  `execute` in class `FunctionObject`
Parameters:
  `kObj` - A KahanObject supplied as a Data type containing the current sum and correction factor for the Kahan summation algorithm.
  `sum` - The current sum.
  `corr` - The current correction factor.

### execute2

public void execute2(KahanObject kObj, double in)
Description copied from class: `KahanFunction`
Add the given term to the existing sum with a function applied using the Kahan summation algorithm.

Specified by:
  `execute2` in class `KahanFunction`
Parameters:
  `kObj` - A KahanObject containing the current sum and correction factor for the Kahan summation algorithm.
  `in` - The current term to be added.

### execute3

public void execute3(KahanObject kObj, double in, int count)

Specified by:
  `execute3` in class `KahanFunction`