我想将列向量乘以行向量,然后将上述二维矩阵矢量化。
\documentclass{article}
\usepackage{amsmath}
\def\A{
\begin{bmatrix}
p_1 & p_2 & \cdots & p_N
\end{bmatrix}}
\def\B{
\begin{bmatrix}
p_1q_1 & p_1q_2 &\cdots &p_1q_N\\
p_2q_1 & p_2q_2 &\cdots &p_2q_N\\
\vdots & & & \vdots\\
p_Nq_1 & p_Nq_2 &\cdots &p_Nq_N\\
\end{bmatrix}}
\def\C{
\begin{bmatrix}
q_1 \\
q_2 \\
\vdots \\
q_N
\end{bmatrix}}
\def\D{
\begin{bmatrix}
p_1q_1 & p_1q_2 &\cdots &p_1q_N &p_2q_1 &\cdots &p_Nq_N
\end{bmatrix}}
\begin{document}
\footnotesize
\begin{figure}
\begin{equation}
\C \A = \B \Rightarrow \D
\end{equation}
\end{figure}
\end{document}
上面的代码产生了我实际想要表达的意思,但我想使用具有矢量数组形状的 Tikz 来绘制它。
有人能帮我吗?提前谢谢了。
答案1
虽然 OP 回答了 Zarko 的问题,但这里是一个包含所有矩阵的版本tikzpicture
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning}
\tikzset{
every left delimiter/.style={xshift=1ex},
every right delimiter/.style={xshift=-1ex},
bmatrix/.style={matrix of math nodes,
inner sep=0pt,
left delimiter={[},
right delimiter={]},
nodes={anchor=center, inner sep=.3333em},
}
}
\def\A{
\begin{bmatrix}
p_1 & p_2 & \cdots & p_N
\end{bmatrix}}
\def\B{
\begin{bmatrix}
p_1q_1 & p_1q_2 &\cdots &p_1q_N\\
p_2q_1 & p_2q_2 &\cdots &p_2q_N\\
\vdots & & & \vdots\\
p_Nq_1 & p_Nq_2 &\cdots &p_Nq_N\\
\end{bmatrix}}
\def\C{
\begin{bmatrix}
q_1 \\
q_2 \\
\vdots \\
q_N
\end{bmatrix}}
\def\D{
\begin{bmatrix}
p_1q_1 & p_1q_2 &\cdots &p_1q_N &p_2q_1 &\cdots &p_Nq_N
\end{bmatrix}}
\begin{document}
\footnotesize
\begin{figure}
\begin{equation}
\C \A = \B \Rightarrow \D
\end{equation}
\end{figure}
\begin{equation}
\begin{tikzpicture}
\matrix (C) [bmatrix] {q_1 \\
q_2 \\[-1ex]
\vdots \\
q_N\\};
\matrix (A) [bmatrix, right=3mm of C] {p_1 & p_2 & \cdots & p_N\\};
\node (eq) [right=1mm of A] {$=$};
\matrix (B) [bmatrix, right=1mm of eq] {
p_1q_1 & p_1q_2 &\cdots &p_1q_N\\
p_2q_1 & p_2q_2 &\cdots &p_2q_N\\[-1ex]
\vdots & & & \vdots\\
p_Nq_1 & p_Nq_2 &\cdots &p_Nq_N\\};
\node (imp) [right=1mm of B] {$\Rightarrow$};
\matrix (D) [bmatrix, right=1mm of imp] {
p_1q_1 & p_1q_2 &\cdots &p_1q_N &p_2q_1 &\cdots &p_Nq_N\\};
\end{tikzpicture}
\end{equation}
\end{document}