Mathc matrices/00g
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 **U = r_mR( i_mR(R1, r),9);
double **V = r_mR( i_mR(r ,C1),9);
double **A = rToeplitz_mR(U,V,i_mR(r , r) );
double **Q = i_mR(r,r);
double **R = i_mR(r,r);
clrscrn();
printf(" A :");
P_mR(A,S5,P3,C7);
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,P4,C7);
printf(" R :");
p_mR(R,S8,P4,C7);
stop();
clrscrn();
printf(" A :");
p_mR(A,S5,P3,C7);
printf(" A = Q * R :");
mul_mR(Q,R, A);
p_mR(A,S5,P3,C7);
f_mR(A);
f_mR(Q);
f_mR(R);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(RC5)+C2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Matrice de Toeplitz.
Exemple de sortie écran :
A :
-5.000, +5.000, +9.000, +6.000,
+8.000, -5.000, +5.000, +9.000,
-4.000, +8.000, -5.000, +5.000,
+7.000, -4.000, +8.000, -5.000
Copy/Past into the octave windows
a=[
-5,+5,+9,+6;
+8,-5,+5,+9;
-4,+8,-5,+5;
+7,-4,+8,-5]
[Q, R] = qr (a,0)
Press return to continue.
Q :
-0.4029 +0.1762 +0.8759 +0.1984
+0.6447 +0.2796 +0.0801 +0.7070
-0.3223 +0.8898 -0.3225 -0.0214
+0.5641 +0.3148 +0.3498 -0.6785
R :
+12.4097 -10.0728 +5.7213 -1.0476
-0.0000 +5.3422 +1.0539 +6.4483
-0.0000 +0.0000 +12.6947 +2.6151
+0.0000 -0.0000 +0.0000 +10.8390
Press return to continue.
A :
-5.000 +5.000 +9.000 +6.000
+8.000 -5.000 +5.000 +9.000
-4.000 +8.000 -5.000 +5.000
+7.000 -4.000 +8.000 -5.000
A = Q * R :
-5.000 +5.000 +9.000 +6.000
+8.000 -5.000 +5.000 +9.000
-4.000 +8.000 -5.000 +5.000
+7.000 -4.000 +8.000 -5.000
Press return to continue
Press X return to stop