Source
%% PhS gh
%% Produit de matrices

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

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

/coul0 {0 0 0 0.5 setcmykcolor} def
/coul1 {noir} def
/coul2 {120 255 div 70 255 div 9 255 div setrgbcolor} def
/coul3 {rouge} def
/coul4 {bleu} def

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

0.2 setdboxit
(a21) cnode
<latex>
$a_{21}$
</latex>
1 3 [2.5 dup] cctexlabel
(a22) cnode
<latex>
$a_{22}$
</latex>
2 3 [2.5 dup] cctexlabel
(a2p) cnode
<latex>
$a_{2p}$
</latex>
4 3 [2.5 dup] cctexlabel

(b12) cnode
<latex>
$b_{12}$
</latex>
7 8 [2.5 dup] cctexlabel
(b22) cnode
<latex>
$b_{22}$
</latex>
7 7 [2.5 dup] cctexlabel
(bp2) cnode
<latex>
$b_{p2}$
</latex>
7 5 [2.5 dup] cctexlabel

coul2
(a21) (b12) (<->) ncarc
(a22) (b22) (<->) ncarc
(a2p) (bp2) (<->) ncarc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% On place les autres coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
.5 setlinewidth
pointilles
coul0
<latex>
$a_{11}$
</latex>
1 4 [2.5 dup] cctexlabel
<latex>
$a_{12}$
</latex>
2 4 [2.5 dup] cctexlabel
[2.5 4 3.5 4] (-) ligne
<latex>
$a_{1p}$
</latex>
4 4 [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 3.5 1] (-) ligne
<latex>
$a_{np}$
</latex>
4 1 [2.5 dup] cctexlabel

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

coul0
<latex>
$b_{1q}$
</latex>
9 8 [2.5 dup] cctexlabel
<latex>
$b_{2q}$
</latex>
9 7 [2.5 dup] cctexlabel
[9 6.5 9 5.5] (-) ligne
<latex>
$b_{pq}$
</latex>
9 5 [2.5 dup] cctexlabel

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

[7.5 8 8.5 8] (-) ligne
[7.5 7 8.5 7] (-) ligne
[7.5 5 8.5 5] (-) ligne

coul3
<latex>
$c_{22}$
</latex>
7 3 [2.5 dup] cctexlabel

coul1
pointilles
[2.5 3 3.5 3] (-) ligne
[7 6.5 7 5.5] (-) ligne

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

coul2

.5 setlinewidth
continu
[.5 3.5 4.5 3.5] (-) ligne
[.5 2.5 4.5 2.5] (-) ligne
[6.5 4.5 6.5 8.5] (-) ligne
[7.5 4.5 7.5 8.5] (-) ligne
pointilles
[4.5 3.5 6.5 3.5] (-) ligne
[4.5 2.5 6.5 2.5] (-) ligne
[6.5 3.5 6.5 4.5] (-) ligne
[7.5 3.5 7.5 4.5] (-) ligne

2.5 setlinewidth
continu
[7.5 3.5 6.5 3.5] (-) ligne
[7.5 2.5 6.5 2.5] (-) ligne
[6.5 2.5 6.5 3.5] (-) ligne
[7.5 2.5 7.5 3.5] (-) ligne

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tracés des parenthèses
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
coul1
1 setlinewidth
105 255 [.8 2.5 0.5 2 0] Ellipse
-75 75 [4.2 2.5 0.5 2 0] Ellipse
105 255 [5.8 6.5 0.5 2 0] Ellipse
-75 75 [9.2 6.5 0.5 2 0] Ellipse

coul3
105 255 [5.8 2.5 0.5 2 0] Ellipse
-75 75 [9.2 2.5 0.5 2 0] Ellipse

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

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

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

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

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

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