Application of the identity matrix II. v05
Submitted By:
xhunga
Rating:





(
Rate It)
/* xrmrc0.h freeware [[Email Removed]] */
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* Call : */
/* Debug : */
/* -------------------------------------------------------------------------- */
void mrow0F(
pmatrix m,
int maxnumer,
int maxdenom)
{
int i;
int j;
int row0;
int row;
row0 = rndp0I(m->rows);
for ( i = 0 ; i < m->rows ; i++)
{
for ( j = 0 ; j < m->cols ; j++,j++)
{
*(m->pblock+i *m->cols+j ) = rndI (maxnumer);
*(m->pblock+i *m->cols+j+1) = rndpI(maxdenom);
if(i==row0)
{
*(m->pblock+i *m->cols+j) = 0;
*(m->pblock+i *m->cols+j+1) = 1;
}
}
}
for ( row = 0; row < m->rows ; row++)
{
frowminiF(m,row); /* a) fraction mini */
}
}
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* Call : */
/* Debug : */
/* -------------------------------------------------------------------------- */
void mcol0F(
pmatrix m,
int maxnumer,
int maxdenom
)
{
int i;
int j;
int col0;
int row;
col0 = rndp0I(m->rows) * 2;
for ( i = 0 ; i < m->rows ; i++)
{
for ( j = 0 ; j < m->cols ; j++,j++)
{
*(m->pblock+i *m->cols+j ) = rndI (maxnumer);
*(m->pblock+i *m->cols+j+1) = rndpI(maxdenom);
if(j==col0)
{
*(m->pblock+i *m->cols+j) = 0;
*(m->pblock+i *m->cols+j+1) = 1;
}
}
}
for ( row = 0; row < m->rows ; row++)
{
frowminiF(m,row); /* a) fraction mini */
}
}
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* Call : */
/* Debug : */
/* -------------------------------------------------------------------------- */
void mrow0I(
pmatrix m,
int maxnumer)
{
int i;
int j;
int row0;
row0 = rndp0I(m->rows);
for ( i = 0 ; i < m->rows ; i++)
{
for ( j = 0 ; j < m->cols ; j++,j++)
{
*(m->pblock+i *m->cols+j) = rndI (maxnumer);
*(m->pblock+i *m->cols+j+1) = 1;
if(i==row0)
{
*(m->pblock+i *m->cols+j ) = 0;
*(m->pblock+i *m->cols+j+1) = 1;
}
}
}
}
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* Call : */
/* Debug : */
/* -------------------------------------------------------------------------- */
void mcol0I(
pmatrix m,
int maxnumer
)
{
int i;
int j;
int col0;
col0 = rndp0I(m->rows) * 2;
for ( i = 0 ; i < m->rows ; i++)
{
for ( j = 0 ; j < m->cols ; j++,j++)
{
*(m->pblock+i *m->cols+j ) = rndI(maxnumer);
*(m->pblock+i *m->cols+j+1) = 1;
if(j==col0)
{
*(m->pblock+i *m->cols+j ) = 0;
*(m->pblock+i *m->cols+j+1) = 1;
}
}
}
}