⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aar_octave_scilab_mul.c

📁 一些矩阵运算的C代码实现:矩阵一般运算
💻 C
字号:
/* .c                         freeware     http://groups.yahoo.com/group/mathc/
*/

/* --------------------------------- INCLUDES ------------------------------- */
#include "v_ahfile.h"

/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void AB(int n, int p, int q)
{
mR mA ={n,p,init_mR(n,p)};
mR mB ={p,q,init_mR(p,q)};
mR mAB={n,q,init_mR(n,q)};

/*-------------------------------- PROGRAM ---------------------------------- */
  rnd_mR(&mA,9);
  rnd_mR(&mB,9);

  clrscrn();
  printf(" Copy/Past into the octave/scilab windows \n\n");
  p_mR_octave(&mA,"a");
  p_mR_octave(&mB,"b");
  printf(" a * b\n\n\n");
  getchar();

  mul_mR(&mA,&mB,&mAB);
   p_mR(        &mAB);

    free(mA.pb);
    free(mB.pb);
    free(mAB.pb);
}

void hello(void)
{
  printf("\n Freeware by : xhunga bernard 06000 Nice France.\n");
  printf("\n                                                  ");
  printf("\n            Mutiply two matrices                  ");
  printf("\n            ********************                \n");
  printf("\n The size of mA, mB, mAB : 1x1 ... 6x6.         \n");
  printf("\n     ex : \"multmRR.exe\"                       \n");
  printf("\n You can choose the size :                      \n");
  printf("\n     ex : \"multmRR.exe 2 3 5\" -> 2x3 3x5 = 2x5  ");
  printf("\n          \"multmRR.exe 1 5 2\" -> 1x5 5x2 = 1x2  ");
  printf("\n          \"multmRR.exe 4 2 1\" -> 4x2 2x1 = 4x1  ");
  printf("\n          \"multmRR.exe 5 5 5\" -> 5x5 5x5 = 5x5  ");
  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;
int    p;
int    q;

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


  AB(n,p,q);


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

  return 0;
}












⌨️ 快捷键说明

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