Consider the following matrix:

```
M = 1/4 * matrix([(0, 0, -(I + 1)*sqrt(2), -(I + 1)*sqrt(2), (I + 1)*sqrt(2), (I + 1)*sqrt(2)),
(0, 0, -(I - 1)*sqrt(2), (I - 1)*sqrt(2), (I - 1)*sqrt(2), -(I - 1)*sqrt(2)),
((I - 1)*sqrt(2), (I - 1)*sqrt(2), I - 1, I - 1, I - 1, I - 1),
(-(I + 1)*sqrt(2), (I + 1)*sqrt(2), -I - 1, I + 1, -I - 1, I + 1),
((I - 1)*sqrt(2), (I - 1)*sqrt(2), -I + 1, -I + 1, -I + 1, -I + 1),
(-(I + 1)*sqrt(2), (I + 1)*sqrt(2), I + 1, -I - 1, I + 1, -I - 1)])
```

The matrix `M`

is diagonalizable. Indeed, let `z = exp(i*pi/3)`

; then `M`

is similar to `J = diagonal_matrix([ -1, -1, z, z, z.conjugate(), z.conjugate() ])`

. For example, one can use `matrix(QQbar, M).is_similar(matrix(QQbar, J))`

to obtain a similarity transformation. We must embed M (implicitly defined over SR) into QQbar to have exactness to perform the similarity computation. Indeed, both `M.is_similar(J)`

and `M.diagonalization()`

raise respectively `TypeError`

and `ValueError`

as expected. Since `M`

is diagonalizable, the diagonalization agrees (up to permutation) with the Jordan form `matrix(QQbar, M).jordan_form()`

as expected.

In SageMath version 10.4.beta3 as well as 9.5 I can also run `M.jordan_form()`

with no errors thrown; the answer agrees with `matrix(QQbar, M).jordan_form()`

. However, `matrix(QQbar, M).jordan_form(transformation=True)`

and `M.jordan_form(transformation=True)`

do not agree; the latter produces a transformation matrix that is not invertible!

The documentation for Matrix_symbolic_dense.jordan_form suggests that matrices over SR support Jordan form with the transformation flag set to true--why in this case does Sage appear to produce a non-invertible transformation matrix for a correctly computed Jordan form? Or should I in general be converting away from SR to perform similarity transformations in Sage?