Mathc complexes/Fichiers c : mul tran
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r,int rc)
{
double **A = r_mZ( i_mZ(r,rc),99);
double **A_CT = ctranspose_mZ(A, i_mZ(rc,r));
double **AA_CT = mul_mZ(A,A_CT, i_mZ(r, r)) ;
clrscrn();
printf(" A[R%d,C%d] : \n",rsize_Z(A),csize_Z(A));
p_mZ(A, S4,P0, S4,P0, C4);
printf(" A_CT[R%d,C%d] : Conjugate Transpose\n",
rsize_Z(A_CT),csize_Z(A_CT));
p_mZ(A_CT, S4,P0, S4,P0, C4);
printf(" AA_CT[R%d,C%d] : \n",rsize_Z(AA_CT),csize_Z(AA_CT));
p_mZ(AA_CT, S7,P0, S7,P0, C4);
f_mZ(A);
f_mZ(A_CT);
f_mZ(AA_CT);
}
/* ------------------------------------ */
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[R4,C2] :
+57 -97i +96 +59i
+93 -2i +34 +17i
-32 +99i +92 -19i
-97 -67i -58 +67i
A_CT[R2,C4] : Conjugate Transpose
+57 +97i +93 +2i -32 -99i -97 +67i
+96 -59i +34 -17i +92 +19i -58 -67i
AA_CT[R4,C4] :
+25355 +0i +9762 -8533i -3716 +4713i -645 +3374i
+9762 +8533i +10098 +0i -369 -6933i -9720 +3161i
-3716 -4713i -369 +6933i +19650 +0i -10138 -16809i
-645 -3374i -9720 -3161i -10138 +16809i +21751 +0i
Press return to continue
Press X return to stop
Press X to stop