'Add the block to a slice of the matrix.
Args:
matrix: The matrix the block will be added to.
block: The matrix/scalar to be added.
vert_offset: The starting row for the matrix slice.
horiz_offset: The starting column for the matrix slice.
rows: The height of the block.
cols: The width of the block.
vert_step: The row step size for the matrix slice.
horiz_step: The column step size for the matrix slice.'

def block_add(self, matrix, block, vert_offset, horiz_offset, rows, cols, vert_step=1, horiz_step=1):

    import cvxopt
    if (isinstance(matrix, cvxopt.spmatrix) and isinstance(block, cvxopt.matrix)):
        block = cvxopt.sparse(block)
    matrix[vert_offset:(rows + vert_offset):vert_step, horiz_offset:(horiz_offset + cols):horiz_step] += block
