Mathc matrices/021
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rsymmetric_mR(i_mR(r,r),9.);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
clrscrn();
printf(" A :");
P_mR(A,S3,P0,C4);
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mR(A,"a",P0);
printf(" [Q, R] = qr (a,0) \n\n");
stop();
clrscrn();
QR_mR(A,Q,R);
printf(" Q :");
p_mR(Q,S8,P3,C4);
printf(" R :");
p_mR(R,S8,P3,C4);
stop();
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C4);
printf(" A = Q * R :");
mul_mR(Q,R, A);
p_mR(A,S8,P3,C4);
f_mR(A);
f_mR(Q);
f_mR(R);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Calculer la QR décomposition d'une matrice symétrique
Exemple de sortie écran :
A :
-2, +8, +5,
+8, +9, -8,
+5, -8, -9
Copy/Past into the octave windows
a=[
-2,+8,+5;
+8,+9,-8;
+5,-8,-9]
[Q, R] = qr (a,0)
Press return to continue.
Q :
-0.207 +0.581 -0.787
+0.830 +0.531 +0.173
+0.518 -0.617 -0.592
R :
+9.644 +1.659 -12.340
-0.000 +14.361 +4.211
-0.000 +0.000 +0.007
Press return to continue.
A :
-2 +8 +5
+8 +9 -8
+5 -8 -9
A = Q * R :
-2.000 +8.000 +5.000
+8.000 +9.000 -8.000
+5.000 -8.000 -9.000
Press return to continue
Press X return to stop