grad#
- iskra.fem.grad(vertices: Tensor, faces: Tensor, stack: bool = False) Tensor | tuple[Tensor, ...][SOURCE]#
Finite element gradient matrix.
Given a triangle mesh or a polyline, computes the finite element gradient matrix assuming piecewise linear hat function basis.
Args: vertices (torch.Tensor):(n,d) tensor vertex list of a polyline or triangle mesh faces (torch.Tensor): tensor of ints
if (m, 2), interpret as edge index list of a polyline if (m, 3), interpret as face index list of a triangle mesh
Returns: torch.Tensor: S (m, n) sparse coo tensor of the finite element gradient matrix where S is 1 for polyline, 2 for triangle mesh in 2d, and 3 for triangle mesh in 3d