tf.linalg.tridiagonal_matmul
Stay organized with collections
Save and categorize content based on your preferences.
Multiplies tridiagonal matrix by matrix.
tf.linalg.tridiagonal_matmul(
diagonals, rhs, diagonals_format='compact', name=None
)
diagonals
is representation of 3-diagonal NxN matrix, which depends on
diagonals_format
.
In matrix
format, diagonals
must be a tensor of shape [..., M, M]
, with
two inner-most dimensions representing the square tridiagonal matrices.
Elements outside of the three diagonals will be ignored.
If sequence
format, diagonals
is list or tuple of three tensors:
[superdiag, maindiag, subdiag]
, each having shape [..., M]. Last element
of superdiag
first element of subdiag
are ignored.
In compact
format the three diagonals are brought together into one tensor
of shape [..., 3, M]
, with last two dimensions containing superdiagonals,
diagonals, and subdiagonals, in order. Similarly to sequence
format,
elements diagonals[..., 0, M-1]
and diagonals[..., 2, 0]
are ignored.
The sequence
format is recommended as the one with the best performance.
rhs
is matrix to the right of multiplication. It has shape [..., M, N]
.
Example:
superdiag = tf.constant([-1, -1, 0], dtype=tf.float64)
maindiag = tf.constant([2, 2, 2], dtype=tf.float64)
subdiag = tf.constant([0, -1, -1], dtype=tf.float64)
diagonals = [superdiag, maindiag, subdiag]
rhs = tf.constant([[1, 1], [1, 1], [1, 1]], dtype=tf.float64)
x = tf.linalg.tridiagonal_matmul(diagonals, rhs, diagonals_format='sequence')
Args |
diagonals
|
A Tensor or tuple of Tensor s describing left-hand sides. The
shape depends of diagonals_format , see description above. Must be
float32 , float64 , complex64 , or complex128 .
|
rhs
|
A Tensor of shape [..., M, N] and with the same dtype as diagonals .
|
diagonals_format
|
one of sequence , or compact . Default is compact .
|
name
|
A name to give this Op (optional).
|
Returns |
A Tensor of shape [..., M, N] containing the result of multiplication.
|
Raises |
ValueError
|
An unsupported type is provided as input, or when the input
tensors have incorrect shapes.
|
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 2020-10-01 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 2020-10-01 UTC."],[],[],null,["# tf.linalg.tridiagonal_matmul\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/linalg/tridiagonal_matmul) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/linalg/linalg_impl.py#L549-L636) |\n\nMultiplies tridiagonal matrix by matrix.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.linalg.tridiagonal_matmul`](/api_docs/python/tf/linalg/tridiagonal_matmul)\n\n\u003cbr /\u003e\n\n tf.linalg.tridiagonal_matmul(\n diagonals, rhs, diagonals_format='compact', name=None\n )\n\n`diagonals` is representation of 3-diagonal NxN matrix, which depends on\n`diagonals_format`.\n\nIn `matrix` format, `diagonals` must be a tensor of shape `[..., M, M]`, with\ntwo inner-most dimensions representing the square tridiagonal matrices.\nElements outside of the three diagonals will be ignored.\n\nIf `sequence` format, `diagonals` is list or tuple of three tensors:\n`[superdiag, maindiag, subdiag]`, each having shape \\[..., M\\]. Last element\nof `superdiag` first element of `subdiag` are ignored.\n\nIn `compact` format the three diagonals are brought together into one tensor\nof shape `[..., 3, M]`, with last two dimensions containing superdiagonals,\ndiagonals, and subdiagonals, in order. Similarly to `sequence` format,\nelements `diagonals[..., 0, M-1]` and `diagonals[..., 2, 0]` are ignored.\n\nThe `sequence` format is recommended as the one with the best performance.\n\n`rhs` is matrix to the right of multiplication. It has shape `[..., M, N]`.\n\n#### Example:\n\n superdiag = tf.constant([-1, -1, 0], dtype=tf.float64)\n maindiag = tf.constant([2, 2, 2], dtype=tf.float64)\n subdiag = tf.constant([0, -1, -1], dtype=tf.float64)\n diagonals = [superdiag, maindiag, subdiag]\n rhs = tf.constant([[1, 1], [1, 1], [1, 1]], dtype=tf.float64)\n x = tf.linalg.tridiagonal_matmul(diagonals, rhs, diagonals_format='sequence')\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `diagonals` | A `Tensor` or tuple of `Tensor`s describing left-hand sides. The shape depends of `diagonals_format`, see description above. Must be `float32`, `float64`, `complex64`, or `complex128`. |\n| `rhs` | A `Tensor` of shape \\[..., M, N\\] and with the same dtype as `diagonals`. |\n| `diagonals_format` | one of `sequence`, or `compact`. Default is `compact`. |\n| `name` | A name to give this `Op` (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of shape \\[..., M, N\\] containing the result of multiplication. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|--------------------------------------------------------------------------------------------|\n| `ValueError` | An unsupported type is provided as input, or when the input tensors have incorrect shapes. |\n\n\u003cbr /\u003e"]]