Mathc matrices/c12b18
Installer ce fichier dans votre répertoire de travail.
c01a.c |
---|
/* ------------------------------------ */
/* Save as : c01a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R5
#define CA C3
/* ------------------------------------ */
#define FACTOR_E +1.E-0
/* ------------------------------------ */
void fun(void)
{
double **A = r_mR(i_mR(RA,CA),9);
double **Pinv = i_mR(CA,RA);
double **Ide = i_mR(CA,CA);
clrscrn();
printf(" A :");
p_mR(A,S7,P2,C7);
printf(" Pinv = V * invS_T * U_T ");
Pinv_Rn_mR(A,Pinv,FACTOR_E);
pE_mR(Pinv,S12,P4,C10);
printf(" Ide = Pinv * A ");
mul_mR(Pinv,A,Ide);
p_mR(Ide,S7,P2,C10);
f_mR(A);
f_mR(Pinv);
f_mR(Ide);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Cet version fonctionne quand il y a plus de lignes que de colonnes..
Pinv_Rn_mR(A,Pinv,FACTOR_E); Exemple de sortie écran :
------------------------------------
A :
+7.00 +9.00 -1.00
-6.00 -3.00 -2.00
-9.00 -1.00 -6.00
-5.00 +3.00 -4.00
-8.00 -4.00 -2.00
Pinv = V * invS_T * U_T
+2.7372e-02 -8.5701e-03 +2.5214e-01 -2.7874e-01 -2.0407e-01
+5.1836e-02 -1.8127e-02 -2.4547e-01 +2.8619e-01 +1.5624e-01
-5.8173e-02 -1.9737e-02 -4.9507e-01 +3.7321e-01 +2.8759e-01
Ide = Pinv * A
+1.00 +0.00 -0.00
+0.00 +1.00 -0.00
-0.00 +0.00 +1.00
Press return to continue
Press X to stop