Mathc matrices/002
Installer et compiler ces fichiers dans votre répertoire de travail.
c0a6.c |
---|
/* ------------------------------------ */
/* Save as : c0a6.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rupper_mR(i_mR(r,r),999.);
double **EigsVector= i_mR(r,r);
double **EigsValue = i_mR(r,C1);
clrscrn();
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mR(A,"a",P0);
printf(" [V, E] = eigs (a,%d) \n\n",r);
stop();
clrscrn();
eigs_V_mR(A,EigsVector);
printf(" EigsVector:");
p_mR(EigsVector,S5,P6,C6);
eigs_mR(A,EigsValue);
printf(" EigsValue :");
p_mR(EigsValue,S13,P6,C1);
f_mR(A);
f_mR(EigsVector);
f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R4)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Je vérifies que les valeurs propres de la matrice triangulaire supérieure A, correspondent bien aux valeurs qui se trouvent sur la diagonale.
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
-981,-719,+941,-263;
+0,-286,+327,+66;
+0,+0,-316,-365;
+0,+0,+0,+48]
[V, E] = eigs (a,4)
Press return to continue.
EigsVector:
+1.000000 +0.719005 +0.769778 +0.360026
+0.000000 -0.695005 -0.635643 +0.451919
+0.000000 -0.000000 +0.058316 +0.577918
+0.000000 +0.000000 +0.000000 -0.576334
EigsValue :
-981.000000
-286.000000
-316.000000
+48.000000
Press return to continue
Press X return to stop