Exemple #1
0
    def graph_implementation(arg_objs, size, data=None):
        """Multiply the expressions elementwise.

        Parameters
        ----------
        arg_objs : list
            LinExpr for each argument.
        size : tuple
            The size of the resulting expression.
        data :
            Additional data required by the atom.

        Returns
        -------
        tuple
            (LinOp for objective, list of constraints)
        """
        # One of the arguments is a scalar, so we can use normal multiplication.
        if arg_objs[0].size != arg_objs[1].size:
            return (lu.mul_expr(arg_objs[0], arg_objs[1], size), [])
        else:
            return (lu.mul_elemwise(arg_objs[0], arg_objs[1]), [])
Exemple #2
0
    def graph_implementation(arg_objs, size, data=None):
        """Multiply the expressions elementwise.

        Parameters
        ----------
        arg_objs : list
            LinExpr for each argument.
        size : tuple
            The size of the resulting expression.
        data :
            Additional data required by the atom.

        Returns
        -------
        tuple
            (LinOp for objective, list of constraints)
        """
        # One of the arguments is a scalar, so we can use normal multiplication.
        if arg_objs[0].size != arg_objs[1].size:
            return (lu.mul_expr(arg_objs[0], arg_objs[1], size), [])
        else:
            return (lu.mul_elemwise(arg_objs[0], arg_objs[1]), [])
Exemple #3
0
    def graph_implementation(arg_objs, size, data=None):
        """Multiply the expressions elementwise.

        Parameters
        ----------
        arg_objs : list
            LinExpr for each argument.
        size : tuple
            The size of the resulting expression.
        data :
            Additional data required by the atom.

        Returns
        -------
        tuple
            (LinOp for objective, list of constraints)
        """
        # Promote arguments if necessary.
        for i, arg in enumerate(arg_objs):
            if arg.size != size:
                arg_objs[i] = lu.promote(arg, size)

        return (lu.mul_elemwise(arg_objs[0], arg_objs[1]), [])
Exemple #4
0
    def graph_implementation(arg_objs, size, data=None):
        """Multiply the expressions elementwise.

        Parameters
        ----------
        arg_objs : list
            LinExpr for each argument.
        size : tuple
            The size of the resulting expression.
        data :
            Additional data required by the atom.

        Returns
        -------
        tuple
            (LinOp for objective, list of constraints)
        """
        # Promote arguments if necessary.
        for i, arg in enumerate(arg_objs):
            if arg.size != size:
                arg_objs[i] = lu.promote(arg, size)

        return (lu.mul_elemwise(arg_objs[0], arg_objs[1]), [])