我在改变矩阵顺序时遇到了一些麻烦。点积看起来不太好,实际上它就像是嵌入的;很难发现。如何在两个矩阵之间向右添加空间并使点更大?
CODE(致谢扎尔科)
\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{\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$}}
\cdot
\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}
\]
\end{document}
答案1
\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{\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$}}
\bullet \quad
\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}
\]
\end{document}
或者,您可以保留代码原样并添加\cdot
空格,例如:\cdot \quad
只添加空格,同时保持点积较小。在这种情况下,结果将是:
答案2
您不需要blkarray
完成这项工作;正如您所发现的,如果要与其他对象一起使用,它会在放置内部围栏时使用一些技巧,这些技巧需要在大矩阵周围留出明确的空间。最好使用array
包含两行的标准。
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\[
\renewcommand\arraystretch{1.1}
\begin{array}{@{} c *{2} { @{} >{{}}c<{{}} @{} c } @{} }
\mathbf{R} && \mathbf{\Theta}^T && \mathbf{X} \\
\begin{pmatrix}
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{pmatrix}
& \approx &
\begin{pmatrix}
\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{pmatrix}^{\textstyle T}
& \cdot &
\begin{pmatrix}
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{pmatrix}
\end{array}
\]
\end{document}
外部前导的目的array
是没有列间空格,但“中间”条目(对应于关系或二元运算)被包围{}
,以便插入与它们相关的正确间距。