|TensorFlow 1 version||View source on GitHub|
Multiplies tridiagonal matrix by matrix.
Compat aliases for migration
See Migration guide for more details.
tf.linalg.tridiagonal_matmul( diagonals, rhs, diagonals_format='compact', name=None )
diagonals is representation of 3-diagonal NxN matrix, which depends on
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.
diagonals is list or tuple of three tensors:
[superdiag, maindiag, subdiag], each having shape [..., M]. Last element
superdiag first element of
subdiag are ignored.
compact format the three diagonals are brought together into one tensor
[..., 3, M], with last two dimensions containing superdiagonals,
diagonals, and subdiagonals, in order. Similarly to
diagonals[..., 0, M-1] and
diagonals[..., 2, 0] are ignored.
sequence format is recommended as the one with the best performance.
rhs is matrix to the right of multiplication. It has shape
[..., M, N].
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')
Tensoror tuple of
Tensors describing left-hand sides. The shape depends of
diagonals_format, see description above. Must be
Tensorof shape [..., M, N] and with the same dtype as
diagonals_format: one of
compact. Default is
name: A name to give this
Tensor of shape [..., M, N] containing the result of multiplication.
ValueError: An unsupported type is provided as input, or when the input tensors have incorrect shapes.