aar_gssjd_r.c

来自「一些矩阵运算的C代码实现:矩阵一般运算」· C语言 代码 · 共 83 行

C
83
字号
/*         .h         freeware           http://groups.yahoo.com/group/mathc/ */

/* --------------------------------- INCLUDES ------------------------------- */
#include "v_ahfile.h"
/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void gjA(int n)
{
int      x;
int m = n+1;

mR mA   ={n,m,init_mR(n,m)};
/*-------------------------------- PROGRAM ---------------------------------- */
          x=   3;
 if(n==4){x=  20;}
 if(n==3){x=  50;}
 if(n==2){x= 100;}
 if(n==1){x=1000;}

  rnd_mR(&mA,x);

  clrscrn();
  printf("                                                       A ");
  p_mR(&mA);

  printf("\n\n GaussJordan elimination of matrix mA \n");
  gaussjordan_mR(&mA);
  p_mR(&mA);

 free(mA.pb);
}

void hello(void)
{
  printf("\n Freeware by : xhunga bernard 06000 Nice France.\n");
  printf("\n                                                  ");
  printf("\n            GaussJordan elimination               ");
  printf("\n            ***********************             \n");
  printf("\n The size of mA : 2x3 ... 5x6.                  \n");
  printf("\n           ex : \"gjf.exe\"                     \n");
  printf("\n You can choose the size :                      \n");
  printf("\n           ex : \"gjf.exe 2\" -> mA 2x3           ");
  printf("\n                \"gjf.exe 3\" -> mA 3x4           ");
  printf("\n                \"gjf.exe 4\" -> mA 4x5           ");
  printf("\n\n                                                ");
  printf("\n Distributed  by :  http://www.simtel.net/        ");
  printf("\n                                                  ");
  printf("\n Press return to continue                          ");
  printf("\n                                                  ");

  getchar();
}

/* --------------------------------- MAIN ----------------------------------- */
int main(int argc, char *argv[])
{
time_t t;
int    n;

/*-------------------------------- PROGRAM ---------------------------------- */
  srand(time(&t));
  hello();
do
{
if( argc == 2 && atoi(argv[1]))
 {  n = atoi(argv[1]); if( n > 6){n=6;}}
else
 {  n = rndp_I(6);}
if( n < 2){n=2;}


  gjA(n);


printf("\n Press 'X' Return to stop\n");
} while(toupper(getchar())!='X');

  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?