r""" This function computes the inverse of the design matrix in the \ regularization path using the Schur complement. Two cases may arise: Case 1: one variable is added to the active set .. math:: M_{k+1}^{-1} = \begin{bmatrix} M_{k}^{-1} + s^{-1} M_{k}^{-1
(M_current, b, d, id_pop)
| 404 | |
| 405 | |
| 406 | def complement_schur(M_current, b, d, id_pop): |
| 407 | r""" This function computes the inverse of the design matrix in the \ |
| 408 | regularization path using the Schur complement. Two cases may arise: |
| 409 | |
| 410 | Case 1: one variable is added to the active set |
| 411 | |
| 412 | |
| 413 | .. math:: |
| 414 | M_{k+1}^{-1} = |
| 415 | \begin{bmatrix} |
| 416 | M_{k}^{-1} + s^{-1} M_{k}^{-1} \mathbf{b} \mathbf{b}^T M_{k}^{-1} \ |
| 417 | & - M_{k}^{-1} \mathbf{b} s^{-1} \\ |
| 418 | - s^{-1} \mathbf{b}^T M_{k}^{-1} & s^{-1} |
| 419 | \end{bmatrix} |
| 420 | |
| 421 | |
| 422 | where : |
| 423 | |
| 424 | - :math:`M_k^{-1}` is the inverse of the design matrix :math:`H_A^tH_A` \ |
| 425 | of the previous iteration |
| 426 | - :math:`\mathbf{b}` is the last column of :math:`M_{k}` |
| 427 | - :math:`s` is the Schur complement, given by \ |
| 428 | :math:`s = \mathbf{d} - \mathbf{b}^T M_{k}^{-1} \mathbf{b}` |
| 429 | |
| 430 | Case 2: one variable is removed from the active set. |
| 431 | |
| 432 | .. math:: |
| 433 | M_{k+1}^{-1} = M^{-1}_{k \backslash q} - |
| 434 | \frac{r_{-q,q} r^{T}_{-q,q}}{r_{q,q}} |
| 435 | |
| 436 | where : |
| 437 | |
| 438 | - :math:`q` is the index of column and row to delete |
| 439 | - :math:`M^{-1}_{k \backslash q}` is the previous inverse matrix deprived \ |
| 440 | of the :math:`q` th column and :math:`q` th row |
| 441 | - :math:`r_{-q,q}` is the :math:`q` th column of :math:`M^{-1}_{k}` \ |
| 442 | without the :math:`q` th element |
| 443 | - :math:`r_{q, q}` is the element of :math:`q` th column and :math:`q` th \ |
| 444 | row in :math:`M^{-1}_{k}` |
| 445 | |
| 446 | |
| 447 | Parameters |
| 448 | ---------- |
| 449 | M_current : ndarray, shape (size(A)-1, size(A)-1) |
| 450 | Inverse matrix of :math:`H_A^tH_A` at the previous iteration, with \ |
| 451 | size(A) the size of the active set |
| 452 | b : ndarray, shape (size(A)-1, ) |
| 453 | None for case 2 (removal), last column of :math:`M_{k}` for case 1 \ |
| 454 | (addition) |
| 455 | d : float |
| 456 | should be equal to 2 when UOT and 1 for the semi-relaxed OT |
| 457 | id_pop : int |
| 458 | Index of the variable to be removed, equal to -1 |
| 459 | if no variable is deleted at the current iteration |
| 460 | |
| 461 | |
| 462 | Returns |
| 463 | ------- |
no test coverage detected