yrndm.h

来自「[[ Complex Matrices : Language c]]」· C头文件 代码 · 共 100 行

H
100
字号
/* xrndm.h                    free ware                    xhunga@tiscali.fr  */


/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void rnd_mzF(
PmzF mA,
int     maxn,
int     maxd)
{
fraction f;
int      i;
int      j;

  for (   i = 0 ; i < mA->rows ; i++)
    for ( j = 0 ; j < mA->cols ; j += 4)
       {
        f = rnd_F(maxn,maxd);
        *(mA->pb+i *mA->cols+j  ) = f.n;
        *(mA->pb+i *mA->cols+j+1) = f.d;

        f = rnd_F(maxn,maxd);
        *(mA->pb+i *mA->cols+j+2) = f.n;
        *(mA->pb+i *mA->cols+j+3) = f.d;
       }
}

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void rnd0_mzF(
PmzF mA,
int     maxn,
int     maxd)
{
fraction f;
int      i;
int      j;

  for (   i = 0 ; i < mA->rows ; i++)
    for ( j = 0 ; j < mA->cols ; j += 4)
       {
        f = rnd0_F(maxn,maxd);
        *(mA->pb+i *mA->cols+j  ) = f.n;
        *(mA->pb+i *mA->cols+j+1) = f.d;

        f = rnd0_F(maxn,maxd);
        *(mA->pb+i *mA->cols+j+2) = f.n;
        *(mA->pb+i *mA->cols+j+3) = f.d;
       }
}



/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void rnd_mzI(
PmzF mA,
int     maxn)
{
int i;
int j;

  for (   i = 0 ; i < mA->rows ; i++)
    for ( j = 0 ; j < mA->cols ; j += 4)
       {
        *(mA->pb+i *mA->cols+j)   = rnd_I(maxn);
        *(mA->pb+i *mA->cols+j+1) = 1;
        *(mA->pb+i *mA->cols+j+2) = rnd_I(maxn);
        *(mA->pb+i *mA->cols+j+3) = 1;
       }
}

/* --------------------------------- FUNCTION ------------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void rnd0_mzI(
PmzF mA,
int     maxn)
{
int i;
int j;

  for (   i = 0 ; i < mA->rows ; i++)
    for ( j = 0 ; j < mA->cols ; j += 4)
       {
        *(mA->pb+i *mA->cols+j)   = rnd0_I(maxn);
        *(mA->pb+i *mA->cols+j+1) = 1;
        *(mA->pb+i *mA->cols+j+2) = rnd0_I(maxn);
        *(mA->pb+i *mA->cols+j+3) = 1;
       }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?