Hi Arna (and Richard)!



 Arna_Ghosh:

You figure out the eigenvalues of A


Note that A is not square in this case.


you can calculate something like Gram-Schmidt process.


Probably the most numerically satisfactory way to do this is to
compute the singular-value decomposition of A  with torch.linalg.svd():
>>> import torch
>>> torch.__version__
'1.9.0'
>>> _ = torch.manual_seed (2021)
>>> vectors = torch.randn (4, 5)
>>> vectors
tensor([[-0.1452,  0.9747,  0.6023,  1.5775,  0.7978],
        [-0.4101, -1.2622, -0.3932,  0.4675, -0.2879],
        [-0.0742,  0.1680,  1.6226,  0.7453, -2.9535],
        [-1.1143, -0.8463, -0.0393, -1.9088, -0.3105]])
>>> perpendicular_vector = torch.linalg.svd (vectors).Vh[4]
>>> perpendicular_vector
tensor([ 0.4183, -0.4666,  0.7019, -0.1041,  0.3222])
>>> vectors @ perpendicular_vector
tensor([-2.9802e-08, -8.9407e-08, -2.3842e-07, -8.9407e-08])

Note that if A (vectors) is degenerate (that is, that some linear
combination of its rows is zero), then perpendicular_vector
will no longer be (in essence) unique.  In such a case A will have
a multi-dimensional null space (sometimes calls its kernel), and
any vector lying in A’s null space will be (by definition) perpendicular
to A’s rows.
Best.
K. Frank