Mathc matrices/c12fn
Installer et compiler ces fichiers dans votre répertoire de travail.
cgn0g.c |
---|
/* ------------------------------------ */
/* Save as : cgn0g.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-0
/* ------------------------------------ */
void fun(int r,int c)
{
double **B = r_mR(i_mR(c,r),9.);
double **Pinv = i_mR(r,c);
double **PinvB = i_mR(r,r);
clrscrn();
printf(" Copy/Past into the octave windows \n\n\n");
p_Octave_mR(B,"B",P2);
printf("pinv(B)\n\n\n");
stop();
clrscrn();
printf(" Pinv = V * invS_T * U_T ");
pseudo_Rn_mR(B,Pinv,FACTOR_E);
pE_mR(Pinv,S12,P4,C10);
printf(" Ide = PseudoInverse * B ");
mul_mR(Pinv,B,PinvB);
p_mR(PinvB,S10,P6,C10);
f_mR(B);
f_mR(Pinv);
f_mR(PinvB);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
int i;
do
{
i = rp_I(R3)+R1;
fun(i,i+R0);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
Copy/Past into the octave windows
B=[
+7.00,+6.00,-8.00;
-5.00,-1.00,-2.00;
+1.00,+5.00,+8.00]
pinv(B)
Press return to continue.
------------------------------------
Pinv = V * invS_T * U_T
+4.6083e-03 -2.0276e-01 -4.6083e-02
+8.7558e-02 +1.4747e-01 +1.2442e-01
-5.5300e-02 -6.6820e-02 +5.2995e-02
Ide = PseudoInverse * B
+1.000000 -0.000000 -0.000000
+0.000000 +1.000000 +0.000000
+0.000000 +0.000000 +1.000000
Press return to continue
Press X to stop