Mathc complexes/011
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A = rdiag_mZ(i_mZ(rc,rc),9);
double **invA = i_mZ(rc,rc);
double **AinvA = i_mZ(rc,rc);
clrscrn();
printf(" A : ");
p_mZ(A, S4,P0, S3,P0, C6);
printf(" invA : ");
p_mZ(inv_mZ(A,invA), S4,P3, S3,P3, C6);
printf(" A * invA : ");
p_mZ(mul_mZ(A,invA,AinvA), S4,P3, S3,P3, C6);
f_mZ(A);
f_mZ(invA);
f_mZ(AinvA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(RC3)+RC1);
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
L'inverse d'une matrice diagonale
Exemple de sortie écran :
A :
-1 -2i +0 +0i +0 +0i +0 +0i
+0 +0i -7 +3i +0 +0i +0 +0i
+0 +0i +0 +0i -1 +2i +0 +0i
+0 +0i +0 +0i +0 +0i +6 +9i
invA :
-0.200+0.400i +0.000+0.000i -0.000+0.000i +0.000+0.000i
+0.000+0.000i -0.121-0.052i +0.000+0.000i +0.000-0.000i
-0.000+0.000i +0.000+0.000i -0.200-0.400i +0.000+0.000i
+0.000+0.000i +0.000-0.000i +0.000+0.000i +0.051-0.077i
A * invA :
+1.000-0.000i +0.000+0.000i +0.000+0.000i +0.000+0.000i
+0.000+0.000i +1.000+0.000i +0.000+0.000i +0.000+0.000i
+0.000+0.000i +0.000+0.000i +1.000+0.000i +0.000+0.000i
+0.000+0.000i +0.000+0.000i +0.000+0.000i +1.000-0.000i
Press return to continue
Press X return to stop