Mathc matrices/03w
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00d.c |
|---|
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC5
/* ------------------------------------ */
void fun(void)
{
/* Choose your Eigenvalues */
double d[RCA*RCA] ={
+.000001,+0, +0, +0, +0,
+0, +2, +0, +0, +0,
+0, +0, +3, +0, +0,
+0, +0, +0, +4, +0,
+0, +0, +0, +0, +50000
};
double **D = ca_A_mR(d, i_mR(RCA,RCA));
double **A = rdefpos_diag_mR(D, i_mR(RCA,RCA),99);
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,P12,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=[
+3275.142719576244,-7425.649584479188,+3303.018099231511,-8822.199251122745,-3012.039090839546;
-7425.649584479193,+16847.065912862912,-7489.148010939501,+20012.839185063374,+6834.644725557700;
+3303.018099231513,-7489.148010939500,+3331.628468728962,-8898.326457203217,-3038.883729595251;
-8822.199251122747,+20012.839185063367,-8898.326457203213,+23779.308380428469,+8118.642845260380;
-3012.039090839548,+6834.644725557699,-3038.883729595251,+8118.642845260383,+2775.854519403410]
EigenValues = eigs (a,5)
EigenValues: cond = EvalueMax / EvalueMin = 5e+10
+50000.00000011
+4.00039962
+3.00020741
+2.00002631
+0.00000100
Press return to continue.
invA:
+417000.3086 +130032.2600 -443903.2446 -67257.9683 -156935.4557
+130032.2600 +40547.9803 -138421.3716 -20973.1225 -48936.9855
-443903.2446 -138421.3716 +472542.4413 +71597.3459 +167060.3503
-67257.9683 -20973.1225 +71597.3459 +10848.2774 +25312.1809
-156935.4557 -48936.9855 +167060.3503 +25312.1809 +59062.0319
cond = EvalueMax / EvalueMin = 5e+10
Id != A invA:
+0.999999880791 -0.000000059605 +0.000000000000 +0.000000014901 +0.000000029802
-0.000000715256 +1.000000000000 +0.000000238419 +0.000000059605 +0.000000059605
+0.000000357628 +0.000000000000 +0.999999821186 -0.000000014901 +0.000000000000
-0.000000476837 -0.000000059605 +0.000000476837 +1.000000029802 -0.000000059605
+0.000000000000 +0.000000059605 -0.000000059605 +0.000000000000 +0.999999880791
Press return to continue
Press X return to stop