Mathc matrices/a72
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC4
/* ------------------------------------ */
void fun(void)
{
double **A;
double **LogA_EValue;
double **LogA;
double **Exp_LogA_EValue;
double **Exp_LogA;
double **V = i_mR(RCA,RCA);
double **V_T = i_mR(RCA,RCA);
double **EValue = i_mR(RCA,RCA);
double **T = i_mR(RCA,RCA);
clrscrn();
A = rEsymmetric_mR(i_mR(RCA,RCA),999,+1.E-3);
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mR(A,"A", P4);
printf(" logm (A)\n\n\n");
stop();
clrscrn();
LogA_EValue = i_mR(RCA,RCA);
LogA = i_mR(RCA,RCA);
printf(" A :");
p_mR(A, S9,P4, C6);
eigs_V_mR(A,V);
transpose_mR(V,V_T);
/* EValue = V_T * A * V */
mul_mR(V_T,A,T);
mul_mR(T,V,EValue);
f_eigs_mR(log,EValue, LogA_EValue);
printf(" LogA_EValue :");
p_mR( LogA_EValue, S9,P4, C6);
/* Log_A = V * Log_EValue * V_T*/
mul_mR(V,LogA_EValue,T);
mul_mR(T,V_T,LogA);
printf(" LogA");
p_mR(LogA, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mR(LogA, "LogA", P4);
printf(" expm (LogA)\n\n\n");
stop();
clrscrn();
Exp_LogA_EValue = i_mR(RCA,RCA);
Exp_LogA = i_mR(RCA,RCA);
printf(" LogA :");
p_mR(LogA, S9,P4, C6);
eigs_V_mR(LogA,V);
transpose_mR(V,V_T);
/* LogA_EValue = V_T * LogA * V */
mul_mR(V_T,LogA,T);
mul_mR(T,V,LogA_EValue);
f_eigs_mR(exp,LogA_EValue, Exp_LogA_EValue);
printf(" Exp_LogA_EValue :");
p_mR( Exp_LogA_EValue, S9,P4, C6);
/* A = V * Exp_LogA_EValue * V_T*/
mul_mR(V,Exp_LogA_EValue,T);
mul_mR(T,V_T,Exp_LogA);
printf(" Exp_LogA = A");
p_mR(Exp_LogA, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" A :");
p_mR(A, S9,P4, C6);
printf(" Exp_LogA = A");
p_mR(Exp_LogA, S9,P4, C6);
f_mR(A);
f_mR(LogA_EValue);
f_mR(LogA);
f_mR(V);
f_mR(V_T);
f_mR(EValue);
f_mR(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exp( Log(A) ) = A Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
A=[
+0.518077,+0.298678,+0.037850,+0.473112;
+0.298678,+0.886789,-0.131354,+0.106374;
+0.037850,-0.131354,+0.167632,+0.074242;
+0.473112,+0.106374,+0.074242,+0.983313]
logm (A)
Press return to continue.
------------------------------------
A :
+0.518077 +0.298678 +0.037850 +0.473112
+0.298678 +0.886789 -0.131354 +0.106374
+0.037850 -0.131354 +0.167632 +0.074242
+0.473112 +0.106374 +0.074242 +0.983313
LogA_EValue :
+0.340046 +0.000000 +0.000000 +0.000000
+0.000000 -0.160656 +0.000000 +0.000000
+0.000000 +0.000000 -1.673080 +0.000000
+0.000000 +0.000000 +0.000000 -2.193323
LogA
-1.212593 +0.545518 +0.214310 +0.811561
+0.545518 -0.266332 -0.387924 -0.018234
+0.214310 -0.387924 -1.951646 +0.121175
+0.811561 -0.018234 +0.121175 -0.256441
Press return to continue.
------------------------------------
Copy/Past into the octave window.
LogA=[
-1.212593,+0.545518,+0.214310,+0.811561;
+0.545518,-0.266332,-0.387924,-0.018234;
+0.214310,-0.387924,-1.951646,+0.121175;
+0.811561,-0.018234,+0.121175,-0.256441]
expm (LogA)
Press return to continue.
------------------------------------
LogA :
-1.2126 +0.5455 +0.2143 +0.8116
+0.5455 -0.2663 -0.3879 -0.0182
+0.2143 -0.3879 -1.9516 +0.1212
+0.8116 -0.0182 +0.1212 -0.2564
Exp_LogA_EValue :
+0.1115 +0.0000 +0.0000 +0.0000
+0.0000 +0.1877 +0.0000 +0.0000
+0.0000 +0.0000 +1.4050 +0.0000
+0.0000 +0.0000 +0.0000 +0.8516
Exp_LogA
+0.5181 +0.2987 +0.0378 +0.4731
+0.2987 +0.8868 -0.1314 +0.1064
+0.0378 -0.1314 +0.1676 +0.0742
+0.4731 +0.1064 +0.0742 +0.9833
Press return to continue.
------------------------------------
A :
+0.5181 +0.2987 +0.0378 +0.4731
+0.2987 +0.8868 -0.1314 +0.1064
+0.0378 -0.1314 +0.1676 +0.0742
+0.4731 +0.1064 +0.0742 +0.9833
Exp_LogA
+0.5181 +0.2987 +0.0378 +0.4731
+0.2987 +0.8868 -0.1314 +0.1064
+0.0378 -0.1314 +0.1676 +0.0742
+0.4731 +0.1064 +0.0742 +0.9833
Press return to continue
Press X to stop