Mathc matrices/01z
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 = rupper_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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
-2, -9, +2, -4,
+0, +1, -5, -7,
+0, +0, -8, -4,
+0, +0, +0, +3
Copy/Past into the octave windows
a=[
-2,-9,+2,-4;
+0,+1,-5,-7;
+0,+0,-8,-4;
+0,+0,+0,+3]
[Q, R] = qr (a,0)
Press return to continue.
Q :
-1.000 +0.000 +0.000 +0.000
+0.000 +1.000 +0.000 +0.000
+0.000 +0.000 -1.000 +0.000
+0.000 +0.000 +0.000 +1.000
R :
+2.000 +9.000 -2.000 +4.000
+0.000 +1.000 -5.000 -7.000
+0.000 +0.000 +8.000 +4.000
+0.000 +0.000 +0.000 +3.000
Press return to continue.
A :
-2 -9 +2 -4
+0 +1 -5 -7
+0 +0 -8 -4
+0 +0 +0 +3
A = Q * R :
-2.000 -9.000 +2.000 -4.000
+0.000 +1.000 -5.000 -7.000
+0.000 +0.000 -8.000 -4.000
+0.000 +0.000 +0.000 +3.000
Press return to continue
Press X return to stop