Mathc matrices/000
Installer et compiler ces fichiers dans votre répertoire de travail.
c0a4.c |
---|
/* ------------------------------------ */
/* Save as : c0a4.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rdiag_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 diagonale A, correspondent bien aux valeurs qui se trouvent sur la diagonale.
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
+165,+0,+0,+0;
+0,-63,+0,+0;
+0,+0,-163,+0;
+0,+0,+0,-179]
[V, E] = eigs (a,4)
Press return to continue.
EigsVector:
+1.000000 +0.000000 +0.000000 +0.000000
+0.000000 +1.000000 +0.000000 +0.000000
+0.000000 +0.000000 +1.000000 +0.000000
+0.000000 +0.000000 +0.000000 +1.000000
EigsValue :
+165.000000
-63.000000
-163.000000
-179.000000
Press return to continue
Press X return to stop