qmctorch.utils.algebra_utils module

qmctorch.utils.algebra_utils.btrace(M)[source]

Computes the trace of batched matrices

Parameters:M (torch.tensor) – matrices of size (Na, Nb, … Nx, N, N)
Returns:trace of matrices (Na, Nb, … Nx)
Return type:torch.tensor

Example

>>> m = torch.rand(100,5,5)
>>> tr = btrace(m)
qmctorch.utils.algebra_utils.bproj(M, P)[source]

Project batched marices using P^T M P

Parameters:
  • M (torch.tensor) – batched matrices size (…, N, M)
  • P (torch.tensor) – Porjectors size (…, N, M)
Returns:

Projected matrices

Return type:

torch.tensor

qmctorch.utils.algebra_utils.bdet2(M)[source]

Computes the determinant of batched 2x2 matrices

Parameters:M (torch.tensor) – input matrices
Returns:determinants of the matrices
Return type:torch.tensor
class qmctorch.utils.algebra_utils.BatchDeterminant(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

static forward(ctx, input)[source]
static backward(ctx, grad_output)[source]
using jaobi’s formula
d det(A) / d A_{ij} = adj^T(A)_{ij}
using the adjunct formula
d det(A) / d A_{ij} = ( (det(A) A^{-1})^T )_{ij}