Class BinaryOperator

  • All Implemented Interfaces:
    Serializable

    public class BinaryOperator
    extends MultiThreadedOperator
    BinaryOperator class for operations that have two inputs. For instance
    BinaryOperator op = new BinaryOperator(Plus.getPlusFnObject());
    double r = op.execute(5.0, 8.2)
     
    See Also:
    Serialized Form
    • Field Detail

      • commutative

        public final boolean commutative
    • Constructor Detail

      • BinaryOperator

        public BinaryOperator​(ValueFunction p,
                              int k)
    • Method Detail

      • getBinaryOperatorOpOp2

        public Types.OpOp2 getBinaryOperatorOpOp2()
        Method for getting the hop binary operator type for a given function object. This is used in order to use a common code path for consistency between compiler and runtime.
        Returns:
        binary operator type for a function object
      • isCommutative

        public boolean isCommutative()
      • isRowSafeLeft

        public boolean isRowSafeLeft​(double[] row)
        Check if the operation returns zeros if the input zero.
        Parameters:
        row - The values to check
        Returns:
        If the output is always zero if other value is zero
      • isRowSafeLeft

        public boolean isRowSafeLeft​(MatrixBlock row)
        Check if the operation returns zeros if the input zero.
        Parameters:
        row - The values to check
        Returns:
        If the output is always zero if other value is zero
      • isIntroducingZerosLeft

        public boolean isIntroducingZerosLeft​(MatrixBlock row)
        Check if the operation returns zeros if the input is contained in row.
        Parameters:
        row - The values to check
        Returns:
        If the output contains zeros
      • isIntroducingZerosLeft

        public boolean isIntroducingZerosLeft​(double[] row)
        Check if the operation returns zeros if the input is contained in row.
        Parameters:
        row - The values to check
        Returns:
        If the output contains zeros
      • isRowSafeRight

        public boolean isRowSafeRight​(double[] row)
        Check if the operation returns zeros if the input zero.
        Parameters:
        row - The values to check
        Returns:
        If the output is always zero if other value is zero
      • isRowSafeRight

        public boolean isRowSafeRight​(MatrixBlock row)
        Check if the operation returns zeros if the input zero.
        Parameters:
        row - The values to check
        Returns:
        If the output is always zero if other value is zero
      • isIntroducingZerosRight

        public boolean isIntroducingZerosRight​(MatrixBlock row)
        Check if the operation returns zeros if the input is contained in row.
        Parameters:
        row - The values to check
        Returns:
        If the output contains zeros
      • isIntroducingZerosRight

        public boolean isIntroducingZerosRight​(double[] row)
        Check if the operation returns zeros if the input is contained in row.
        Parameters:
        row - The values to check
        Returns:
        If the output contains zeros