ykelrop.h
来自「[[ Complex Matrices : Language c]]」· C头文件 代码 · 共 95 行
H
95 行
/* xcelrop.h free ware xhunga@tiscali.fr */
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : swap two rows in a matrix */
/* */
/* -------------------------------------------------------------------------- */
void swaprow_mzF(
PmzF m,
int row1,
int row2)
{
int j;
double t;
for ( j = 0 ; j < m->cols ; j++)
{
t = *(m->pb+row1 *m->cols+j);
*(m->pb+row1 *m->cols+j ) = *(m->pb+row2 *m->cols+j);
*(m->pb+row2 *m->cols+j ) = t;
}
}
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* -------------------------------------------------------------------------- */
void mulrow_mzF(
PmzF mA,
int row,
complexF z)
{
int j;
complexF za;
for ( j = 0; j < mA->cols ; j += C4)
{
za.r.n = *(mA->pb+row *mA->cols+j );
za.r.d = *(mA->pb+row *mA->cols+j+1);
za.i.n = *(mA->pb+row *mA->cols+j+2);
za.i.d = *(mA->pb+row *mA->cols+j+3);
za.r = mini_F(za.r); za.i = mini_F(za.i);
z.r = mini_F( z.r); z.i = mini_F( z.i);
za = mul_zF(za,z);
za.r = mini_F(za.r); za.i = mini_F(za.i);
*(mA->pb+row *mA->cols+j ) = za.r.n;
*(mA->pb+row *mA->cols+j+1) = za.r.d;
*(mA->pb+row *mA->cols+j+2) = za.i.n;
*(mA->pb+row *mA->cols+j+3) = za.i.d;
}
}
/* --------------------------------- FUNCTION ------------------------------ */
/* Do : */
/* */
/* -------------------------------------------------------------------------- */
void addrow_mzF(
PmzF mA,
complexF z,
int row1,
int row2)
{
int j;
complexF zrow1;
complexF zrow2;
for( j = 0; j < mA->cols ; j += C4)
{
zrow1.r.n = *(mA->pb+row1 *mA->cols+j );
zrow1.r.d = *(mA->pb+row1 *mA->cols+j+1);
zrow1.i.n = *(mA->pb+row1 *mA->cols+j+2);
zrow1.i.d = *(mA->pb+row1 *mA->cols+j+3);
zrow1 = mul_zF(zrow1,z);
zrow2.r.n = *(mA->pb+row2 *mA->cols+j );
zrow2.r.d = *(mA->pb+row2 *mA->cols+j+1);
zrow2.i.n = *(mA->pb+row2 *mA->cols+j+2);
zrow2.i.d = *(mA->pb+row2 *mA->cols+j+3);
zrow2 = add_zF(zrow1,zrow2);
*(mA->pb+row2 *mA->cols+j ) = zrow2.r.n;
*(mA->pb+row2 *mA->cols+j+1) = zrow2.r.d;
*(mA->pb+row2 *mA->cols+j+2) = zrow2.i.n;
*(mA->pb+row2 *mA->cols+j+3) = zrow2.i.d;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?