torch_fem.functional
assemble helpers
- trace(x)[source]
- \[\text{trace}(A)_{\cdots} = \sum_{i=1}^n A_{\cdots ii}\]
- Parameters:
x (torch.Tensor) – \([..., D, D]\), where \(D\) is the dimension of the matrix
- Returns:
\([...]\)
- Return type:
- dot(a, b, reduce_dim=-1)[source]
- \[\text{dot}(A, B)_{\cdots ab} = \sum_{i=1}^n A_{\cdots ai} B_{\cdots bi}\]
- Parameters:
a (torch.Tensor) – \([..., B, D]\), where \(B\) is the number of basis, \(D\) is the dimension of the matrix
b (torch.Tensor) – \([..., B, D]\), where \(B\) is the number of basis, \(D\) is the dimension of the matrix
- Returns:
\([..., B, B]\), where \(B\) is the number of basis
- Return type:
- ddot(a, b)[source]
- \[\text{ddot}(A, B)_{\cdots ab} = \sum_{i=1}^n A_{\cdots aij} B_{\cdots bij}\]
- Parameters:
a (torch.Tensor) – \([..., B, D, D]\), where \(B\) is the number of basis, \(D\) is the dimension of the matrix
b (torch.Tensor) – \([..., B, D, D]\), where \(B\) is the number of basis, \(D\) is the dimension of the matrix
- Returns:
\([..., B, B]\), where \(B\) is the number of basis
- Return type:
- mul(a, b)[source]
- \[\text{mul}(A, B)_{\cdots ij} = \sum_{i=1}^n A_{\cdots i} B_{\cdots j}\]
- Parameters:
a (torch.Tensor) – \([..., B]\), where \(B\) is the number of basis
b (torch.Tensor) – \([..., B]\), where \(B\) is the number of basis
- Returns:
[…, n_basis, n_basis]
- Return type:
- eye(value, dim)[source]
- \[\begin{split}\text{eye}(v, n)_{\cdots ij} = \begin{cases} v_{\cdots}, & i=j \\ 0, & i \neq j \end{cases}\end{split}\]
- Parameters:
value (torch.Tensor) – \([...]\), the filled value of the eye
dim (int) – \(D\), the dimension of the eye
- Returns:
\([..., D, D]\)
- Return type:
- sym(a)[source]
- \[\text{sym}(A)_{\cdots ij} = \frac{1}{2} (A_{\cdots i} + A_{\cdots j})\]
- Parameters:
a (torch.Tensor) – \([..., D]\), where \(D\) is the dimension of the matrix
- Returns:
\([..., D]\), where \(D\) is the dimension of the matrix
- Return type:
- vector(x)[source]
- \[\text{vector}(A) = \begin{bmatrix}A_{\cdots}^0\ \vdots \ A_{\cdots}^{n_{\text{row}}-1\end{bmatrix}\]
- Parameters:
x (: List[torch.Tensor]) – tensor list of shape […]
- Returns:
\([..., n_{\text{row}}]\)
- Return type:
- matrix(x)[source]
- \[\begin{split}\text{matrix}(A) = \begin{bmatrix} A_{\cdots}^{0,0} & \cdots & A_{\cdots}^{n_{\text{col}}-1} \\ \vdots & \ddots & \vdots \\ A_{\cdots}^{0,n_{\text{row}}-1} & \cdots & A_{\cdots}^{n_{\text{col}}-1,n_{\text{row}}-1} \end{bmatrix}\end{split}\]
- Parameters:
x (List[List[torch.Tensor]]) – tensor list of list of shape […]
- Returns:
\([..., n_{\text{col}}, n_{\text{row}}]\)
- Return type:
- transpose(x)[source]
- \[\text{transpose}(A)_{\cdots ij} = A_{\cdots ji}\]
- Parameters:
x (torch.Tensor) – \([..., a, b]\)
- Returns:
\([..., b, a]\)
- Return type: