Mathc matrices/01x
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 = rdiag_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 :
-6, +0, +0, +0,
+0, +7, +0, +0,
+0, +0, -8, +0,
+0, +0, +0, -8
Copy/Past into the octave windows
a=[
-6,+0,+0,+0;
+0,+7,+0,+0;
+0,+0,-8,+0;
+0,+0,+0,-8]
[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 :
+6.000 +0.000 +0.000 +0.000
+0.000 +7.000 +0.000 +0.000
+0.000 +0.000 +8.000 +0.000
+0.000 +0.000 +0.000 +8.000
Press return to continue.
A :
-6 +0 +0 +0
+0 +7 +0 +0
+0 +0 -8 +0
+0 +0 +0 -8
A = Q * R :
-6.000 +0.000 +0.000 +0.000
+0.000 +7.000 +0.000 +0.000
+0.000 +0.000 -8.000 +0.000
+0.000 +0.000 +0.000 -8.000
Press return to continue
Press X return to stop