Mathc complexes/Fichiers c : mul tran
Installer et compiler ce fichier dans votre répertoire de travail.
mul_ctran.c |
---|
/* ------------------------------------ */
/* Save as : mul_ctran.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r,int rc)
{
double **A = r_mZ(i_mZ(r,rc),99);
double **A_t = i_mZ(rc,r);
double **AA_t = i_mZ(r, r);
clrscrn();
printf(" A[R%d,C%d] : \n",rsize_Z(A),csize_Z(A));
p_mZ(A, S5,P0, S4,P0, C6);
printf(" A_t[R%d,C%d] : \n",rsize_Z(A_t),csize_Z(A_t));
p_mZ(ctranspose_mZ(A,A_t), S5,P0, S4,P0, C6);
printf(" AA_t[R%d,C%d] : \n",rsize_Z(AA_t),csize_Z(AA_t));
p_mZ(mul_mZ(A,A_t,AA_t), S10,P0, S6,P0, C3);
f_mZ(A);
f_mZ(A_t);
f_mZ(AA_t);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(R4),rp_I(RC4));
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Si nous multiplions une matrice par sa transposé conjuguer, l'opération est toujours possible et cela donne une matrice hermitienne.
Exemple de sortie écran :
A[R3,C4] :
+80 +58i -85 +48i -35 +22i -3 -29i
+62 +14i +80 +30i +80 +78i -3 +74i
+44 -7i +68 -49i +82 -29i +66 -9i
A_t[R4,C3] :
+80 -58i +62 -14i +44 +7i
-85 -48i +80 -30i +68 +49i
-35 -22i +80 -78i +82 +29i
-3 +29i -3 -74i +66 +9i
AA_t[R3,C3] :
+21852 +0i -2809+13665i -8463 +1059i
-2809-13665i +29309 +0i +10034+20583i
-8463 -1059i +10034-20583i +21012 +0i
Press return to continue
Press X to stop