Package org.apache.sysds.parser

## Class FunctionStatementBlock

- java.lang.Object
- - org.apache.sysds.parser.LiveVariableAnalysis
  - - org.apache.sysds.parser.StatementBlock
    - - org.apache.sysds.parser.FunctionStatementBlock

- All Implemented Interfaces:
    `Types.FunctionBlock`, `ParseInfo`

      public class FunctionStatementBlock
      extends StatementBlock
      implements Types.FunctionBlock

- - ### Field Summary

    - ### Fields inherited from class org.apache.sysds.parser.StatementBlock

      `DEFAULT_LOOP_REPETITIONS`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FunctionStatementBlock()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `VariableSet` | `analyze​(VariableSet loPassed)` |
    `VariableSet` | `analyze​(VariableSet liPassed, VariableSet loPassed)` |
    `Types.FunctionBlock` | `cloneFunctionBlock()` |
    `FunctionOp.FunctionType` | `getFunctionOpType()` |
    `VariableSet` | `initializebackwardLV​(VariableSet loPassed)` |
    `VariableSet` | `initializeforwardLV​(VariableSet activeInPassed)` | For each statement: gen rule: for each variable read in current statement but not updated in any PRIOR statement, add to gen Handles case where variable both read and updated in same statement (i = i + 1, i needs to be added to gen) kill rule: for each variable updated in current statement but not read in this or any PRIOR statement, add to kill.
    `boolean` | `isNondeterministic()` |
    `boolean` | `isRecompileOnce()` |
    `void` | `setNondeterministic​(boolean flag)` |
    `void` | `setRecompileOnce​(boolean flag)` |
    `void` | `updateRepetitionEstimates​(double repetitions)` | Updates the repetition estimate for this statement block and all contained hops.
    `VariableSet` | `validate​(DMLProgram dmlProg, VariableSet ids, HashMap<String,​ConstIdentifier> constVars, boolean conditional)` | TODO: DRB: This needs to be changed to reflect: 1) Default values for variables -- need to add R styled check here to make sure that once vars with default values start, they keep going to the right 2) The other parameters for External Functions

    - ### Methods inherited from class org.apache.sysds.parser.StatementBlock

      `addStatement, addStatementBlock, getBeginColumn, getBeginLine, getConstIn, getConstOut, getDMLProg, getEndColumn, getEndLine, getFilename, getHops, getInputstoSB, getLops, getName, getNumStatements, getOutputNamesofSB, getOutputsofSB, getSBID, getStatement, getStatements, getText, getUpdateInPlaceVars, hasHops, isMergeableFunctionCallBlock, isRewritableFunctionCall, isSplitDag, mergeable, mergeFunctionCalls, mergeStatementBlocks, printBlockErrorLocation, printErrorLocation, printWarningLocation, raiseValidateError, raiseValidateError, requiresRecompilation, rewriteFunctionCallStatements, rHoistFunctionCallsFromExpressions, rHoistFunctionCallsFromExpressions, rHoistFunctionCallsFromExpressions, setBeginColumn, setBeginLine, setDMLProg, setEndColumn, setEndLine, setFilename, setHops, setLops, setParseInfo, setSplitDag, setStatementFormatType, setStatementFormatType, setStatements, setText, setUpdateInPlaceVars, toString, updateRecompilationFlag`

    - ### Methods inherited from class org.apache.sysds.parser.LiveVariableAnalysis

      `getGen, getKill, getWarn, liveIn, liveOut, setGen, setKill, setLiveIn, setLiveOut, setReadVariables, setUpdatedVariables, updateLiveVariablesOut, variablesRead, variablesUpdated`

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

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

- - ### Constructor Detail

    - #### FunctionStatementBlock

          public FunctionStatementBlock()

  - ### Method Detail

    - #### validate

          public VariableSet validate​(DMLProgram dmlProg,
                                      VariableSet ids,
                                      HashMap<String,​ConstIdentifier> constVars,
                                      boolean conditional)

      TODO: DRB: This needs to be changed to reflect: 1) Default values for variables -- need to add R styled check here to make sure that once vars with default values start, they keep going to the right 2) The other parameters for External Functions
      Overrides:
        `validate` in class `StatementBlock`

    - #### getFunctionOpType

          public FunctionOp.FunctionType getFunctionOpType()

    - #### initializeforwardLV

          public VariableSet initializeforwardLV​(VariableSet activeInPassed)

      Description copied from class: `StatementBlock`
      For each statement: gen rule: for each variable read in current statement but not updated in any PRIOR statement, add to gen Handles case where variable both read and updated in same statement (i = i + 1, i needs to be added to gen) kill rule: for each variable updated in current statement but not read in this or any PRIOR statement, add to kill.
      Overrides:
        `initializeforwardLV` in class `StatementBlock`

    - #### initializebackwardLV

          public VariableSet initializebackwardLV​(VariableSet loPassed)

      Overrides:
        `initializebackwardLV` in class `StatementBlock`

    - #### analyze

          public VariableSet analyze​(VariableSet loPassed)

      Overrides:
        `analyze` in class `StatementBlock`

    - #### analyze

          public VariableSet analyze​(VariableSet liPassed,
                                     VariableSet loPassed)

    - #### setRecompileOnce

          public void setRecompileOnce​(boolean flag)

    - #### isRecompileOnce

          public boolean isRecompileOnce()

    - #### setNondeterministic

          public void setNondeterministic​(boolean flag)

      Overrides:
        `setNondeterministic` in class `StatementBlock`

    - #### isNondeterministic

          public boolean isNondeterministic()

      Overrides:
        `isNondeterministic` in class `StatementBlock`

    - #### cloneFunctionBlock

          public Types.FunctionBlock cloneFunctionBlock()

      Specified by:
        `cloneFunctionBlock` in interface `Types.FunctionBlock`

    - #### updateRepetitionEstimates

          public void updateRepetitionEstimates​(double repetitions)

      Description copied from class: `StatementBlock`
      Updates the repetition estimate for this statement block and all contained hops. FunctionStatementBlocks are loaded from the function dictionary and repetitions are estimated for the contained statement blocks. This method is overridden in the subclasses of StatementBlock.
      Overrides:
        `updateRepetitionEstimates` in class `StatementBlock`
      Parameters:
        `repetitions` - estimated for this statement block