Application


Installer et compiler ces fichiers dans votre répertoire de travail.


cof_r.c
/* ------------------------------------ */
/*  Save as :   cof_r.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR(i_mR(r,r),99.);

int minor_r = rp_I(r);
int minor_c = rp_I(r);

  clrscrn();
  printf(" A :");
  p_mR(A,S5,P0,C6);

  printf("    minor(R%d,C%d) = %+.3f\n"
         " cofactor(R%d,C%d) = %+.3f\n\n\n",
               minor_r,
               minor_c,
               minor_R(A, minor_r, minor_c),
               minor_r,
               minor_c,
               cofactor_R(A, minor_r, minor_c));
               
  printf(" cofactor(R%d,C%d) = minor(R%d,C%d)*(-1**(R%d+C%d))\n"
         "                 = minor(R%d,C%d)*(%0.0f)\n",
               minor_r,
               minor_c,         
               minor_r,
               minor_c,
               minor_r,
               minor_c,
               minor_r,
               minor_c,
               pow(-1,(minor_r+minor_c)));

  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC5)+C1);

 } while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


On calcul un cofacteur.



Exemple de sortie écran :
 A :
   -4   -22   +11   -38 
  +89   -35   +37   +91 
   +6   +24   +37   -26 
  -68   -15   -95   +77 

    minor(R1,C4) = -28361.000
 cofactor(R1,C4) = +28361.000


 cofactor(1,4) = minor(R1,C4)*(-1**(R1+C4))
               = minor(R1,C4)*(-1)

 Press return to continue
 Press X      to stop    
  
*********************************
 A :
  -42   +26   -42 
  +81   -18   -90 
  +80   +31   -61 

    minor(R3,C1) = -3096.000
 cofactor(R3,C1) = -3096.000


 cofactor(R3,C1) = minor(R3,C1)*(-1**(R3+C1))
                 = minor(R3,C1)*(1)

 Press return to continue
 Press X      to stop