# tf_agents.bandits.policies.linalg.update_inverse

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/policies/linalg.py#L163-L190) |

Updates the inverse using the Woodbury matrix identity.

    tf_agents.bandits.policies.linalg.update_inverse(
        a_inv: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float,
        x: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float
    ) -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float

Given a matrix `A` of size d-by-d and a matrix `X` of size k-by-d, this
function computes the inverse of B = A + X\^T X, assuming that the inverse of
A is available.

#### Reference:

<https://en.wikipedia.org/wiki/Woodbury_matrix_identity>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `a_inv` | a `Tensor` of shape \[`d`, `d`\]. This is the current inverse of `A`. |
| `x` | a `Tensor` of shape \[`k`, `d`\]. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The update that needs to be added to 'a_inv' to compute the inverse. If `x` is empty, a zero matrix is returned. ||

<br />