tfp.substrates.jax.math.fill_triangular_inverse
Stay organized with collections
Save and categorize content based on your preferences.
Creates a vector from a (batch of) triangular matrix.
tfp.substrates.jax.math.fill_triangular_inverse(
x, upper=False, name=None
)
The vector is created from the lower-triangular or upper-triangular portion
depending on the value of the parameter upper
.
If x.shape
is [b1, b2, ..., bB, n, n]
then the output shape is
[b1, b2, ..., bB, d]
where d = n (n + 1) / 2
.
Example:
fill_triangular_inverse(
[[4, 0, 0],
[6, 5, 0],
[3, 2, 1]])
# ==> [1, 2, 3, 4, 5, 6]
fill_triangular_inverse(
[[1, 2, 3],
[0, 5, 6],
[0, 0, 4]], upper=True)
# ==> [1, 2, 3, 4, 5, 6]
Args |
x
|
Tensor representing lower (or upper) triangular elements.
|
upper
|
Python bool representing whether output matrix should be upper
triangular (True ) or lower triangular (False , default).
|
name
|
Python str . The name to give this op.
|
Returns |
flat_tril
|
(Batch of) vector-shaped Tensor representing vectorized lower
(or upper) triangular elements from x .
|
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.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.substrates.jax.math.fill_triangular_inverse\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/substrates/jax/math/linalg.py#L1075-L1141) |\n\nCreates a vector from a (batch of) triangular matrix.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfp.experimental.substrates.jax.math.fill_triangular_inverse`](https://www.tensorflow.org/probability/api_docs/python/tfp/substrates/jax/math/fill_triangular_inverse)\n\n\u003cbr /\u003e\n\n tfp.substrates.jax.math.fill_triangular_inverse(\n x, upper=False, name=None\n )\n\nThe vector is created from the lower-triangular or upper-triangular portion\ndepending on the value of the parameter `upper`.\n\nIf `x.shape` is `[b1, b2, ..., bB, n, n]` then the output shape is\n`[b1, b2, ..., bB, d]` where `d = n (n + 1) / 2`.\n\n#### Example:\n\n fill_triangular_inverse(\n [[4, 0, 0],\n [6, 5, 0],\n [3, 2, 1]])\n\n # ==\u003e [1, 2, 3, 4, 5, 6]\n\n fill_triangular_inverse(\n [[1, 2, 3],\n [0, 5, 6],\n [0, 0, 4]], upper=True)\n\n # ==\u003e [1, 2, 3, 4, 5, 6]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|------------------------------------------------------------------------------------------------------------------------------|\n| `x` | `Tensor` representing lower (or upper) triangular elements. |\n| `upper` | Python `bool` representing whether output matrix should be upper triangular (`True`) or lower triangular (`False`, default). |\n| `name` | Python `str`. The name to give this op. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-------------|----------------------------------------------------------------------------------------------------------|\n| `flat_tril` | (Batch of) vector-shaped `Tensor` representing vectorized lower (or upper) triangular elements from `x`. |\n\n\u003cbr /\u003e"]]