*/
Know a good article or link that we're missing? Submit it!
*/

View \xrmsymtr.h

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


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

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void msymetricF(
pmatrix m,
int maxnumer,
int maxdenom)
{
int i;
int j;
int row;
double Tnumer;
double Tdenom;


  if (m->rows * TWOCOL != m->cols)
    {
     printf("\n mid() error - matrix must be square");
     printf("\n Press return to continue");
     getchar();
     exit(1);
    }
  for (   i = 0 ; i < m->rows ; i++)
    {
    for ( j = 0 ; j < m->cols ; j++,j++)
       {
        Tnumer = rndI (maxnumer);
        Tdenom = rndpI(maxdenom);

       *(m->pblock+i     *m->cols+j)         = Tnumer;
       *(m->pblock+i     *m->cols+j+1)        = Tdenom;
       *(m->pblock+(j/2) *m->cols+i*TWOCOL)   = Tnumer;
       *(m->pblock+(j/2) *m->cols+i*TWOCOL+1) = Tdenom;

       }
    }

    for ( row = 0; row < m->rows ; row++)
     {
      frowminiF(m,row);                                 /* a) fraction mini   */
     }
}

/* ------------------------------ FUNCTION ---------------------------- mid() */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void msymetricI(
pmatrix m,
int maxnumer)
{
int i;
int j;
double Tnumer;


  if (m->rows * TWOCOL != m->cols)
    {
     printf("\n mid() error - matrix must be square");
     printf("\n Press return to continue");
     getchar();
     exit(1);
    }
  for (   i = 0 ; i < m->rows ; i++)
    {
    for ( j = 0 ; j < m->cols ; j++,j++)
       {
        Tnumer = rndI (maxnumer);

       *(m->pblock+i     *m->cols+j)          = Tnumer;
       *(m->pblock+i     *m->cols+j+1)        = 1;
       *(m->pblock+(j/2) *m->cols+i*TWOCOL)   = Tnumer;
       *(m->pblock+(j/2) *m->cols+i*TWOCOL+1) = 1;

       }
    }
}

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.