![행렬 레이블 가져오기](https://rvso.com/image/399837/%ED%96%89%EB%A0%AC%20%EB%A0%88%EC%9D%B4%EB%B8%94%20%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0.png)
위의 레이블이 포함된 행렬을 얻을 수 있도록 도와주실 수 있나요?
MWE:
\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}