zdscal.c

来自「InsightToolkit-1.4.0(有大量的优化算法程序)」· C语言 代码 · 共 36 行

C
36
字号
#include "f2c.h"
#include "netlib.h"

/* Modified by Peter Vanroose, June 2001: manual optimisation and clean-up */

/* Subroutine */ void zdscal_(n, da, zx, incx)
const integer *n;
const doublereal *da;
doublecomplex *zx;
const integer *incx;
{
    /* Local variables */
    static integer i, ix;

/*     scales a vector by a constant. */
/*     jack dongarra, 3/11/78. */
/*     modified 3/93 to return if incx .le. 0. */
/*     modified 12/3/93, array(1) declarations changed to array(*) */

    if (*n <= 0 || *incx <= 0) {
        return;
    }
    if (*incx == 1) {
        for (i = 0; i < *n; ++i) {
            zx[i].r *= *da, zx[i].i *= *da;
        }
    }
    else {
        ix = 0;
        for (i = 0; i < *n; ++i) {
            zx[ix].r *= *da, zx[ix].i *= *da;
            ix += *incx;
        }
    }
} /* zdscal_ */

⌨️ 快捷键说明

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