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

📄 yddeter4.h

📁 [[ Complex Matrices : Language c]]
💻 H
字号:
/* xrndf.h                   free ware                     xhunga@tiscali.fr  */

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
complexF cofactor_zF(
PmzF mA,
int ci,
int cj)
{
     int i;
     int j;
     int tci = 0;
     int tcj = 0;
complexF f;

double pbMinor[MXR][MXC*C4];mzF mMinor ={MXR,MXC*C4,&pbMinor[0][0]};

       mMinor.rows=(mA->rows-1);   mMinor.cols=(mA->rows-1)*C4;
/* -------------------------------------------------------------------------- */

  tci = 0;
  for (i=0 ; i<mA->rows ; i++)
   {
    if(i != ci){

    tcj = 0;
    for (j=0; j<mA->cols ; j+=C4)
     {
      if(j != cj*C4)
      {
       *(mMinor.pb+tci *mMinor.cols+tcj+0) = *(mA->pb+i *mA->cols+j+0);
       *(mMinor.pb+tci *mMinor.cols+tcj+1) = *(mA->pb+i *mA->cols+j+1);
       *(mMinor.pb+tci *mMinor.cols+tcj+2) = *(mA->pb+i *mA->cols+j+2);
       *(mMinor.pb+tci *mMinor.cols+tcj+3) = *(mA->pb+i *mA->cols+j+3);

        tcj +=C4;
      }
     }
    tci++; }
   }
          f = det_zF(&mMinor);
    f.r.n = pow(-1,(ci+1+cj+1))* f.r.n;
    f.i.n = pow(-1,(ci+1+cj+1))* f.i.n;

  return(f);
}



/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void    cofactor_mzF(
PmzF mA,
PmzF mCofactor)
{
     int i;
     int j;
complexF f;

  if (mA->rows != mCofactor->rows || mA->cols != mCofactor->cols)
    {
     printf("\n mcofactor() error - matrices different sizes");
     printf("\n Press return to continue");
     getchar();
     exit(1);
    }

 for (i=0 ; i<mA->rows ; i++)
  {
   for (j=0 ; j<mA->cols ; j+=C4)
    {
               f =  cofactor_zF(mA,i, j/C4);

     *(mCofactor->pb+i *mCofactor->cols+j+0) = f.r.n;
     *(mCofactor->pb+i *mCofactor->cols+j+1) = f.r.d;
     *(mCofactor->pb+i *mCofactor->cols+j+2) = f.i.n;
     *(mCofactor->pb+i *mCofactor->cols+j+3) = f.i.d;
    }
  }
}


/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void    adjoint_mzF(
PmzF mCofactor,
PmzF mAdjoint)
{
  if (mCofactor->rows != mAdjoint->rows || mCofactor-> cols != mAdjoint->cols)
    {
     printf("\n adjoint() error - matrices different sizes");
     printf("\n Press return to continue");
     getchar();
     exit(1);
    }

  transpose_mzF(mCofactor,mAdjoint);
}


/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void inverse_mzF(
PmzF  mA,
PmzF  mInverse)
{
int      row;
int      n;
complexF f;

double pCofact[MXR][MXC*C4];mzF mCofact={MXR,MXC*C4,&pCofact[0][0]};

 n = mA->rows;
               mCofact.rows=n;
               mCofact.cols=n*C4;

     cofactor_mzF(mA,&mCofact);
      adjoint_mzF(   &mCofact,mInverse);
      f = det_zF(mA);
      f = inv_zF(f);

    for ( row = 0; row < mA->rows ; row++)
     {
        mulrow_mzF(mInverse,row,f);
     }
}


⌨️ 快捷键说明

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