spyrit.core.torch.finite_diff_mat
- spyrit.core.torch.finite_diff_mat(n, boundary='dirichlet')[source]
Creates a finite difference matrix of shape \((n^2,n^2)\) for a 2D image of shape \((n,n)\).
- Args:
n(int): The size of the image.boundary(str, optional): The boundary condition to use. Must be one of ‘dirichlet’, ‘neumann’, ‘periodic’, ‘symmetric’ or ‘antisymmetric’. Default is ‘neumann’.- Returns:
torch.sparse.FloatTensor: The finite difference matrix.