你能帮我得到这些带有上述标签的矩阵吗:
平均能量损失:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{\!
\begin{pmatrix}
x_{11} & x_{12} & \dots & x_{1n} \\
x_{21} & x_{22} & \dots & x_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
x_{d1} & x_{d2} & \dots & x_{dn}
\end{pmatrix}\!
}_{\mathbf{R}_{\text{Movies}\times \text{Users}}}
\approx
\underbrace{\!
\begin{pmatrix}
y_{11} & y_{12} & \dots & y_{1n} \\
y_{21} & y_{22} & \dots & y_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
y_{d1} & y_{d2} & \dots & y_{dn}
\end{pmatrix}\!
}_{\mathbf{Q}_{\text{Movies}\times f\text{-factors}}}
\cdot
\underbrace{
\begin{pmatrix}\!
z_{11} & z_{12} & \dots & z_{1n} \\
z_{21} & z_{22} & \dots & z_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
z_{d1} & z_{d2} & \dots & z_{dn}
\end{pmatrix}\!
}_{\mathbf{P}^T_{f\text{-factors}\times\text{Users}}}
\]
\end{document}
答案1
使用该blkarray
包:
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[\renewcommand\arraystretch{1.1}
\begin{blockarray}{cccc}
\BAmulticolumn{4}{c}{\mathbf{R}}\\
\begin{block}{(cccc)}
r_1^{(1)} & r_2^{(1)} & \dots & r_b^{(1)} \\
r_1^{(2)} & r_2^{(2)} & \dots & r_n^{(2)} \\
\vdots & \vdots & \ddots & \vdots \\
r_1^{(m)} & r_2^{(m)} & \dots & r_n^{(m)} \\
\end{block}
\end{blockarray}
\approx
\begin{blockarray}{cccc}
\BAmulticolumn{4}{c}{\mathbf{X}}\\
\begin{block}{(cccc)}
r_1^{(1)} & r_2^{(1)} & \dots & r_b^{(1)} \\
r_1^{(2)} & r_2^{(2)} & \dots & r_n^{(2)} \\
\vdots & \vdots & \ddots & \vdots \\
r_1^{(m)} & r_2^{(m)} & \dots & r_n^{(m)} \\
\end{block}
\end{blockarray}
\cdot
\begin{blockarray}{cccc}
\BAmulticolumn{4}{c}{\mathbf{\Theta}^T}\\
\begin{block}{(cccc)}
\theta_1^{(1)} & \theta_2^{(1)} & \dots & \theta_b^{(1)} \\
\theta_1^{(2)} & \theta_2^{(2)} & \dots & \theta_n^{(2)} \\
\vdots & \vdots & \ddots & \vdots \\
\theta_1^{(m)} & \theta_2^{(m)} & \dots & \theta_n^{(m)} \\
\end{block}
\end{blockarray}^{\raisebox{-1.5\baselineskip}{$T$}}
\]
\end{document}
编辑(1):添加了转置符号。解决方案不是很优雅,但有效。
编辑(2):也许您更喜欢以下转置符号的解决方案(仅针对最后一个矩阵的代码):
\begin{blockarray}{ccccc}
\BAmulticolumn{4}{c}{\mathbf{\Theta}^T}\\
\begin{block}{(cccc) c}
\theta_1^{(1)} & \theta_2^{(1)} & \dots & \theta_b^{(1)} &\kern-0.5em T \\
\theta_1^{(2)} & \theta_2^{(2)} & \dots & \theta_n^{(2)} & \\
\vdots & \vdots & \ddots & \vdots & \\
\theta_1^{(m)} & \theta_2^{(m)} & \dots & \theta_n^{(m)} & \\
\end{block}
\end{blockarray}
这使:
答案2
另外,我的答案并不优雅 :-),但它可以使用\bordermatrix
。我使用了您的 MWE 代码,但它不是图像的代码。
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\usepackage{newtxtext,newtxmath}
\begin{document}
\[\bordermatrix{
& & {\scriptstyle R} & & \cr
& x_{11} & x_{12} & \dots & x_{1n} \cr
& x_{21} & x_{22} & \dots & x_{2n} \cr
&\vdots & \vdots & \ddots & \vdots \cr
& x_{d1} & x_{d2} & \dots & x_{dn}
}
\simeq \bordermatrix{
& & {\scriptstyle T} & & \cr
& y_{11} & y_{12} & \dots & y_{1n} \cr
& y_{21} & y_{22} & \dots & y_{2n} \cr
& \vdots & \vdots & \ddots & \vdots \cr
& y_{d1} & y_{d2} & \dots & y_{dn}
} \bordermatrix{
& & {\scriptstyle \Theta^T} & & \cr
& y_{11} & y_{12} & \dots & y_{1n} \cr
& y_{21} & y_{22} & \dots & y_{2n} \cr
& \vdots & \vdots & \ddots & \vdots \cr
& y_{d1} & y_{d2} & \dots & y_{dn}
}
\begin{matrix}
\overset{T}{}\\
\\
\\
\\
\end{matrix}
\]
\end{document}