Compare commits
7
Commits
maudule
...
2c825f16a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c825f16a8 | ||
|
|
5a16b7c99a | ||
|
|
2c864f9957 | ||
|
|
3802f3e43d | ||
|
|
0f9e8c73c6 | ||
|
|
b65493f0d6 | ||
|
|
51d2e44ff8 |
@@ -5,3 +5,4 @@
|
|||||||
*.a
|
*.a
|
||||||
*.ascii.txt
|
*.ascii.txt
|
||||||
/tipe
|
/tipe
|
||||||
|
.directory
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ type code_cyclique = t;;
|
|||||||
let get k n pol = {k=k;n=n;pol=pol};;
|
let get k n pol = {k=k;n=n;pol=pol};;
|
||||||
|
|
||||||
|
|
||||||
|
let cyclencode code (x:vecteur) :vecteur = polmul code.pol x;;
|
||||||
|
|
||||||
end;;
|
end;;
|
||||||
|
|
||||||
(*************************************************************)
|
(*************************************************************)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ type t = {
|
|||||||
type code_lineaire = t
|
type code_lineaire = t
|
||||||
|
|
||||||
val encoder : code_lineaire -> Math.vecteur -> Math.vecteur
|
val encoder : code_lineaire -> Math.vecteur -> Math.vecteur
|
||||||
val systematiqueFromRedondance : int -> int -> int list -> code_lineaire
|
val systematiqueFromRedondance : int -> int -> matrice -> code_lineaire
|
||||||
val distance_minimale : code_lineaire -> int
|
val distance_minimale : code_lineaire -> int
|
||||||
val decoder : code_lineaire -> int -> Math.vecteur
|
val decoder : code_lineaire -> int -> Math.vecteur
|
||||||
val appartenir : code_lineaire -> Math.vecteur -> bool
|
val appartenir : code_lineaire -> Math.vecteur -> bool
|
||||||
|
|||||||
@@ -4,3 +4,5 @@
|
|||||||
*.sh
|
*.sh
|
||||||
*.synctex.gz
|
*.synctex.gz
|
||||||
*.toc
|
*.toc
|
||||||
|
*.thm
|
||||||
|
svg-inkscape/
|
||||||
|
|||||||
+187
-4
@@ -1,14 +1,19 @@
|
|||||||
% !TeX encoding = UTF-8
|
% !TeX encoding = UTF-8
|
||||||
\documentclass[10pt,a4paper]{article}
|
\documentclass[10pt,a4paper]{article}
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage[margin=0.5in]{geometry}
|
\usepackage[margin=0.5in]{geometry}
|
||||||
\usepackage[french]{babel}
|
\usepackage[french]{babel}
|
||||||
\usepackage{tabularx}
|
\usepackage{tabularx}
|
||||||
\usepackage{theorem}
|
\usepackage{theorem}
|
||||||
\usepackage{amsmath}
|
\usepackage{amsmath}
|
||||||
\usepackage{amssymb}
|
\usepackage{amssymb}
|
||||||
|
\let\theoremstyle\relax
|
||||||
|
\usepackage{amsthm}
|
||||||
\usepackage{calrsfs}
|
\usepackage{calrsfs}
|
||||||
\usepackage{setspace}
|
\usepackage{setspace}
|
||||||
|
\usepackage{stmaryrd}
|
||||||
|
\usepackage{svg}
|
||||||
|
|
||||||
\usepackage{bashful}
|
\usepackage{bashful}
|
||||||
|
|
||||||
@@ -20,11 +25,29 @@
|
|||||||
\renewcommand\part{\clearpage\oldpart}
|
\renewcommand\part{\clearpage\oldpart}
|
||||||
|
|
||||||
% Un peu plus d'interligne, c'est plus lisible
|
% Un peu plus d'interligne, c'est plus lisible
|
||||||
\doublespacing
|
\onehalfspacing
|
||||||
|
|
||||||
% Fait une jolie barre horizontale
|
% Fait une jolie barre horizontale
|
||||||
\newcommand{\hsep}{\centerline{\rule{0.8\linewidth}{.05pt}}}
|
\newcommand{\hsep}{\centerline{\rule{0.8\linewidth}{.05pt}}}
|
||||||
|
|
||||||
|
% Racourcis
|
||||||
|
\newcommand{\FD}{\mathbb{F}_2\hspace{-.2em}}
|
||||||
|
\newcommand\fsign[3]{\item \textbf{#1} : \textit{#2} \qquad Complexité en $\mathcal{O}(#3)$\\}
|
||||||
|
\newcommand\into{\textrightarrow\:}
|
||||||
|
|
||||||
|
\newtheoremstyle{break}
|
||||||
|
{\topsep}{\topsep}%
|
||||||
|
{}{}%
|
||||||
|
{\bfseries}{}%
|
||||||
|
{\newline}{}%
|
||||||
|
\theoremstyle{break}
|
||||||
|
\newtheorem{definition}{Définition}[section]
|
||||||
|
\newtheorem{theoreme}{Théorème}[section]
|
||||||
|
\theoremstyle{remark}
|
||||||
|
\newtheorem*{remarque}{Remarque}
|
||||||
|
|
||||||
|
% Compter les mots
|
||||||
|
|
||||||
\author{Samy AVRILLON, Victor BELLOT, Dylan THEVENET}
|
\author{Samy AVRILLON, Victor BELLOT, Dylan THEVENET}
|
||||||
\title{Études des codes cycliques}
|
\title{Études des codes cycliques}
|
||||||
\begin{document}
|
\begin{document}
|
||||||
@@ -37,13 +60,173 @@
|
|||||||
|
|
||||||
\pagebreak
|
\pagebreak
|
||||||
|
|
||||||
\part{Mathématique}
|
\part{Contexte mathématique}
|
||||||
|
|
||||||
|
\section{Codes}
|
||||||
|
|
||||||
|
\begin{definition}[Code, Codage]
|
||||||
|
On définit un code de paramètres $(n,k)$ comme une partie de $\FD^n$ associée à $\FD^k$. Un codage est une application de $\FD^k$ vers $\FD^n$ injective.
|
||||||
|
|
||||||
|
Un codage est dit systématique lorsque les $k$ premiers bits de l'image d'un élément sont égaux à cet élément.
|
||||||
|
\end{definition}
|
||||||
|
\begin{definition}[Distance de Hamming, Poids d'un mot]
|
||||||
|
La distance de Hamming entre deux mots $v$ et $w$ de $\FD^n$ est le nombre de coordonnées différentes des deux mots.
|
||||||
|
$$d(v,w) = \operatorname{card}(i\in \llbracket1,n\rrbracket,v_i \neq w_i)$$
|
||||||
|
|
||||||
|
Le poids d'un mot est son nombre de coordonnées non nulles, égal à sa distance au vecteur nul.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{definition}[Capacités d'un code]\label{thMinDist}
|
||||||
|
Étant donné un code $C$, on appelle capacité de détection $e_d$ et capacité de correction $e_c$ le plus grand nombre de bits erronés que l'on puisse détecter, respectivement corriger dans le code.
|
||||||
|
La distance minimale d'un code est la plus grande distance entre deux mots du code.
|
||||||
|
|
||||||
|
$$d_C = \min_{x,y\in C\times C}\left(d(x,y)\right)$$
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{theoreme}\label{thCapacité}
|
||||||
|
On peut alors exprimer $e_d$ et $e_c$ en fonction de $d_C$ :
|
||||||
|
|
||||||
|
$$ e_c = d_C - 1 \qquad e_d = \left\lfloor\frac{d_C - 1}{2}\right\rfloor$$
|
||||||
|
\end{theoreme}
|
||||||
|
|
||||||
|
\begin{definition}[Code Parfait]
|
||||||
|
Un code parfait est un code tel que pour tout mot $w$ de $\FD^n$, il existe un \underline{unique} mot de $C$ étant à une distance minimale de $w$. Autrement dit, il n'y a jamais d'ambigüité sur la façon de décoder un mot erroné.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{remarque}
|
||||||
|
Il n'existe que trois types de codes parfaits:
|
||||||
|
\begin{itemize}
|
||||||
|
\item Les codes de Hamming
|
||||||
|
\item Les codes de répétition pure
|
||||||
|
\item Le code de Golay binaire de longueur 23
|
||||||
|
\end{itemize}
|
||||||
|
\end{remarque}
|
||||||
|
|
||||||
|
\section{Codes linéaires}
|
||||||
|
|
||||||
|
On dit qu'un code est linéaire lorsqu'il a une structure naturelle de sous-espace vectoriel de $\FD^n$. Les codages linéaires associés sont des applications linéaires.
|
||||||
|
|
||||||
|
\begin{definition}[Matrice génératrice]
|
||||||
|
On appelle \textbf{matrice génératrice} d'un codage linéaire $\phi$ la matrice de $\mathcal{M}_{n,k}(\FD)$ associée à $\phi$.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{definition}[Matrice de contrôle]
|
||||||
|
On appelle \textbf{matrice de contrôle} n'importe quelle matrice de $\mathcal{M}_{n-k,k}(\FD)$ ayant $C$ pour noyau.
|
||||||
|
|
||||||
|
Tout code a au moins une matrice de contrôle.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{theoreme}[Calcul de distances]
|
||||||
|
La structure d'espace vectoriel ainsi que la définition \ref{thMinDist} nous permettent de dire que la distance minimale d'un code linéaire est le plus petit poids non nul de ses vecteurs.
|
||||||
|
|
||||||
|
On peux aussi utiliser la borne de Singleton qui assure:
|
||||||
|
|
||||||
|
$$d_C \leqslant n+1-k$$
|
||||||
|
|
||||||
|
\end{theoreme}
|
||||||
|
|
||||||
|
Voici ici quelques concepts qui seront utiles au décodage.
|
||||||
|
|
||||||
|
|
||||||
|
\begin{definition}[Erreur et syndrome]
|
||||||
|
Si l'on souhaite envoyer un mot $X \in \FD^k$ qui est donc codé en $Y\in C$. Le mot réceptionné est $Z \in \FD^n$.
|
||||||
|
|
||||||
|
On appelle alors \textbf{mot erreur} le mot $E = Z - Y$.
|
||||||
|
On appelle \text{syndrome} le mot $S = H \cdot Z$.
|
||||||
|
|
||||||
|
On remarque que $E$ et $Z$ on le même syndrome. On peut plus généralement définir une relation d'équivalence «avoir le même syndrome». Les classes d'équivale nce de cette relation sont appelées \textbf{classes latérales}.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\section{Codes cycliques}
|
||||||
|
|
||||||
|
\begin{definition}[Code cyclique]
|
||||||
|
Un code linéaire est dit cyclique si il est stable par décalage binaire cyclique. C'est à dire que si $w_1w_2w_2\ldots w_n$ est dans $C$ alors $w_2w_3w_4\ldots w_{n-1}w_nw_1$ appartient aussi à $C$.
|
||||||
|
|
||||||
|
On peut aussi définir le \textbf{code cyclique engendrée} par un mot $w$, qui est le plus petit espace vectoriel stable par décalage cyclique qui contienne $w$.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{definition}
|
||||||
|
On définit le mot binaire associé au polynôme $P=\displaystyle\sum_{i=0}^{n-1}{a_i\cdotp X^i}$ comme étant le mot $a_0a_1\cdots a_{n-1}$. Le polynôme réciproquement associé à un mot binaire par ce procédé est appelé \textbf{représentation polynomiale} du mot.
|
||||||
|
\end{definition}
|
||||||
|
|
||||||
|
\begin{definition}[Polynôme générateur]
|
||||||
|
Un polynôme $P$ de $\FD\,[X]$ de degré $n-k$ est dit \textbf{générateur du code cyclique $C$ de paramètre $(k,n)$} lorsque $P | X^n + 1$ et que $(\sigma^i(w))_{i\in \llbracket 0,k-1\rrbracket}$ est une base de $C$ avec $\sigma$ l'opérateur de décalage binaire cyclique est $w$ le mot associé à $P$
|
||||||
|
\end{definition}
|
||||||
|
\begin{theoreme}[Théorème fondamental des codes cycliques]
|
||||||
|
Tout code cyclique admet un et un seul polynôme générateur.
|
||||||
|
\end{theoreme}
|
||||||
|
|
||||||
|
\begin{remarque}
|
||||||
|
Un codage naturel pour un code cyclique apparaît avec le polynôme générateur. Le codage appliqué à un mot $w$ est le mot associé au produit du polynôme générateur et du polynôme associé à $w$.
|
||||||
|
\end{remarque}
|
||||||
|
|
||||||
|
\part{Algorithmes}
|
||||||
|
\section{Des structures de données}
|
||||||
|
|
||||||
|
La première étape était de créer des structures de données adéquates, c'est à dire permettant d'effectuer les calculs nécessaire à l'utilisation des codes cycliques à moindre coût (temporel).
|
||||||
|
|
||||||
|
\subsection{Matrices et vecteurs}
|
||||||
|
Puisque nous avons affaire à des vecteurs de $\FD^n$ on peut les stocker sous forme d'entier «informatique». Nous sommes alors limités par la taille des mots du processeur, typiquement 32 bits ou 64 bits. Mais il est toujours possible de créer des entiers binaires virtuellement plus «grand». Un autre problème est qu'on ne peut pas récupérer la dimension d'un vecteur, et nous devons donc transmettre la donnée à coté.
|
||||||
|
|
||||||
|
Les matrices sont elles, des listes de vecteurs et sont donc naturellement stockées comme listes d'entiers binaires. On utilisera la structure de liste chainée native d'OCaml.
|
||||||
|
|
||||||
|
|
||||||
|
Nous avons ensuite codé les fonctions suivantes: (Les complexités sont données pour des matrices de $\mathcal{M}_{n,k}(\FD)$, les opérations bit à bit se faisant à temps constant, ce qui est vrai pour les entiers natifs).
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\fsign{produit}{matrice \into vecteur \into vecteur}{k} Renvoie simplement le vecteur produit $Y = M \cdot X$
|
||||||
|
\fsign{identite}{int \into matrice}{n} Renvoie la matrice identité de $\mathcal{M}_n(\FD)$
|
||||||
|
\fsign{print\_matrice}{int \into matrice \into unit}{nk} Affiche la matrice dans le terminal. Il faut spécifier la dimension verticale (des vecteurs). Un exemple de valeur de sortie est donnée figure \ref{print_matriceExemple}
|
||||||
|
\fsign{print\_vecteur}{int \into vecteur \into unit}{n} Affiche le vecteur dans le terminal, vu comme une matrice de $\mathcal{M}_{n,1}(\FD)$ (Exemple figure \ref{print_matriceExemple})
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\subsection{Polynômes}
|
||||||
|
De la même manière, les polynômes sont des vecteurs de l'espace vectoriel $\FD[X]$. On peut donc eux aussi les stocker comme entiers binaires, avec l'entier écrit en base 2: $a_0a_1a_2\cdots a_d$ correspondant au polynôme $P=\displaystyle\sum^d_{i=0}a_i\cdot X^i$. Là encore, nous nous limitons aux polynômes de degré 31 ou 63, à moins d'utiliser des objets virtuels plus avancés.
|
||||||
|
|
||||||
|
Les fonctions suivantes ont été créées (les complexités sont données pour les polynômes $P$ et $Q$ de degrés respectifs $p$ et $q$).
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\fsign{degre}{polynome \into int}{p} Renvoie le degré du polynôme
|
||||||
|
\fsign{polmul}{polynome \into polynome \into polynome}{\min(p,q)} Effectue le produit de deux polynômes dans l'algèbre $\FD[X]$
|
||||||
|
\fsign{poldiveuc}{polynome \into polynome \into polynome $\times$ polynome}{p^2} Effectue la division euclidienne de $P$ par $Q$.
|
||||||
|
|
||||||
|
\fsign{print\_polynome}{polynome \into unit}{p}(Exemple figure \ref{print_matriceExemple})
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\subsection{Codes}
|
||||||
|
|
||||||
|
Les différents codes (linéaires et cycliques) sont stockés comme des enregistrements.
|
||||||
|
|
||||||
|
Les codes linéaires sont la donnée de leurs matrices génératrice et une matrice de contrôle (redondante) ainsi que k et n (nécessaire car les «matrices» n'ont pas la donnée de leur hauteur). Bien que l'on puisse déduire une matrice de contrôle de la matrice génératrice, ce calcul peut se révéler coûteux.
|
||||||
|
|
||||||
|
Les codes cycliques sont simplement les données de k, de n et du polynôme générateur.
|
||||||
|
|
||||||
|
Les fonctions suivantes permettent de manipuler les structures:
|
||||||
|
\begin{itemize}
|
||||||
|
\fsign{systematiqueFromRedondance}{int \into int \into matrice \into code\_lineaire}{k} Renvoie le code linéaire systématique associé à la matrice de redondance de $\mathcal{M}_{n-k,k}$.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
\part{Algorithmie}
|
|
||||||
\section{Structures de données crées}
|
|
||||||
\section{Liste des fonctions}
|
\section{Liste des fonctions}
|
||||||
|
|
||||||
|
|
||||||
|
Nous avons ensuite écrit des fonctions permettant de manipuler les codes linéaires:
|
||||||
|
\begin{itemize}
|
||||||
|
\fsign{encoder}{code\_lineaire \into Math.vecteur \into Math.vecteur}{}
|
||||||
|
Encode le vecteur de $\FD^k$ suivant le code linéaire spécifié, il s'agit alors d'un simple produit avec la matrice génératrice.
|
||||||
|
\fsign{appartenir}{code_lineaire -> Math.vecteur -> bool}
|
||||||
|
Renvoie \textit{vrai} si et seulement si le vecteur appartient au code, c'est à dire, si et seulement si $HX=0$ avec $H$ la matrice de contrôle et $X$ le vecteur de $\FD^n$ en question.
|
||||||
|
\fsign{distance\_minimale}{code\_lineaire -> int}{}
|
||||||
|
Renvoie la distance minimale du code, utilisée pour calculer les capacités de détéction et de correction du code (voir \ref{thCapacité})
|
||||||
|
\fsign{decoder}{code\_lineaire \into int \into Math.vecteur}{}
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\part*{Annexes}
|
||||||
|
\begin{figure}[h]
|
||||||
|
\begin{center}
|
||||||
|
\label{print_matriceExemple}
|
||||||
|
\includesvg[scale=.3]{print_output.svg}
|
||||||
|
\caption{Exemple d'affichage de vecteur,matrice et polynômes}
|
||||||
|
\end{center}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="66.282837mm"
|
||||||
|
height="117.06406mm"
|
||||||
|
viewBox="0 0 66.282836 117.06406"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||||
|
sodipodi:docname="print_output.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="1.979899"
|
||||||
|
inkscape:cx="10.04794"
|
||||||
|
inkscape:cy="216.89603"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:window-width="1366"
|
||||||
|
inkscape:window-height="703"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-0.53453934,-1.3999026)">
|
||||||
|
<rect
|
||||||
|
style="opacity:1;fill:#686868;fill-opacity:1;stroke:none;stroke-width:1.76637125;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect827"
|
||||||
|
width="66.282837"
|
||||||
|
height="117.06406"
|
||||||
|
x="0.53453934"
|
||||||
|
y="1.3999026" />
|
||||||
|
<g
|
||||||
|
aria-label="┌011┐
|
||||||
|
│101│
|
||||||
|
│111│
|
||||||
|
│100│
|
||||||
|
└001┘"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:17.08358955px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="text12">
|
||||||
|
<path
|
||||||
|
d="m 12.454936,16.851757 h 5.980925 v 1.434754 h -4.646269 v 9.576153 h -1.334656 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path822" />
|
||||||
|
<path
|
||||||
|
d="m 23.399111,23.683524 q -2.001983,0 -3.011317,-1.634953 -1.017674,-1.643294 -1.017674,-4.821442 0,-3.18649 1.017674,-4.829785 1.009334,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800794 0.759085,2.001983 0.258589,1.192849 0.258589,2.827802 0,1.634953 -0.258589,2.827801 -0.25859,1.192848 -0.759085,1.993641 -1.026017,1.634953 -3.019658,1.634953 z m 0,-1.334655 q 1.192848,0 1.768418,-1.267923 0.57557,-1.267922 0.57557,-3.853817 0,-2.602578 -0.57557,-3.853818 -0.57557,-1.276264 -1.768418,-1.276264 -1.176165,0 -1.751735,1.267922 -0.291956,0.62562 -0.442105,1.576562 -0.141807,0.942601 -0.141807,2.285598 0,2.610919 0.583912,3.853817 0.583911,1.267923 1.751735,1.267923 z m 0.01668,-2.210523 q -0.25859,0 -0.408738,-0.358689 -0.150149,-0.358689 -0.250248,-0.842501 -0.08342,-0.392055 -0.141807,-0.925917 -0.05005,-0.542204 -0.05005,-0.825818 0,-0.200199 0.03337,-0.717378 0.03337,-0.517179 0.133465,-0.975966 0.241906,-1.192849 0.650645,-1.192849 0.233564,0 0.392055,0.316981 0.166832,0.316981 0.283614,0.900892 0.08342,0.408739 0.133465,0.925918 0.05005,0.517179 0.05005,0.809134 0,0.166832 -0.03337,0.658987 -0.02502,0.492154 -0.108441,1.009333 -0.20854,1.217873 -0.684011,1.217873 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path824" />
|
||||||
|
<path
|
||||||
|
d="m 30.789765,22.023547 h 2.619262 v -8.93385 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 v 11.035933 h 2.585895 v 1.418071 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path826" />
|
||||||
|
<path
|
||||||
|
d="m 41.066611,22.023547 h 2.619262 v -8.93385 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 v 11.035933 h 2.585895 v 1.418071 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path828" />
|
||||||
|
<path
|
||||||
|
d="m 53.562324,18.286511 h -4.637928 v -1.434754 h 5.972583 v 11.010907 h -1.334655 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path830" />
|
||||||
|
<path
|
||||||
|
d="m 12.454936,28.529992 h 1.334656 v 20.687159 h -1.334656 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path832" />
|
||||||
|
<path
|
||||||
|
d="m 20.512918,43.378034 h 2.619262 v -8.93385 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 v 11.035933 h 2.585895 v 1.418071 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path834" />
|
||||||
|
<path
|
||||||
|
d="m 33.675958,45.038011 q -2.001983,0 -3.011317,-1.634953 -1.017674,-1.643294 -1.017674,-4.821442 0,-3.18649 1.017674,-4.829785 1.009334,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800793 0.759085,2.001983 0.258589,1.192849 0.258589,2.827802 0,1.634952 -0.258589,2.827801 -0.25859,1.192848 -0.759085,1.993641 -1.026017,1.634953 -3.019658,1.634953 z m 0,-1.334655 q 1.192848,0 1.768418,-1.267923 0.57557,-1.267923 0.57557,-3.853817 0,-2.602579 -0.57557,-3.853818 -0.57557,-1.276264 -1.768418,-1.276264 -1.176165,0 -1.751736,1.267922 -0.291955,0.62562 -0.442104,1.576562 -0.141807,0.942601 -0.141807,2.285598 0,2.610919 0.583911,3.853817 0.583912,1.267923 1.751736,1.267923 z m 0.01668,-2.210523 q -0.25859,0 -0.408738,-0.358689 -0.150149,-0.358689 -0.250248,-0.842501 -0.08342,-0.392055 -0.141807,-0.925917 -0.05005,-0.542204 -0.05005,-0.825818 0,-0.200199 0.03337,-0.717378 0.03337,-0.517179 0.133466,-0.975967 0.241906,-1.192848 0.650644,-1.192848 0.233565,0 0.392055,0.316981 0.166832,0.316981 0.283615,0.900892 0.08342,0.408738 0.133465,0.925917 0.05005,0.517179 0.05005,0.809135 0,0.166832 -0.03337,0.658986 -0.02502,0.492155 -0.108441,1.009334 -0.20854,1.217873 -0.684011,1.217873 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path836" />
|
||||||
|
<path
|
||||||
|
d="m 41.066611,43.378034 h 2.619262 v -8.93385 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 v 11.035933 h 2.585895 v 1.418071 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path838" />
|
||||||
|
<path
|
||||||
|
d="m 53.562324,28.529992 h 1.334655 v 20.687159 h -1.334655 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path840" />
|
||||||
|
<path
|
||||||
|
d="m 12.454936,49.884479 h 1.334656 v 20.687159 h -1.334656 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path842" />
|
||||||
|
<path
|
||||||
|
d="m 20.512918,64.73252 h 2.619262 v -8.933849 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 V 64.73252 h 2.585895 v 1.418072 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path844" />
|
||||||
|
<path
|
||||||
|
d="m 30.789765,64.73252 h 2.619262 v -8.933849 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 V 64.73252 h 2.585895 v 1.418072 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path846" />
|
||||||
|
<path
|
||||||
|
d="m 41.066611,64.73252 h 2.619262 v -8.933849 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 V 64.73252 h 2.585895 v 1.418072 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path848" />
|
||||||
|
<path
|
||||||
|
d="m 53.562324,49.884479 h 1.334655 v 20.687159 h -1.334655 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path850" />
|
||||||
|
<path
|
||||||
|
d="m 12.454936,71.238966 h 1.334656 v 20.687159 h -1.334656 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path852" />
|
||||||
|
<path
|
||||||
|
d="m 20.512918,86.087007 h 2.619262 v -8.933849 l -1.9853,2.260572 -0.917576,-1.117774 2.886192,-3.244881 h 1.685003 v 11.035932 h 2.585895 v 1.418072 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path854" />
|
||||||
|
<path
|
||||||
|
d="m 33.675958,87.746985 q -2.001983,0 -3.011317,-1.634953 -1.017674,-1.643294 -1.017674,-4.821443 0,-3.186489 1.017674,-4.829784 1.009334,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800793 0.759085,2.001983 0.258589,1.192849 0.258589,2.827801 0,1.634953 -0.258589,2.827802 -0.25859,1.192848 -0.759085,1.993641 -1.026017,1.634953 -3.019658,1.634953 z m 0,-1.334655 q 1.192848,0 1.768418,-1.267923 0.57557,-1.267923 0.57557,-3.853818 0,-2.602578 -0.57557,-3.853817 -0.57557,-1.276264 -1.768418,-1.276264 -1.176165,0 -1.751736,1.267922 -0.291955,0.62562 -0.442104,1.576562 -0.141807,0.9426 -0.141807,2.285597 0,2.61092 0.583911,3.853818 0.583912,1.267923 1.751736,1.267923 z m 0.01668,-2.210523 q -0.25859,0 -0.408738,-0.358689 -0.150149,-0.358689 -0.250248,-0.842501 -0.08342,-0.392055 -0.141807,-0.925918 -0.05005,-0.542203 -0.05005,-0.825818 0,-0.200198 0.03337,-0.717377 0.03337,-0.517179 0.133466,-0.975967 0.241906,-1.192848 0.650644,-1.192848 0.233565,0 0.392055,0.316981 0.166832,0.31698 0.283615,0.900892 0.08342,0.408738 0.133465,0.925917 0.05005,0.517179 0.05005,0.809135 0,0.166832 -0.03337,0.658986 -0.02502,0.492155 -0.108441,1.009334 -0.20854,1.217873 -0.684011,1.217873 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path856" />
|
||||||
|
<path
|
||||||
|
d="m 43.952804,87.746985 q -2.001984,0 -3.011317,-1.634953 -1.017675,-1.643294 -1.017675,-4.821443 0,-3.186489 1.017675,-4.829784 1.009333,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800793 0.759085,2.001983 0.258589,1.192849 0.258589,2.827801 0,1.634953 -0.258589,2.827802 -0.25859,1.192848 -0.759085,1.993641 -1.026017,1.634953 -3.019658,1.634953 z m 0,-1.334655 q 1.192848,0 1.768418,-1.267923 0.57557,-1.267923 0.57557,-3.853818 0,-2.602578 -0.57557,-3.853817 -0.57557,-1.276264 -1.768418,-1.276264 -1.176166,0 -1.751736,1.267922 -0.291956,0.62562 -0.442104,1.576562 -0.141807,0.9426 -0.141807,2.285597 0,2.61092 0.583911,3.853818 0.583912,1.267923 1.751736,1.267923 z m 0.01668,-2.210523 q -0.25859,0 -0.408738,-0.358689 -0.150149,-0.358689 -0.250248,-0.842501 -0.08342,-0.392055 -0.141807,-0.925918 -0.05005,-0.542203 -0.05005,-0.825818 0,-0.200198 0.03337,-0.717377 0.03337,-0.517179 0.133466,-0.975967 0.241906,-1.192848 0.650644,-1.192848 0.233565,0 0.392055,0.316981 0.166832,0.31698 0.283615,0.900892 0.08342,0.408738 0.133465,0.925917 0.05005,0.517179 0.05005,0.809135 0,0.166832 -0.03337,0.658986 -0.02502,0.492155 -0.10844,1.009334 -0.20854,1.217873 -0.684011,1.217873 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path858" />
|
||||||
|
<path
|
||||||
|
d="m 53.562324,71.238966 h 1.334655 v 20.687159 h -1.334655 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path860" />
|
||||||
|
<path
|
||||||
|
d="m 12.454936,92.593453 h 1.334656 v 9.676247 h 4.646269 v 1.43476 h -5.980925 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path862" />
|
||||||
|
<path
|
||||||
|
d="m 23.399111,109.10147 q -2.001983,0 -3.011317,-1.63495 -1.017674,-1.6433 -1.017674,-4.82144 0,-3.186493 1.017674,-4.829788 1.009334,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800793 0.759085,2.001983 0.258589,1.192845 0.258589,2.827805 0,1.63495 -0.258589,2.8278 -0.25859,1.19285 -0.759085,1.99364 -1.026017,1.63495 -3.019658,1.63495 z m 0,-1.33465 q 1.192848,0 1.768418,-1.26793 0.57557,-1.26792 0.57557,-3.85381 0,-2.60258 -0.57557,-3.853821 -0.57557,-1.276264 -1.768418,-1.276264 -1.176165,0 -1.751735,1.267922 -0.291956,0.62562 -0.442105,1.576563 -0.141807,0.9426 -0.141807,2.2856 0,2.61092 0.583912,3.85381 0.583911,1.26793 1.751735,1.26793 z m 0.01668,-2.21053 q -0.25859,0 -0.408738,-0.35869 -0.150149,-0.35868 -0.250248,-0.8425 -0.08342,-0.39205 -0.141807,-0.92591 -0.05005,-0.54221 -0.05005,-0.82582 0,-0.2002 0.03337,-0.71738 0.03337,-0.51718 0.133465,-0.97597 0.241906,-1.192844 0.650645,-1.192844 0.233564,0 0.392055,0.316984 0.166832,0.31698 0.283614,0.90089 0.08342,0.40874 0.133465,0.92592 0.05005,0.51718 0.05005,0.80913 0,0.16683 -0.03337,0.65899 -0.02502,0.49215 -0.108441,1.00933 -0.20854,1.21787 -0.684011,1.21787 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path864" />
|
||||||
|
<path
|
||||||
|
d="m 33.675958,109.10147 q -2.001983,0 -3.011317,-1.63495 -1.017674,-1.6433 -1.017674,-4.82144 0,-3.186493 1.017674,-4.829788 1.009334,-1.634953 3.011317,-1.634953 2.001983,0 3.019658,1.634953 0.500495,0.800793 0.759085,2.001983 0.258589,1.192845 0.258589,2.827805 0,1.63495 -0.258589,2.8278 -0.25859,1.19285 -0.759085,1.99364 -1.026017,1.63495 -3.019658,1.63495 z m 0,-1.33465 q 1.192848,0 1.768418,-1.26793 0.57557,-1.26792 0.57557,-3.85381 0,-2.60258 -0.57557,-3.853821 -0.57557,-1.276264 -1.768418,-1.276264 -1.176165,0 -1.751736,1.267922 -0.291955,0.62562 -0.442104,1.576563 -0.141807,0.9426 -0.141807,2.2856 0,2.61092 0.583911,3.85381 0.583912,1.26793 1.751736,1.26793 z m 0.01668,-2.21053 q -0.25859,0 -0.408738,-0.35869 -0.150149,-0.35868 -0.250248,-0.8425 -0.08342,-0.39205 -0.141807,-0.92591 -0.05005,-0.54221 -0.05005,-0.82582 0,-0.2002 0.03337,-0.71738 0.03337,-0.51718 0.133466,-0.97597 0.241906,-1.192844 0.650644,-1.192844 0.233565,0 0.392055,0.316984 0.166832,0.31698 0.283615,0.90089 0.08342,0.40874 0.133465,0.92592 0.05005,0.51718 0.05005,0.80913 0,0.16683 -0.03337,0.65899 -0.02502,0.49215 -0.108441,1.00933 -0.20854,1.21787 -0.684011,1.21787 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path866" />
|
||||||
|
<path
|
||||||
|
d="m 41.066611,107.44149 h 2.619262 v -8.933845 l -1.9853,2.260575 -0.917576,-1.117777 2.886192,-3.244881 h 1.685003 v 11.035928 h 2.585895 v 1.41808 h -6.873476 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path868" />
|
||||||
|
<path
|
||||||
|
d="m 48.924396,102.2697 h 4.637928 v -9.676247 h 1.334655 v 11.111007 h -5.972583 z"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Hack;-inkscape-font-specification:Hack;fill:#00f829;fill-opacity:1;stroke:none;stroke-width:0.42708972;stroke-opacity:1"
|
||||||
|
id="path870" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 18 KiB |
@@ -7,8 +7,9 @@ ascii: $(shell find textes/ -type f -iname "*.txt" ! -iname "*.ascii.txt" | sed
|
|||||||
%.cmx: %.ml
|
%.cmx: %.ml
|
||||||
ocamlopt -c $<
|
ocamlopt -c $<
|
||||||
|
|
||||||
Code.cmo: Math.cmo
|
Code.cmo: Code.ml Math.cmo
|
||||||
|
ocamlc -c "Code.mli"
|
||||||
|
ocamlc -c "Code.ml"
|
||||||
%.cmi: %.mli
|
%.cmi: %.mli
|
||||||
ocamlc -c $<
|
ocamlc -c $<
|
||||||
%.cmo: %.ml
|
%.cmo: %.ml
|
||||||
|
|||||||
@@ -141,4 +141,3 @@ let polrst (p:polynome) (q:polynome) : polynome = snd (poldiveuc p q);;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
type vecteur = int
|
type vecteur = int
|
||||||
type matrice = int list
|
type matrice = int list
|
||||||
type polynome = int
|
type polynome = int
|
||||||
|
|
||||||
|
val deux_puissance : int -> int
|
||||||
|
val changer_bit : int -> int -> int
|
||||||
|
val decagauche : int -> int -> int
|
||||||
|
|
||||||
val nthOfBinarint : int -> int -> string
|
val nthOfBinarint : int -> int -> string
|
||||||
val print_matrice : int -> matrice -> unit
|
val print_matrice : int -> matrice -> unit
|
||||||
val print_vecteur : int -> vecteur -> unit
|
val print_vecteur : int -> vecteur -> unit
|
||||||
val print_polynome : polynome -> unit
|
val print_polynome : polynome -> unit
|
||||||
|
|
||||||
val produit : matrice -> vecteur -> vecteur
|
val produit : matrice -> vecteur -> vecteur
|
||||||
val deux_puissance : int -> int
|
val identite : int -> matrice
|
||||||
val orderize : 'a -> 'a -> 'a * 'a
|
val orderize : 'a -> 'a -> 'a * 'a
|
||||||
val identite : int -> int list
|
|
||||||
val changer_bit : int -> int -> int
|
|
||||||
val decagauche : int -> int -> int
|
|
||||||
val respecter : int -> int list -> bool
|
val respecter : int -> int list -> bool
|
||||||
val matriceAuPif : int -> int -> matrice
|
val matriceAuPif : int -> int -> matrice
|
||||||
val polmul : polynome -> polynome -> polynome
|
|
||||||
val degre : polynome -> int
|
val degre : polynome -> int
|
||||||
|
val polmul : polynome -> polynome -> polynome
|
||||||
val poldiveuc : polynome -> polynome -> polynome * polynome
|
val poldiveuc : polynome -> polynome -> polynome * polynome
|
||||||
val poldiv : polynome -> polynome -> polynome
|
val poldiv : polynome -> polynome -> polynome
|
||||||
val polrst : polynome -> polynome -> polynome
|
val polrst : polynome -> polynome -> polynome
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ do
|
|||||||
then raise (GTROUVE matPapa)
|
then raise (GTROUVE matPapa)
|
||||||
done;;
|
done;;
|
||||||
|
|
||||||
print_vecteur 21 (CLineaire.encoder code_paparfait 0b011011011001);;
|
|
||||||
|
|
||||||
print_vecteur 7 (CLineaire.encoder code_hamming 0b0100);;
|
print_vecteur 7 (CLineaire.encoder code_hamming 0b0100);;
|
||||||
CLineaire.decoder code_hamming 0b1010100;;
|
CLineaire.decoder code_hamming 0b1010100;;
|
||||||
@@ -76,4 +75,228 @@ print_polynome (poldiv ((deux_puissance 7) +1) cocycl.pol);;
|
|||||||
let cocylined = cycliqueVersLineaire cocycl;;
|
let cocylined = cycliqueVersLineaire cocycl;;
|
||||||
print_matrice 7 cocylined.g;;
|
print_matrice 7 cocylined.g;;
|
||||||
print_matrice 4 cocylined.h;;
|
print_matrice 4 cocylined.h;;
|
||||||
|
|
||||||
CLineaire.distance_minimale cocylined;;
|
CLineaire.distance_minimale cocylined;;
|
||||||
|
|
||||||
|
print_vecteur 7 (cyclencode cocycl 0b1010);;
|
||||||
|
|
||||||
|
(* Essayons de générer une table d'addition *)
|
||||||
|
|
||||||
|
(**** Utilitaires ****)
|
||||||
|
|
||||||
|
let rangearray i j =
|
||||||
|
let out = Array.make (j-i+1) 0 in
|
||||||
|
for k=i to j do
|
||||||
|
out.(k-i) <- k
|
||||||
|
done;
|
||||||
|
out;;
|
||||||
|
|
||||||
|
let shuffle tab =
|
||||||
|
let n = Array.length tab in
|
||||||
|
for i=n-2 downto 1 do
|
||||||
|
let j = Random.int (i+1) in
|
||||||
|
let a,b=tab.(i),tab.(j) in
|
||||||
|
tab.(i) <- b;
|
||||||
|
tab.(j) <- a
|
||||||
|
done;;
|
||||||
|
|
||||||
|
exception EmptyException;;
|
||||||
|
let pop q = match !q with
|
||||||
|
| [] -> raise EmptyException
|
||||||
|
| e::s -> q:=s;e;;
|
||||||
|
let push q e = q:=e::!q;;
|
||||||
|
|
||||||
|
let printtbl arr=
|
||||||
|
let n = Array.length arr in
|
||||||
|
print_string "[|";
|
||||||
|
print_int arr.(0);
|
||||||
|
for i=1 to (n-1) do
|
||||||
|
print_string ";";
|
||||||
|
print_int arr.(i)
|
||||||
|
done;
|
||||||
|
print_string "|]";;
|
||||||
|
let printlst lst =
|
||||||
|
print_string "[";
|
||||||
|
match lst with
|
||||||
|
| [] -> ()
|
||||||
|
| e::s -> begin
|
||||||
|
print_int e;
|
||||||
|
let rec aux ll = match ll with
|
||||||
|
| [] -> ()
|
||||||
|
| h::t -> print_string ";";print_int h;aux t
|
||||||
|
in aux s end;
|
||||||
|
print_string "]";;
|
||||||
|
exception FoundException;;
|
||||||
|
let arrmem arr e =
|
||||||
|
let n = Array.length arr in
|
||||||
|
try
|
||||||
|
for i=0 to n-1 do
|
||||||
|
if arr.(i)=e then raise FoundException
|
||||||
|
done;
|
||||||
|
false
|
||||||
|
with FoundException -> true;;
|
||||||
|
|
||||||
|
let rec foreache lst f edd= match lst with
|
||||||
|
| [] -> edd ()
|
||||||
|
| e::s -> f e;foreache s f edd;;
|
||||||
|
|
||||||
|
let foreach lst f = foreache lst f (fun () -> ());;
|
||||||
|
|
||||||
|
|
||||||
|
(**** La zolie structure****)
|
||||||
|
let n = 7;;
|
||||||
|
|
||||||
|
type element = Zero | Ap of int;;
|
||||||
|
|
||||||
|
exception NotApException;;
|
||||||
|
let getap a = match a with
|
||||||
|
| Zero -> raise NotApException
|
||||||
|
| Ap(i) -> i;;
|
||||||
|
|
||||||
|
let add tble i j =
|
||||||
|
let n = (Array.length tble) +1 in
|
||||||
|
if i=j then Zero else
|
||||||
|
match i,j with
|
||||||
|
| Zero,x | x,Zero -> x
|
||||||
|
| (Ap(0),Ap(k)) -> tble.(k-1)
|
||||||
|
| (Ap(k),Ap(0)) -> tble.(k-1)
|
||||||
|
| (Ap(ii),Ap(jj)) -> let tt = getap (tble.(((jj-ii+n) mod n)-1)) in
|
||||||
|
Ap((tt+ii) mod n);;
|
||||||
|
|
||||||
|
let randtabl n =
|
||||||
|
let tab = rangearray 1 (n-1) in
|
||||||
|
Random.self_init ();
|
||||||
|
shuffle tab;
|
||||||
|
let rout = Array.make (n-1) Zero in
|
||||||
|
for i=0 to n-1-1 do
|
||||||
|
rout.(i) <- Ap(tab.(i))
|
||||||
|
done;
|
||||||
|
rout;;
|
||||||
|
|
||||||
|
let getphi arr k = Ap(arr.(k));;
|
||||||
|
|
||||||
|
exception PasTransitifException;;
|
||||||
|
let estTransitif tble =
|
||||||
|
let n = Array.length tble in
|
||||||
|
try
|
||||||
|
for i=1 to (n-1) do
|
||||||
|
for j=1 to (i-1) do (* i et j distincts et non nuls (transititivité évidente)*)
|
||||||
|
if (* La formule s'applique *) i<>tble.(j) && j <> tble.(i) then
|
||||||
|
let sa = j + tble.((tble.(i)-j+n) mod n) in
|
||||||
|
let sb = i + tble.((tble.(j)-i+n) mod n) in
|
||||||
|
if sa mod n <>sb mod n then raise PasTransitifException
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
true
|
||||||
|
with PasTransitifException -> false;;
|
||||||
|
|
||||||
|
let printalp a = match a with
|
||||||
|
| Zero -> print_string "o"
|
||||||
|
| Ap(i) -> print_int i;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(* Cette fonction utilise les super formules en partant de
|
||||||
|
la valeur indiquée *)
|
||||||
|
exception ContradictionException of int * int array;;
|
||||||
|
|
||||||
|
(* Renvoie la LISTE des valeurs non associées dans arr *)
|
||||||
|
(* Suppose que arr\{-1} est bijective (assurée par l'involutivité de phi) *)
|
||||||
|
(* Bien entendu, on oublie le zéro *)
|
||||||
|
let missingValues arr =
|
||||||
|
let n = Array.length arr in
|
||||||
|
let rec aux arr i l =
|
||||||
|
if i=0 then l else
|
||||||
|
if (arr.(i)=(-1)) then
|
||||||
|
aux arr (i-1) (i::l)
|
||||||
|
else aux arr (i-1) l
|
||||||
|
in aux arr (n-1) [];;
|
||||||
|
|
||||||
|
|
||||||
|
(* Remplis la table avec les valeurs qu'impliquent la valeur en k, supposée déjà
|
||||||
|
imposée par une fonction exterieure. Renvoie une ContradictionException si l'une
|
||||||
|
des implications est impossible avec une des valeurs déjà mises, ou impliquées
|
||||||
|
d'une autre manière *)
|
||||||
|
let remplis tble k =
|
||||||
|
let n = Array.length tble in
|
||||||
|
let queue = ref [k] in
|
||||||
|
while !queue<>[]
|
||||||
|
do
|
||||||
|
let el = pop queue in
|
||||||
|
(* Test de l'involutivité *)
|
||||||
|
begin
|
||||||
|
match tble.(tble.(el)) with
|
||||||
|
| -1 -> (tble.(tble.(el)) <- el;push queue tble.(el))
|
||||||
|
| x when x=el -> ()
|
||||||
|
| _ -> raise (ContradictionException(el,tble))
|
||||||
|
end;
|
||||||
|
(* Test de la formule d'opposition *)
|
||||||
|
let opv = (n+tble.(el)-el) mod n in
|
||||||
|
match tble.(n-el) with
|
||||||
|
| -1 -> (tble.(n-el) <- opv;push queue (n-el))
|
||||||
|
| x when x=opv-> ()
|
||||||
|
| _ -> raise (ContradictionException(el,tble))
|
||||||
|
done;;
|
||||||
|
|
||||||
|
(* Efface (met -1) dans les cases de tble d'index les éléments de mv (liste) *)
|
||||||
|
let rec cleanTable tble mv = match mv with
|
||||||
|
| [] -> ()
|
||||||
|
| e::s -> tble.(e) <- (-1);cleanTable tble s;;
|
||||||
|
|
||||||
|
|
||||||
|
(* Rajoute à la pile d'entrée, à partir d'un tableau représentant une fonction phi partielle (-1 pour
|
||||||
|
les valeurs encore indéfinies) l'ensemble de toutes les fonctions phi réelles
|
||||||
|
respectant la transitivité (créant donc un corps) et étendant la fonction partielle. *)
|
||||||
|
let rec exploite tble res =
|
||||||
|
let mv = missingValues tble in
|
||||||
|
match mv with
|
||||||
|
| [] -> if estTransitif tble then push res tble (* Toutes les valeurs sont fixées: pas quarante-douze solutions ...*)
|
||||||
|
| k::r -> (* On séléctionne un des éléments indéfinis. On va tester toutes les valeurs sur lui *)
|
||||||
|
let rec traite tble k mv mm res =
|
||||||
|
(* Traite à partir de la table tble, l'index de tests k, les valeurs manquantes mv,
|
||||||
|
et les valeurs manquantes pas encore essayées mm, res la pile où mettre les bons *)
|
||||||
|
begin
|
||||||
|
match mm with [] -> () (* Alors, on a testé toutes les valeurs manquantes *)
|
||||||
|
| m::rr -> (* On doit tester arr.(k)<-m, puis reste tout rr à tester *)
|
||||||
|
if k<>m then (* Un point ne peut etre son image *)
|
||||||
|
begin
|
||||||
|
cleanTable tble mv; (* Enlève toutes les valeurs des essais précedents *)
|
||||||
|
tble.(k) <- m; (* Place la bonne valeur de test s*)
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
remplis tble k; (* Tente de remplir avec les implications le l'index k*)
|
||||||
|
if arrmem tble (-1) (* Si des cases restent indéterminées malgrès notre valeur arr.(k) *)
|
||||||
|
then (* On déscend d'un étage *)
|
||||||
|
(exploite tble res)
|
||||||
|
else (* Ben on sauvegarde si c'est effectivement transitif et on continue *)
|
||||||
|
if (estTransitif tble) then push res (Array.copy tble)
|
||||||
|
with ContradictionException(el,arr) -> () (* Si il y a eu une contradiction on ne stoque rien, ni n'essaye rien*)
|
||||||
|
end(*try*)
|
||||||
|
end(*if k<>m*);
|
||||||
|
traite tble k mv rr res (* Dans tous les cas, on teste le reste *)
|
||||||
|
end
|
||||||
|
in traite tble k mv mv res;; (* On applique la fonctions auxilière *)
|
||||||
|
|
||||||
|
(* Fonction faisant appel à exploite afin de renvoyer la liste-ensemble des tables créant un
|
||||||
|
corps sur {0}u{a pow k pour k dans [0,n-1] *)
|
||||||
|
let trouve n =
|
||||||
|
let arr = (Array.make n (-1)) in
|
||||||
|
arr.(0) <- 0;
|
||||||
|
let res = ref [] in
|
||||||
|
exploite arr res;
|
||||||
|
!res;;
|
||||||
|
|
||||||
|
(** Tests **)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for m=1 to 10 do
|
||||||
|
let i = (1 lsl m)-1 in
|
||||||
|
let t0 = Sys.time () in
|
||||||
|
print_int i;
|
||||||
|
foreach (trouve i) printtbl;
|
||||||
|
print_endline ";";
|
||||||
|
print_string "Temps écoulé: ";
|
||||||
|
print_float ((Sys.time ()) -. t0);
|
||||||
|
print_endline "."
|
||||||
|
done;;
|
||||||
|
|||||||
Reference in New Issue
Block a user