Calculating upto more decimal places by "linalg.eigh"

A = torch.randn(2, 2, dtype=torch.complex128)
A = A + A.T.conj() # creates a Hermitian matrix
A
L, Q = torch.linalg.eigh(A)
L

The above code gives the eigenvalues and elements of eigenvectors up to 4 decimal places. How to get more decimal places? Please help.

Hi Panka!

By default, to save screen space, pytorch only displays tensors with four digits.
Try .item() or torch.set_printoptions():

>>> import torch
>>> torch.__version__
'1.13.1'
>>> _= torch.manual_seed (2023)
>>> A = torch.randn(2, 2, dtype=torch.complex128)
>>> A = A + A.T.conj() # creates a Hermitian matrix
>>> A
tensor([[-1.7077+0.0000j, -0.7976+0.3775j],
        [-0.7976-0.3775j,  0.1020+0.0000j]], dtype=torch.complex128)
>>> L, Q = torch.linalg.eigh(A)
>>> L
tensor([-2.0667,  0.4610], dtype=torch.float64)
>>> L[0].item()
-2.0667332207652334
>>> torch.set_printoptions (precision = 15)
>>> L
tensor([-2.066733220765233,  0.461039667016129], dtype=torch.float64)

Best.

K. Frank