kaolin.physics.utils¶
API¶
- kaolin.physics.utils.create_projection_matrix(num_dofs, list_of_kin_dofs)¶
Creates a projection matrix that removes kinematic degrees of freedom.
This function creates a reduced matrix that removes specific degrees of freedom (DOFs) from a system, typically kinematic/prescribed DOFs that should not be solved for. The resulting matrix will have all rows except those corresponding to kinematic DOFs.
- Parameters
num_dofs (int) – Total number of degrees of freedom in the system
list_of_kin_dofs (list or torch.Tensor) – Indices of the kinematic DOFs to remove
- Returns
A projection matrix of size \((\text{num_dofs} - \text{num_kin_dofs}, \text{num_dofs})\), that removes the kinematic DOF rows.
- Return type
- kaolin.physics.utils.finite_diff_jac(fcn, x, eps=1e-07)¶
Computes the jacobian \(\frac{\partial fcn}{\partial x}\) using finite diff
- Parameters
fcn (callable) – Function that takes input \((6\text{num_pts}, \text{dim})\) points for central finite differences and outputs a shape \((\text{num_pts}*6, A_1, ..., A_n)\)
x (torch.Tensor) – Input values, \((\text{num_pts}, \text{dim})\)
eps (float, optional) – Squared finite difference epsilon. Defaults to 1e-7.
- Returns
Returns the jacobian of fcn w.r.t x, \(\frac{\partial fcn(x)}{\partial x}\), of shape \((\text{num_pts}, A_1, ..., A_n, \text{dim}, \text{dim})\)
- Return type
- kaolin.physics.utils.hess_reduction(dense_Ja, block_wise_H, dense_Jb=None)¶
This does \(\text{Ja}^T \times \text{H} \times \text{Jb}\) for a block-wise diagonal \(\text{H}\) matrix.
- Parameters
dense_Ja (torch.Tensor) – The left Jacobian matrix
block_wise_H (torch.Tensor) – 3D tensor of block-wise Hessian matrices
dense_Jb (torch.Tensor) – The right Jacobian matrix. If not provided, will use \(\text{Ja}\)
- Returns
The reduced Hessian matrix
- Return type
- kaolin.physics.utils.mat1212¶
alias of
mat_t
- kaolin.physics.utils.mat312¶
alias of
mat_t
- kaolin.physics.utils.mat99¶
alias of
mat_t
- kaolin.physics.utils.standard_transform_to_relative(transform)¶
Converts a standard transform to a relative transform. :param transform: A \((3 \times 4)\) or \((4 \times 4)\) torch tensor specifying object’s transform. :type transform: torch.Tensor
- Returns
A \(3 \times 4\) torch tensor specifying object’s relative transform.
- Return type
- kaolin.physics.utils.torch_bsr_to_torch_triplets(mat)¶
Converts a sparse torch BSR matrix (or CSR matrix) to a sparse torch triplets.
- Parameters
mat (torch.sparse_bsr_tensor) – A sparse torch matrix of shape \((m, n)\) with block shape \((b, b)\).
- Returns
(row_indices, col_indices, values) representing the triplets
- Return type
- kaolin.physics.utils.vec12¶
alias of
vec_t
- kaolin.physics.utils.vec9¶
alias of
vec_t