Mathc matrices/c12b17
Apparence
Installer ce fichier dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R3
#define CA C5
/* ------------------------------------ */
#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(RA,RA);
clrscrn();
printf(" A :");
p_mR(A,S7,P2,C7);
printf(" PseudoInverse = V * invS_T * U_T ");
Pinv_Cn_mR(A,Pinv,FACTOR_E);
pE_mR(Pinv,S12,P4,C10);
printf(" Ide = A * Pinv ");
mul_mR(A,Pinv,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 colonnes que de lignes.
Pinv_Cn_mR(A,Pinv,FACTOR_E);
Exemple de sortie écran :
------------------------------------
A :
+9.00 +3.00 -4.00 -2.00 +5.00
-3.00 +1.00 +6.00 +4.00 +5.00
+6.00 -1.00 -3.00 +9.00 +5.00
PseudoInverse = V * invS_T * U_T
+5.2041e-02 -2.1138e-02 +1.8845e-02
+4.9634e-02 +3.8999e-02 -3.5594e-02
+8.0140e-03 +8.1849e-02 -3.6351e-02
-5.9396e-02 +9.7580e-04 +8.6410e-02
+5.9198e-02 +8.0518e-02 -7.0809e-03
Ide = A * Pinv
+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