Mathc matrices/a72
Fonctions matricielles ex : cos(A)
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 = rEsymmetric_mR(i_mR(RCA,RCA),999,+1.E-3);
double **LogA_EValue = i_mR(RCA,RCA);
double **LogA = i_mR(RCA,RCA);
double **Exp_LogA_EValue = i_mR(RCA,RCA);
double **Exp_LogA = i_mR(RCA,RCA);
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();
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mR(A,"A", P4);
printf(" logm (A)\n\n\n");
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);
printf(" LogA");
f_eigs_mR(log,EValue, LogA_EValue);
mul_mR(V,LogA_EValue,T);
mul_mR(T,V_T,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");
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);
printf(" Exp_LogA = A");
f_eigs_mR(exp,LogA_EValue, Exp_LogA_EValue);
mul_mR(V,Exp_LogA_EValue,T);
mul_mR(T,V_T,Exp_LogA);
p_mR(Exp_LogA, S9,P4, C6);
printf(" A :");
p_mR(A, S9,P4, C6);
stop();
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.9939,+1.1424,-0.3395,+0.0540;
+1.1424,+1.4103,-0.2939,-0.0653;
-0.3395,-0.2939,+1.1045,-0.2012;
+0.0540,-0.0653,-0.2012,+0.2739]
logm (A)
LogA
-2.0293 +2.3685 -0.2946 +0.6056
+2.3685 -1.1338 -0.1245 -0.5918
-0.2946 -0.1245 +0.0009 -0.3550
+0.6056 -0.5918 -0.3550 -1.5829
Press return to continue.
Copy/Past into the octave window.
LogA=[
-2.0293,+2.3685,-0.2946,+0.6056;
+2.3685,-1.1338,-0.1245,-0.5918;
-0.2946,-0.1245,+0.0009,-0.3550;
+0.6056,-0.5918,-0.3550,-1.5829]
expm (LogA)
Exp_LogA = A
+0.9939 +1.1424 -0.3395 +0.0540
+1.1424 +1.4103 -0.2939 -0.0653
-0.3395 -0.2939 +1.1045 -0.2012
+0.0540 -0.0653 -0.2012 +0.2739
A :
+0.9939 +1.1424 -0.3395 +0.0540
+1.1424 +1.4103 -0.2939 -0.0653
-0.3395 -0.2939 +1.1045 -0.2012
+0.0540 -0.0653 -0.2012 +0.2739
Press return to continue.