Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def chol_cap_mat(self):
V = self._linear_op.root.mT
C = ConstantDiagLinearOperator(torch.ones(*V.batch_shape, 1, device=V.device, dtype=V.dtype), V.shape[-2])

cap_mat = to_dense(C + V.matmul(A_inv.matmul(U)))
if isinstance(self._diag_tensor, ConstantDiagLinearOperator):
sigma_inv = A_inv.diag_values[0]
cap_mat = to_dense(C + sigma_inv * V.matmul(U))
else:
cap_mat = to_dense(C + V.matmul(A_inv.matmul(U)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that A_inv here is a DiagLinearOperator. Thus, A_inv.matmul(U) basically scales each row of U by corresponding entries in A_inv.

chol_cap_mat = psd_safe_cholesky(cap_mat)

return chol_cap_mat
Expand Down