fn

adjoint

Tensor
adjoint(x: Tensor)
source

Conjugate (Hermitian) transpose of the trailing two dimensions.

For real-valued tensors this is identical to a plain transpose of the last two axes. For complex tensors (when supported), the entries are additionally conjugated, yielding the Hermitian transpose A=ATA^{*} = \overline{A^{T}}.

Parameters

xTensor
Input tensor with at least 2 dimensions.

Returns

Tensor

Tensor with the last two axes swapped (and complex conjugated when applicable).

Raises

ValueError
If x.ndim < 2.

Notes

Mathematical definition:

A=AT.\mathbf{A}^{*} = \overline{\mathbf{A}^{T}}.

For real inputs the conjugation step is a no-op, so this is simply a permutation of the last two axes. Batch dimensions are preserved.

Examples

>>> import lucid
>>> A = lucid.tensor([[1., 2., 3.], [4., 5., 6.]])
>>> lucid.adjoint(A)
Tensor([[1., 4.],
        [2., 5.],
        [3., 6.]])