Mathc matrices/03l
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00c.c |
|---|
/* ------------------------------------ */
/* Save as : c00c.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC5
/* ------------------------------------ */
void fun(void)
{
/* Choose your Eigenvalues */
double d[RCA*RCA] ={
+.0001,+0, +0, +0, +0,
+0, +2, +0, +0, +0,
+0, +0, +3, +0, +0,
+0, +0, +0, +4, +0,
+0, +0, +0, +0, +5000
};
double **D = ca_A_mR(d, i_mR(RCA,RCA));
double **A = rdefpos_diag_mR(D, i_mR(RCA,RCA),9);
double **invA = invgj_mR(A, i_mR(RCA,RCA));
double **AinvA = mul_mR(A,invA, i_mR(RCA,RCA));
double **EigsValue = eigs_mR(A, i_mR(RCA,C1));
double cond = EigsValue[R1][C1]/EigsValue[RCA][C1];
clrscrn();
printf(" Copy/Paste into the octave windows \n\n");
p_Octave_mR(A,"a",P12);
printf(" EigenValues = eigs (a,%d) \n\n",RCA);
printf(" EigenValues: cond = EvalueMax / EvalueMin = %.e",cond);
p_mR(EigsValue, S15,P8,C1);
stop();
clrscrn();
printf(" invA:");
p_mR(invA, S13,P4,C5);
printf(" cond = EvalueMax / EvalueMin = %.e\n\n"
" Id != A invA:",cond);
p_mR(AinvA, S13,P9,C5);
f_mR(A);
f_mR(D);
f_mR(invA);
f_mR(AinvA);
f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun();
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
devient important et des erreurs s'installent.
Exemple de sortie écran :
Copy/Paste into the octave windows
a=[
+390.350839097354,+700.952512695984,+375.362966860212,+95.653901028580,+1071.632939354768;
+700.952512695983,+1271.765345629617,+677.855978046331,+172.881426238134,+1937.374711331638;
+375.362966860212,+677.855978046331,+365.210265644355,+91.098128648170,+1034.262940674683;
+95.653901028580,+172.881426238134,+91.098128648170,+25.779607662145,+262.455546075236;
+1071.632939354768,+1937.374711331639,+1034.262940674684,+262.455546075236,+2955.894041966529]
EigenValues = eigs (a,5)
EigenValues: cond = EvalueMax / EvalueMin = 5e+07
+5000.00000000
+4.00000000
+3.00000000
+2.00000000
+0.00010000
Press return to continue.
invA:
+3106.9928 +3106.6573 -776.7131 -1941.6748 -2718.4284
+3106.6573 +3106.9314 -776.6737 -1941.6902 -2718.4988
-776.7131 -776.6737 +194.4948 +485.5087 +679.4818
-1941.6748 -1941.6902 +485.5087 +1213.9398 +1698.9091
-2718.4284 -2718.4988 +679.4818 +1698.9091 +2378.7248
cond = EvalueMax / EvalueMin = 5e+07
Id != A invA:
+0.999997705 -0.000002295 +0.000000574 +0.000001434 +0.000002008
-0.000004147 +0.999995853 +0.000001037 +0.000002593 +0.000003629
-0.000002215 -0.000002215 +1.000000554 +0.000001385 +0.000001939
-0.000000563 -0.000000563 +0.000000141 +1.000000352 +0.000000492
-0.000006328 -0.000006329 +0.000001583 +0.000003956 +1.000005536
Press return to continue
Press X return to stop