Mathc matrices/c20a
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00l.c |
---|
/* ------------------------------------ */
/* Save as : c00l.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_diag.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rpdiag_mR(i_mR(r,r),9.);
double **U = r_mR(i_mR(r,r),9.);
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
double **QR = i_mR(r,r);
clrscrn();
printf(" A :");
p_mR(A,S3,P3,C6);
printf(" U :");
p_mR(U,S3,P3,C6);
stop();
clrscrn();
printf(" U :");
p_mR(U,S3,P3,C6);
QR_Diag_mR(A,U,Q,R);
printf(" Q : with QR_Diag_mR(A,U,Q,R);");
p_mR(Q,S3,P5,C6);
printf(" R :");
p_mR(R,S10,P5,C6);
printf(" U = Q * R :");
mul_mR(Q,R, QR);
p_mR(QR,S3,P3,C6);
stop();
clrscrn();
printf(" U :");
p_mR(U,S3,P3,C6);
QR_mR(U,Q,R);
printf(" Q : with QR_mR(U,Q,R);");
p_mR(Q,S3,P5,C6);
printf(" R :");
p_mR(R,S10,P5,C6);
printf(" U = Q * R :");
mul_mR(Q,R, QR);
p_mR(QR,S3,P3,C6);
f_mR(A);
f_mR(U);
f_mR(Q);
f_mR(R);
f_mR(QR);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
A :
+1.000 +0.000 +0.000 +0.000
+0.000 +1.000 +0.000 +0.000
+0.000 +0.000 +9.000 +0.000
+0.000 +0.000 +0.000 +6.000
U :
-7.000 +6.000 -6.000 +4.000
+8.000 +8.000 -6.000 +2.000
+2.000 -4.000 +6.000 -4.000
+1.000 -6.000 +3.000 +5.000
Press return to continue.
------------------------------------
U :
-7.000 +6.000 -6.000 +4.000
+8.000 +8.000 -6.000 +2.000
+2.000 -4.000 +6.000 -4.000
+1.000 -6.000 +3.000 +5.000
Q : with QR_Diag_mR(A,U,Q,R);
-0.56225 +0.10422 +0.13588 +0.80904
+0.64258 +0.61260 -0.21950 +0.40452
+0.16064 -0.14235 +0.23867 +0.08989
+0.08032 -0.26817 -0.26480 +0.13484
R :
+12.44990 -6.90769 +9.63863 -4.33738
-0.00000 +20.30477 -16.81473 -1.27858
-0.00000 +0.00000 +8.62331 -16.43133
-0.00000 +0.00000 -0.00000 +4.85424
U = Q * R :
-7.000 +6.000 -6.000 +4.000
+8.000 +8.000 -6.000 +2.000
+2.000 -4.000 +6.000 -4.000
+1.000 -6.000 +3.000 +5.000
Press return to continue.
------------------------------------
U :
-7.000 +6.000 -6.000 +4.000
+8.000 +8.000 -6.000 +2.000
+2.000 -4.000 +6.000 -4.000
+1.000 -6.000 +3.000 +5.000
Q : with QR_mR(U,Q,R);
-0.64440 +0.52610 -0.01660 +0.55470
+0.73646 +0.60598 -0.11618 +0.27735
+0.18411 -0.33604 +0.73857 +0.55470
+0.09206 -0.49304 -0.66388 +0.55470
R :
+10.86278 +0.73646 +0.82852 -1.38086
+0.00000 +12.30681 -10.28781 +2.19528
+0.00000 -0.00000 +3.23643 -6.57244
+0.00000 -0.00000 +0.00000 +3.32820
U = Q * R :
-7.000 +6.000 -6.000 +4.000
+8.000 +8.000 -6.000 +2.000
+2.000 -4.000 +6.000 -4.000
+1.000 -6.000 +3.000 +5.000
Press return to continue
Press X to stop