Source
%% PhS gh
%% Produit de matrices

%% échelle et étendue de l'image
60 setxunit
0 12 setxrange
-1 12 setyrange

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% définitions des couleurs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/coul0 {noir} def
/coul1 {noir} def
/coul2 {bleu} def
/coul3 {rouge} def
/coul4 {vert} def

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% On définit les coefficients intéressants comme noeuds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
coul1

0.2 setdboxit
(ai1) cnode
<latex>
$a_{i1}$
</latex>
1 3 [2.5 dup] cctexlabel
(ai2) cnode
<latex>
$a_{i2}$
</latex>
2 3 [2.5 dup] cctexlabel
(aip) cnode
<latex>
$a_{ip}$
</latex>
5 3 [2.5 dup] cctexlabel

(b1j) cnode
<latex>
$b_{1j}$
</latex>
9 10 [2.5 dup] cctexlabel
(b2j) cnode
<latex>
$b_{2j}$
</latex>
9 9 [2.5 dup] cctexlabel
(bpj) cnode
<latex>
$b_{pj}$
</latex>
9 6 [2.5 dup] cctexlabel

coul2
(ai1) (b1j) (<->) ncarc
(ai2) (b2j) (<->) ncarc
(aip) (bpj) (<->) ncarc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% On place les autres coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
.5 setlinewidth
pointilles
coul0
<latex>
$a_{11}$
</latex>
1 5 [2.5 dup] cctexlabel
<latex>
$a_{12}$
</latex>
2 5 [2.5 dup] cctexlabel
[2.5 5 4.5 5] (-) ligne
<latex>
$a_{1p}$
</latex>
5 5 [2.5 dup] cctexlabel

coul0
<latex>
$a_{n1}$
</latex>
1 1 [2.5 dup] cctexlabel
<latex>
$a_{n2}$
</latex>
2 1 [2.5 dup] cctexlabel
[2.5 1 4.5 1] (-) ligne
<latex>
$a_{np}$
</latex>
5 1 [2.5 dup] cctexlabel

coul0
<latex>
$b_{11}$
</latex>
7 10 [2.5 dup] cctexlabel
<latex>
$b_{21}$
</latex>
7 9 [2.5 dup] cctexlabel
[7 8.5 7 6.5] (-) ligne
<latex>
$b_{p1}$
</latex>
7 6 [2.5 dup] cctexlabel

coul0
<latex>
$b_{1q}$
</latex>
11 10 [2.5 dup] cctexlabel
<latex>
$b_{2q}$
</latex>
11 9 [2.5 dup] cctexlabel
[11 8.5 11 6.5] (-) ligne
<latex>
$b_{pq}$
</latex>
11 6 [2.5 dup] cctexlabel

[1 1.5 1 2.5] (-) ligne
[2 1.5 2 2.5] (-) ligne
[5 1.5 5 2.5] (-) ligne

[1 3.5 1 4.5] (-) ligne
[2 3.5 2 4.5] (-) ligne
[5 3.5 5 4.5] (-) ligne

[9.5 10 10.5 10] (-) ligne
[9.5 9 10.5 9] (-) ligne
[9.5 6 10.5 6] (-) ligne

[7.5 10 8.5 10] (-) ligne
[7.5 9 8.5 9] (-) ligne
[7.5 6 8.5 6] (-) ligne

coul3
<latex>
$c_{ij}$
</latex>
9 3 [2.5 dup] cctexlabel

coul1
pointilles
[2.5 3 4.5 3] (-) ligne
[9 6.5 9 8.5] (-) ligne

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tracés autour de c22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

coul2

.5 setlinewidth
continu
[.5 3.5 5.5 3.5] (-) ligne
[.5 2.5 5.5 2.5] (-) ligne
[8.5 5.5 8.5 10.5] (-) ligne
[9.5 5.5 9.5 10.5] (-) ligne
pointilles
[5.5 3.5 8.5 3.5] (-) ligne
[5.5 2.5 8.5 2.5] (-) ligne
[8.5 3.5 8.5 5.5] (-) ligne
[9.5 3.5 9.5 5.5] (-) ligne

2.5 setlinewidth
continu
[8.5 3.5 9.5 3.5] (-) ligne
[8.5 2.5 9.5 2.5] (-) ligne
[8.5 2.5 8.5 3.5] (-) ligne
[9.5 2.5 9.5 3.5] (-) ligne

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tracés des parenthèses
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
coul1
1 setlinewidth
105 255 [.8 3 0.5 2.5 0] Ellipse
-75 75 [5.2 3 0.5 2.5 0] Ellipse
105 255 [6.8 8 0.5 2.5 0] Ellipse
-75 75 [11.2 8 0.5 2.5 0] Ellipse

coul3
105 255 [6.8 3 0.5 2.5 0] Ellipse
-75 75 [11.2 3 0.5 2.5 0] Ellipse

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Noms des matrices
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 setfontsize

coul1
<latex>
$A$
</latex>
3 0 [2.5 dup] cctexlabel
coul3
setTimes
(n lignes) 3 -.2 dltext
% (,) 3 -.2 dctext
coul2
setTimes
(p colonnes) 3 -.2 drtext

coul1
<latex>
$B$
</latex>
9 11.2 [2.5 dup] cctexlabel
coul2
setTimes
(p lignes) 9 11  dltext
% (,) ) 9 11  dctext
coul3
setTimes
(q colonnes) 9 11  drtext

coul1
<latex>
$C=A\times B$
</latex>
9 0 [2.5 dup] cctexlabel
coul3
setTimes
(n lignes) 9 -.2 dltext
% (,) 9 -.2 dctext
coul3
setTimes
(q colonnes) 9 -.2 drtext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Formule du produit matriciel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

coul1
<latex>
$c_{ij}=\displaystyle\sum_{k=1}^p a_{ik}b_{kj}$
</latex>
3 8 [2.5 dup] cctexlabel