#cd "/home/mysaa/Documents/Arbeiten/TIPE2021";; #use "Codes.ml";; (* Test du produit de matrice *) let matest = [0b01110; 0b00101; 0b10111];; print_matrice 5 matest;; produit matest 0b110;; (* -> 0b10010 = 8*) (* Tests des polynomes *) let pol1 = 13 and pol2 = 67;; print_polynome pol1;; print_polynome pol2;; print_polynome (polmul pol1 pol2);; let qt,rst=(poldiveuc pol2 pol1) in print_polynome qt; print_polynome rst;; (* Test des fonctions de base *) deux_puissance 11;; identite 3;; changer_bit 2 6;; respecter 7 [3];; (* Test des Codes *) (* Un classique : code de Hamming (4, 7) 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 -> les 4 premières colonnes : G -> les 3 dernières lignes : H *) let code_hamming = construire_code_lineaire_systematique 4 7 [7; 3; 5; 6] ;; distance_minimale code_hamming;; exception GTROUVE of matrice;; for i=0 to 20 do Random.self_init (); let matPapa = matriceAuPif 9 12 in let code_paparfait = construire_code_lineaire_systematique 12 21 matPapa in let dst = distance_minimale code_paparfait in if dst>1 then raise (GTROUVE matPapa) done;; print_vecteur 21 (encoder code_paparfait 0b011011011001);; print_matrice 3 (suivants 3 (suivants 3 (suivants 3 (suivants 3 [0b000]))));; print_vecteur 7 (encoder code_hamming 0b0100);; decoder code_hamming 0b1010100;; decoder code_hamming 0b0010100;; decoder code_hamming 0b1110000;; print_vecteur 7 21;; (* Tests des codes cycliques *) let cocycl = {ncyc=7;kcyc=4;pol=13};; print_polynome cocycl.pol;; poldiveuc ((deux_puissance 7) +1) cocycl.pol;; print_polynome ((deux_puissance 7) +1);; print_polynome (poldiv ((deux_puissance 7) +1) cocycl.pol);; let cocylined = cycliqueVersLineaire cocycl;; print_matrice 7 cocylined.g;; print_matrice 4 cocylined.h;; distance_minimale cocylined;;