*/
Want to see what people are talking about? See the latest forum posts.
*/

View \xcrwmni.h

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


/* xdfrwmni.h                   freeware                   [[Email Removed]]  */

/* ------------------------------ FUNCTION ---------------------- frowminiF() */
/* Do    : apply miniF() on a row                                             */
/* Call  : miniF()                                                            */
/* Debug : printmF(m); getchar();                                             */
/* -------------------------------------------------------------------------- */
void frowminiF(
pmatrix m,
int     row)
{
  int    j;
double   t;
fraction f;

 for ( j = 0 ; j < m->cols ; j++,j++ )
    {
     f.numer = *(m->pblock+row *m->cols+j  );
     f.denom = *(m->pblock+row *m->cols+j+1);

     f = miniF(f);

     *(m->pblock+row *m->cols+j  ) = f.numer;
     *(m->pblock+row *m->cols+j+1) = f.denom;

    }
}


/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
fraction rowminiF(
pmatrix m,
    int row,
fraction deter)
{
     int j;
     int i;
  double ValueOfN;
     int nb1er;
     int ttrue;
     int row0;

/* ************************************************************************** */
/* In this function 0 = 0/0. In other part 0 = 0/1.                           */
/* Why :  rowminiF(1, 2, 4, 6, 8) = 1, 2, 4, 6, 8                             */
/*        rowminiF(0, 2, 4, 6, 8) = 0, 1, 2, 3, 4                             */
/*        0 is a multiple of any numbers                                      */
/*        1 is a multiple of 1                                                */
/* ************************************************************************** */
row0 = 0;
for (j = 0;  j < m->cols ; j++, j++)
{
 ValueOfN = *(m->pblock+row *m->cols+j);
 if(!ValueOfN)
 {
 *(m->pblock+row *m->cols+j+1) = 0;
   row0++;
 }
}
/* ************************************************************************** */

if((row0 * TWOCOL) != (m->cols))
{
for(i = 0; i < 2 ; i++)
{

      nb1er = FIRSTNB1ER;
while(nb1er < LASTNB1ER )
{
j = i; ttrue = 1;

/* -------------------------------------------------------------------------- */
while((j < m->cols) && ttrue )
{
          ValueOfN = *(m->pblock+row *m->cols+j);
  if(fmod(ValueOfN,tnb1er[nb1er]))
    {
     nb1er++;
     ttrue = 0;
     if( (tnb1er[nb1er]) > fabs(ValueOfN))
        {
          nb1er = LASTNB1ER-1;
        }
    }
j++;j++;
}
/* -------------------------------------------------------------------------- */


/* -------------------------------- true = y -------------------------------- */
if(ttrue)
  {
  for(j = i;  j < m->cols ; j++, j++)
     {
      *(m->pblock+row *m->cols+j) =
      *(m->pblock+row *m->cols+j) / tnb1er[nb1er];
     }
  if( i==0){deter.numer *= tnb1er[nb1er];}
  if( i==1){deter.denom *= tnb1er[nb1er];}
  }
/* -------------------------------- true = y -------------------------------- */
}
}
}
/* ************************************************************************** */
/* In this function   0 = 0/0.                                                */
/* In other part      0 = 0/1.                                                */
/* Now you must write 0 = 0/1.                                                */
/* ************************************************************************** */
for (j = 0;  j < m->cols ; j++, j++)
{
 ValueOfN = *(m->pblock+row *m->cols+j);
 if(!ValueOfN)
 {
 *(m->pblock+row *m->cols+j+1) = 1;
 }
}
/* ************************************************************************** */
 return(miniF(deter));
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.