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

View \xrndm.h

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


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


/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void rndmF(
pmatrix mA,
int maxnumer,
int maxdenom)
{
int i;
int j;
int row;

  for (   i = 0 ; i < mA->rows ; i++)
    {
    for ( j = 0 ; j < mA->cols ; j++,j++)
       {
        *(mA->pblock+i *mA->cols+j  ) = rndI(maxnumer);
        *(mA->pblock+i *mA->cols+j+1) = rndpI(maxdenom);
       }
    }

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

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void rndm0F(
pmatrix mA,
int maxnumer,
int maxdenom)
{
int i;
int j;
int row;

  for (   i = 0 ; i < mA->rows ; i++)
    {
    for ( j = 0 ; j < mA->cols ; j++,j++)
       {
        *(mA->pblock+i *mA->cols+j  ) = rnd0I(maxnumer);
        *(mA->pblock+i *mA->cols+j+1) = rndpI(maxdenom);
       }
    }

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



/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void rndmI(
pmatrix mA,
int maxnumer)
{
int i;
int j;

  for (   i = 0 ; i < mA->rows ; i++)
    {
    for ( j = 0 ; j < mA->cols ; j++,j++)
       {
        *(mA->pblock+i *mA->cols+j)   = rndI(maxnumer);
        *(mA->pblock+i *mA->cols+j+1) = 1;
       }
    }
}

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* Call  :                                                                    */
/* Debug :                                                                    */
/* -------------------------------------------------------------------------- */
void rndm0I(
pmatrix mA,
int maxnumer)
{
int i;
int j;

  for (   i = 0 ; i < mA->rows ; i++)
    {
    for ( j = 0 ; j < mA->cols ; j++,j++)
       {
        *(mA->pblock+i *mA->cols+j)   = rnd0I(maxnumer);
        *(mA->pblock+i *mA->cols+j+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.