# Hierarchical Tensor Decomposition of Module Partition for the Mechanical Simulation
## 2 Proposed Methodology
### Optimization Algorithms for HTD
```
Input:\(\mathbf{X},n,\lambda_{n},\lambda_{\mathbf{S}},\mu_{c},\varepsilon_{\mu}\) Initialization:\(\mathbf{B}_{n}^{0:}=\mathbf{0};\mathbf{S}^{0:}=\mathbf{0};\mathbf{E}^{0:}=\mathbf{0}; \mathbf{Y}^{0}:=\mathbf{0};k:=0;\mu:=\mu_{c}\cdot\operatorname{std}( \operatorname{vec}(\mathbf{X}))\) while not converged do Step 1: Updating \(\mathbf{B}_{n}\) with the other items fixed by \(\mathbf{B}_{n}^{k+1:}=2\lambda_{\mu}k^{k}(\mathbf{C}_{n}^{0:})^{T}\mathbf{C}_ {n}^{n}\mathbf{B}_{n}^{k+1}\mathbf{C}_{n}^{n}(\mathbf{G}_{n}^{n})^{T}+ \mathbf{B}_{n}^{k+1}=\mathbf{X}+\mu^{k}\mathbf{Y}^{k}-\sum_{j=1}^{m-1}\mathbf{ B}_{j}^{k+1}-\sum_{j=n+1}^{N}\mathbf{B}_{j}^{k}-\mathbf{S}^{k}-\mathbf{E}^{k}\) Step 2: Updating \(\mathbf{S}\) with the other items fixed by \(\mathbf{S}^{k+1}:=\mathfrak{S}_{\mu^{k}\lambda_{\mathbf{S}}}(\mathbf{X}+\mu^{ k}\mathbf{Y}^{k}-\sum_{n=1}^{N}\mathbf{B}_{n}^{k+1}-\mathbf{E}^{k})\) Step 3: Updating \(\mathbf{E}\) with the other items fixed by \(\mathbf{E}^{k+1}:=\frac{\mathbf{X}+\mu^{k}\mathbf{Y}^{k}-\sum_{i=1}^{N} \mathbf{B}_{i}^{k+1}-\mathbf{S}^{k+1}}{2\mu^{k}+1}\) Step 4: Updating \(\mathbf{Y}\) with the other items fixed by \(\mathbf{Y}^{k+1}:=\mathbf{Y}^{k}+\frac{1}{\mu^{k}}(\mathbf{X}-\sum_{i=1}^{N} \mathbf{B}_{i}^{k+1}-\mathbf{S}^{k+1}-\mathbf{E}^{k+1})\) Step 5: Updating \(\mu\) by \(\mu^{k+1}:=\frac{\mu^{k}}{\rho}\) Step 6: Check the convergence condition \(\frac{\|\mathbf{X}-\sum_{i=1}^{N}\mathbf{B}_{i}^{k+1}-\mathbf{S}^{k+1}- \mathbf{E}^{k+1}\|_{2}}{\|\mathbf{X}\|_{2}}<\varepsilon\) Step 7: Updating \(k\) \(k:=k+1\) return\(\mathbf{B}_{i}^{k+1},\mathbf{S}^{k+1},\mathbf{E}^{k+1}\). ```  
**Algorithm 1** Hierarchical Tensor Decomposition Method  
Upon convergence of the algorithm, \(\mathbf{\hat{B}}_{n},\mathbf{\hat{S}}\), and \(\mathbf{E}\) can be estimated. An element in the tensor, i.e., \(\mathbf{T}(i,j)\), is classified as the sparse spots if the estimated sparse spots layer at the same location, \(\mathbf{\hat{S}}\), is not equal to zero, as  
\[\mathbf{T}(i,j)\in\left\{ \begin{array}{ll}\text{sparse spots element}& \text{if }\mathbf{\hat{S}}(i,j)\
eq 0\\ \text{back-/fore-ground/noise element}&\text{if }\mathbf{\hat{S}}(i,j)=0 \end{array} .\right. \tag{3}\]  
There are few elements with high magnitudes of intensity in the foreground layer since the foreground layer is characterized by high-intensity variations. To ensure a smaller \(\lambda_{n}\|\mathbf{G}_{v}^{n}\mathbf{B}_{n}\mathbf{G}_{h}^{n}\|_{F}^{2}\), as many elements as possible will have a similar intensity value. The areas covered by elements with high intensity variations are often smaller than those covered by elements with low intensity magnitudes. Two adaptive thresholds [50] are introduced to segment these regions with large intensity variations from the foreground layers, i.e.,  
\[ \begin{split} f_{a_{n}}&=\max(v_{\min},\mu_{\mathbf{B}_{n}}+h \sigma_{\mathbf{B}_{n}})\\ f_{b_{n}}&=\min(v_{\max},\mu_{\mathbf{B}_{n}}-h\sigma_{\mathbf{B}_{n}}) ^{\prime},\end{split}  \tag{4}\]  
where \(\mu_{\mathbf{B}_{n}}\) and \(\sigma_{\mathbf{B}_{n}}\) are the mean value and standard deviation of the foreground cluster regions layer \(\mathbf{B}_{n}\), respectively; \(h,v_{\min}\), and \(v_{\max}\) are constants determined empirically. Anelement \((i,j)\) satisfying \(\mathbf{B}_{n}(i,j)>f_{a_{n}}\) is considered when the region to be detected in \(\mathbf{B}_{n}\) has a higher intensity value than the background. For the region to be detected and the background has a lower intensity value, the element \((i,j)\) corresponding to \(\mathbf{B}_{n}(i,j)<f_{a_{n}}\) is selected.