tfp.experimental.distributions.marginal_fns.retrying_cholesky
Stay organized with collections
Save and categorize content based on your preferences.
Computes a modified Cholesky decomposition for a batch of square matrices.
tfp.experimental.distributions.marginal_fns.retrying_cholesky(
matrix,
jitter=None,
max_iters=5,
unroll=1,
name='retrying_cholesky'
)
Given a symmetric matrix A
, this function attempts to give a factorization
A + E = LL^T
where L
is lower triangular, LL^T
is positive definite, and
E
is small in some suitable sense. This is useful for nearly positive
definite symmetric matrices that are otherwise numerically difficult to
Cholesky factor.
In particular, this function first attempts a Cholesky decomposition of
the input matrix. If that decomposition fails, exponentially-increasing
diagonal jitter is added to the matrix until either a Cholesky decomposition
succeeds or until the maximum specified number of iterations is reached.
This function is similar in spirit to a true modified Cholesky factorization
([1], [2]). However, it does not use pivoting or other strategies to ensure
stability, so may not work well for e.g. ill-conditioned matrices. Further,
this function may perform multiple Cholesky factorizations, while a true
modified Cholesky can be done with only slightly more work than a single
decomposition.
References
[1]: Nicholas Higham. What is a modified Cholesky factorization?
https://nhigham.com/2020/12/22/what-is-a-modified-cholesky-factorization/
[2]: Sheung Hun Cheng and Nicholas Higham, A Modified Cholesky Algorithm Based
on a Symmetric Indefinite Factorization, SIAM J. Matrix Anal. Appl. 19(4),
1097–1110, 1998.
Args |
matrix
|
A batch of symmetric square matrices, with shape [..., n, n] .
|
jitter
|
Initial jitter to add to the diagonal. Default: 1e-6, unless
matrix.dtype is float64, in which case the default is 1e-10.
|
max_iters
|
Maximum number of times to retry the Cholesky decomposition
with larger diagonal jitter. Default: 5.
|
unroll
|
If specified, unroll >1 iterations per while_loop step. This can be
advantageous on GPU, to avoid host roundtripping.
|
name
|
Python str name prefixed to Ops created by this function.
Default value: 'retrying_cholesky'.
|
Returns |
triangular_factor
|
A Tensor with shape [..., n, n] . The lower triangular
Cholesky factor, modified as above. If the Cholesky decomposition failed
for a batch member, then all lower triangular entries returned for that
batch member will be NaN.
|
diagonal_shift
|
A tensor of shape [...] . diag_shift[i] is the value
added to the diagonal of matrix[i] in computing triangular_factor[i] .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.experimental.distributions.marginal_fns.retrying_cholesky\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/distributions/marginal_fns.py#L221-L276) |\n\nComputes a modified Cholesky decomposition for a batch of square matrices. \n\n tfp.experimental.distributions.marginal_fns.retrying_cholesky(\n matrix,\n jitter=None,\n max_iters=5,\n unroll=1,\n name='retrying_cholesky'\n )\n\nGiven a symmetric matrix `A`, this function attempts to give a factorization\n`A + E = LL^T` where `L` is lower triangular, `LL^T` is positive definite, and\n`E` is small in some suitable sense. This is useful for nearly positive\ndefinite symmetric matrices that are otherwise numerically difficult to\nCholesky factor.\n\nIn particular, this function first attempts a Cholesky decomposition of\nthe input matrix. If that decomposition fails, exponentially-increasing\ndiagonal jitter is added to the matrix until either a Cholesky decomposition\nsucceeds or until the maximum specified number of iterations is reached.\n\nThis function is similar in spirit to a true modified Cholesky factorization\n(\\[1\\], \\[2\\]). However, it does not use pivoting or other strategies to ensure\nstability, so may not work well for e.g. ill-conditioned matrices. Further,\nthis function may perform multiple Cholesky factorizations, while a true\nmodified Cholesky can be done with only slightly more work than a single\ndecomposition.\n\n#### References\n\n\\[1\\]: Nicholas Higham. What is a modified Cholesky factorization?\n\u003chttps://nhigham.com/2020/12/22/what-is-a-modified-cholesky-factorization/\u003e\n\n\\[2\\]: Sheung Hun Cheng and Nicholas Higham, A Modified Cholesky Algorithm Based\non a Symmetric Indefinite Factorization, SIAM J. Matrix Anal. Appl. 19(4),\n1097--1110, 1998.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------|\n| `matrix` | A batch of symmetric square matrices, with shape `[..., n, n]`. |\n| `jitter` | Initial jitter to add to the diagonal. Default: 1e-6, unless `matrix.dtype` is float64, in which case the default is 1e-10. |\n| `max_iters` | Maximum number of times to retry the Cholesky decomposition with larger diagonal jitter. Default: 5. |\n| `unroll` | If specified, unroll \\\u003e1 iterations per while_loop step. This can be advantageous on GPU, to avoid host roundtripping. |\n| `name` | Python `str` name prefixed to Ops created by this function. Default value: 'retrying_cholesky'. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `triangular_factor` | A Tensor with shape `[..., n, n]`. The lower triangular Cholesky factor, modified as above. If the Cholesky decomposition failed for a batch member, then all lower triangular entries returned for that batch member will be NaN. |\n| `diagonal_shift` | A tensor of shape `[...]`. `diag_shift[i]` is the value added to the diagonal of `matrix[i]` in computing `triangular_factor[i]`. |\n\n\u003cbr /\u003e"]]