예제 #1
0
    def get_index(matrix, constraints, row, col):
        """Returns a canonicalized index into a matrix.

        Parameters
        ----------
        matrix : LinOp
            The matrix to be indexed.
        constraints : list
            A list of constraints to append to.
        row : int
            The row index.
        col : int
            The column index.
        """
        key = (ku.index_to_slice(row), ku.index_to_slice(col))
        idx, idx_constr = index.graph_implementation([matrix], (1, 1), [key])
        constraints += idx_constr
        return idx
예제 #2
0
파일: index.py 프로젝트: ThomasLipp/cvxpy
    def get_index(matrix, constraints, row, col):
        """Returns a canonicalized index into a matrix.

        Parameters
        ----------
        matrix : LinOp
            The matrix to be indexed.
        constraints : list
            A list of constraints to append to.
        row : int
            The row index.
        col : int
            The column index.
        """
        key = (ku.index_to_slice(row), ku.index_to_slice(col))
        idx, idx_constr = index.graph_implementation([matrix], (1, 1), key)
        constraints += idx_constr
        return idx