Mathc complexes/016
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)
{
double **A = rupper_mZ(i_mZ(r,r),9.);
double **Q = i_mZ(r,r);
double **R = i_mZ(r,r);
clrscrn();
printf(" A :");
P_mZ(A, S3,P0, S2,P0, C6);
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mZ(A,"a",P0,P0);
printf(" [Q, R] = qr (a,0) \n\n");
stop();
clrscrn();
QR_mZ(A,Q,R);
printf(" Q :");
p_mZ(Q, S8,P4, S8,P4, C6);
printf(" R :");
p_mZ(R, S8,P4, S8,P4, C6);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S8,P4, S8,P4, C6);
printf(" A = Q * R :");
mul_mZ(Q,R, A);
p_mZ(A, S8,P4, S8,P4, C6);
f_mZ(A);
f_mZ(Q);
f_mZ(R);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La QR décomposition d'une matrice triangulaire supérieur
Exemple de sortie écran :
A :
+1,-4, -9,+3, -2,-7, -9,-5,
+0,+0, -2,-9, -8,-7, +8,-8,
+0,+0, +0,+0, +9,+6, -4,+4,
+0,+0, +0,+0, +0,+0, -4,-6
Copy/Past into the octave windows
a=[
+1-4*i,-9+3*i,-2-7*i,-9-5*i;
+0+0*i,-2-9*i,-8-7*i,+8-8*i;
+0+0*i,+0+0*i,+9+6*i,-4+4*i;
+0+0*i,+0+0*i,+0+0*i,-4-6*i]
[Q, R] = qr (a,0)
Press return to continue.
Q :
+0.2425 -0.9701i +0.0000 +0.0000i -0.0000 +0.0000i -0.0000 +0.0000i
+0.0000 +0.0000i -0.2169 -0.9762i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.8321 +0.5547i +0.0000 -0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i -0.5547 -0.8321i
R :
+4.1231 +0.0000i -5.0932 -8.0037i +6.3059 -3.6380i +2.6679 -9.9440i
+0.0000 +0.0000i +9.2195 +0.0000i +8.5688 -6.2910i +6.0741 +9.5449i
-0.0000 +0.0000i +0.0000 -0.0000i +10.8167 -0.0000i -1.1094 +5.5470i
-0.0000 -0.0000i -0.0000 +0.0000i -0.0000 +0.0000i +7.2111 -0.0000i
Press return to continue.
A :
+1.0000 -4.0000i -9.0000 +3.0000i -2.0000 -7.0000i -9.0000 -5.0000i
+0.0000 +0.0000i -2.0000 -9.0000i -8.0000 -7.0000i +8.0000 -8.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +9.0000 +6.0000i -4.0000 +4.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i -4.0000 -6.0000i
A = Q * R :
+1.0000 -4.0000i -9.0000 +3.0000i -2.0000 -7.0000i -9.0000 -5.0000i
+0.0000 -0.0000i -2.0000 -9.0000i -8.0000 -7.0000i +8.0000 -8.0000i
-0.0000 +0.0000i +0.0000 +0.0000i +9.0000 +6.0000i -4.0000 +4.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i -4.0000 -6.0000i
Press return to continue
Press X return to stop