![使用括号和文本可视化矩阵分解](https://linux22.com/image/451071/%E4%BD%BF%E7%94%A8%E6%8B%AC%E5%8F%B7%E5%92%8C%E6%96%87%E6%9C%AC%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9F%A9%E9%98%B5%E5%88%86%E8%A7%A3.png)
我想重新创建下面的图像,但我无法正确设置它。
我尝试遵循这个例子:矩阵分解
答案1
代码
\documentclass[tikz]{standalone}
\usetikzlibrary{matrix, positioning}
\tikzset{
tighter delimiters/.style={
every left delimiter/.style={xshift=+.5ex},
every right delimiter/.style={xshift=+-.5ex},
every above delimiter/.style={yshift=+-.5ex},
every below delimiter/.style={yshift=+.5ex}},
@/.style args={#1>#2}{#1/.style={every #2 delimiter/.append style={label={##1}}}},
@/.list={ld>left, rd>right, ad>above, bd>below}
}
\begin{document}
\begin{tikzpicture}[
absolute, node distance=+0cm,
big/.style args={#1x#2}{
node font=\Huge, fill=blue!50,
minimum width={(#1)*1cm}, minimum height={(#2)*1cm}},
big'/.style={big={#1}, fill=none}]
\path[ld={left:$n$ samples}, bd={below:$p$ input features}]
node[big=2x3, left delimiter=\{, below delimiter=\}] (X) {$X$};
\node[big'=0x0, base right=of X] (eq) {${}={}$};
\path[rd={right:$n$ samples}, bd={below:$k$ latent dimensions}]
node[big=1x3, base right=of eq, right delimiter=\}, below delimiter=\}] (A) {$A$};
\path[rd={right:$k$ latent dimensions}, ad={above:$p$ input features}]
node[big=2x1, anchor=south west, at=(A.north east),
above delimiter=\{, right delimiter=\}] (B) {$B$};
\end{tikzpicture}
\end{document}