*/
Written some cool source code? Upload it to Programmer's Heaven.
*/

View \xpfreevr.h

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


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

/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void printfreevariable(
pmatrix mA)
{
 int i;
 int j;
 int    m = 0;
 int zero;
char c;


for (i = 0 ; i < mA->rows ; i++)
{
    c = 't' - ((mA->rows-1)*TWOCOL);
 zero = -1;
 m++;
 printf("\n");
 printf(" x%d = ",m);

 for ( j = 0; j < mA->cols; j++,j++)
 {
  ++c;
  if(*(mA->pblock + i *mA->cols + j))
    {
     zero++;
     if(j > mA->rows*TWOCOL)
       {
        if(*(mA->pblock+i *mA->cols+j)== 1 && *(mA->pblock+i *mA->cols+j+1)==1)
          {printf(" +%c ",c);}
   else if(*(mA->pblock+i *mA->cols+j)==-1 && *(mA->pblock+i *mA->cols+j+1)==1)
          {printf(" -%c ",c);}
   else if(*(mA->pblock+i *mA->cols+j+1)==1)
          {printf(" %+.0f %c ",*(mA->pblock+i *mA->cols+j),c);}
   else   {printf(" %+.0f/%-.0f %c ",*(mA->pblock+i *mA->cols+j),
                                       *(mA->pblock+i *mA->cols+j+1),c);}
       }

        if(j == mA->rows*TWOCOL)
        {
         if(*(mA->pblock+i *mA->cols+j+1)==1)
           {printf(" %+.0f",*(mA->pblock+i *mA->cols+j));}
   else    {printf(" %+.0f/%-.0f",*(mA->pblock+i *mA->cols+j    ),
                                    *(mA->pblock+i *mA->cols+j+1));}
        }
    }
 }
 if(!zero){printf(" 0");};
}
printf("\n");
}

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.