Mathc matrices/a71
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 **ExpA_EValue;
double **ExpA;
double **Log_ExpA_EValue;
double **Log_ExpA;
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", P6);
printf(" expm (A)\n\n\n");
stop();
clrscrn();
ExpA_EValue = i_mR(RCA,RCA);
ExpA = 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(exp,EValue, ExpA_EValue);
printf(" ExpA_EValue :");
p_mR( ExpA_EValue, S9,P4, C6);
/* ExpA = V * ExpA_EValue * V_T*/
mul_mR(V,ExpA_EValue,T);
mul_mR(T,V_T,ExpA);
printf(" ExpA");
p_mR(ExpA, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mR(ExpA,"ExpA", P6);
printf(" logm (ExpA)\n\n\n");
stop();
clrscrn();
Log_ExpA_EValue = i_mR(RCA,RCA);
Log_ExpA = i_mR(RCA,RCA);
printf(" ExpA :");
p_mR(ExpA, S9,P6, C6);
eigs_V_mR(ExpA,V);
transpose_mR(V,V_T);
/* ExpA_EValue = V_T * ExpA * V */
mul_mR(V_T,ExpA,T);
mul_mR(T,V,ExpA_EValue);
f_eigs_mR(log,ExpA_EValue, Log_ExpA_EValue);
printf(" Log_ExpA_EValue :");
p_mR( Log_ExpA_EValue, S9,P6, C6);
/* Log_ExpA = V * Log_ExpA_EValue * V_T*/
mul_mR(V,Log_ExpA_EValue,T);
mul_mR(T,V_T,Log_ExpA);
printf(" Log_ExpA = A");
p_mR(Log_ExpA, S9,P6, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" A :");
p_mR(A, S9,P4, C6);
printf(" Log_ExpA = A");
p_mR(Log_ExpA, S9,P4, C6);
f_mR(A);
f_mR(ExpA_EValue);
f_mR(ExpA);
f_mR(Log_ExpA_EValue);
f_mR(Log_ExpA);
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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Log( Exp(A) ) = A Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
A=[
+1.437449,-0.632466,+0.258349,-1.272949;
-0.632466,+0.776508,+0.090306,+0.558928;
+0.258349,+0.090306,+1.231620,-0.778442;
-1.272949,+0.558928,-0.778442,+1.402866]
expm (A)
Press return to continue.
------------------------------------
A :
+1.4374 -0.6325 +0.2583 -1.2729
-0.6325 +0.7765 +0.0903 +0.5589
+0.2583 +0.0903 +1.2316 -0.7784
-1.2729 +0.5589 -0.7784 +1.4029
ExpA_EValue :
+25.3299 +0.0000 +0.0000 +0.0000
+0.0000 +3.5677 +0.0000 +0.0000
+0.0000 +0.0000 +1.4099 +0.0000
+0.0000 +0.0000 +0.0000 +1.0010
ExpA
+10.5842 -4.6373 +4.0812 -9.7528
-4.6373 +3.9330 -1.4487 +4.5956
+4.0812 -1.4487 +5.3045 -5.3269
-9.7528 +4.5956 -5.3269 +11.4867
Press return to continue.
------------------------------------
Copy/Past into the octave window.
ExpA=[
+10.584236,-4.637283,+4.081228,-9.752775;
-4.637283,+3.933017,-1.448681,+4.595607;
+4.081228,-1.448681,+5.304510,-5.326946;
-9.752775,+4.595607,-5.326946,+11.486747]
logm (ExpA)
Press return to continue.
------------------------------------
ExpA :
+10.584236 -4.637283 +4.081228 -9.752775
-4.637283 +3.933017 -1.448681 +4.595607
+4.081228 -1.448681 +5.304510 -5.326946
-9.752775 +4.595607 -5.326946 +11.486747
Log_ExpA_EValue :
+3.231985 +0.000000 +0.000000 +0.000000
+0.000000 +1.271918 +0.000000 +0.000000
+0.000000 +0.000000 +0.343521 +0.000000
+0.000000 +0.000000 +0.000000 +0.001018
Log_ExpA
+1.437449 -0.632466 +0.258349 -1.272949
-0.632466 +0.776508 +0.090306 +0.558928
+0.258349 +0.090306 +1.231620 -0.778442
-1.272949 +0.558928 -0.778442 +1.402866
Press return to continue.
------------------------------------
A :
+1.4374 -0.6325 +0.2583 -1.2729
-0.6325 +0.7765 +0.0903 +0.5589
+0.2583 +0.0903 +1.2316 -0.7784
-1.2729 +0.5589 -0.7784 +1.4029
Log_ExpA
+1.4374 -0.6325 +0.2583 -1.2729
-0.6325 +0.7765 +0.0903 +0.5589
+0.2583 +0.0903 +1.2316 -0.7784
-1.2729 +0.5589 -0.7784 +1.4029
Press return to continue
Press X to stop