Hi John!



 John_Price:

so you mean, that it I have given a symmetric positive definite covariance, I could also write:
torch.exp(-(torch.cholesky_solve(covariance, x_m).T.dot(x_m)))


Basically, but torch.cholesky_solve() takes the Cholesky factor matrix,
so you have to do it in two steps.
Here is an illustrative script:
import torch
torch.__version__

_ = torch.random.manual_seed (2020)

ma = torch.randn ((5, 5))
mspd = ma @ ma.T                           # make an SPD matrix
v = torch.randn ((5, 1))                   # make a vector
solveA = torch.solve (v, mspd)[0]          # solve direct
mcho = torch.cholesky (mspd)               # Cholesky factorization
solveB = torch.cholesky_solve (v, mcho)    # solve with Cholesky factorization
print ('solveA =', solveA)
print ('solveB =', solveB)
print ('solveA - solveB =', solveA - solveB)

And here is its output:
>>> import torch
>>> torch.__version__
'1.6.0'
>>> _ = torch.random.manual_seed (2020)
>>> ma = torch.randn ((5, 5))
>>> mspd = ma @ ma.T                           # make an SPD matrix
>>> v = torch.randn ((5, 1))                   # make a vector
>>> solveA = torch.solve (v, mspd)[0]          # solve direct
>>> mcho = torch.cholesky (mspd)               # Cholesky factorization
>>> solveB = torch.cholesky_solve (v, mcho)    # solve with Cholesky factorization
>>> print ('solveA =', solveA)
solveA = tensor([[ 6.6744],
        [-1.5211],
        [ 1.1208],
        [ 1.1884],
        [-3.9746]])
>>> print ('solveB =', solveB)
solveB = tensor([[ 6.6743],
        [-1.5211],
        [ 1.1208],
        [ 1.1884],
        [-3.9745]])
>>> print ('solveA - solveB =', solveA - solveB)
solveA - solveB = tensor([[ 1.7643e-05],
        [-4.2915e-06],
        [ 2.1458e-06],
        [ 3.0994e-06],
        [-9.2983e-06]])

Best.
K. Frank