⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drotg.c

📁 InsightToolkit-1.4.0(有大量的优化算法程序)
💻 C
字号:
#include "f2c.h"
#include "netlib.h"
extern double sqrt(double); /* #include <math.h> */

/* Table of constant values */
static doublereal c_b4 = 1.;

/* Subroutine */ void drotg_(da, db, c, s)
doublereal *da, *db, *c, *s;
{
    /* Local variables */
    static doublereal r, scale, z, roe;

/*     construct givens plane rotation.     */
/*     jack dongarra, linpack, 3/11/78.     */

    scale = abs(*da) + abs(*db);
    if (scale == 0.) {
        *c = 1.; *s = 0.;
        *da = *db = 0.;
    }
    else {
        roe = *db;
        if (abs(*da) > abs(*db)) {
            roe = *da;
        }
        r = *da / scale;
        z = *db / scale;
        r = scale * sqrt(r * r + z * z);
        r *= d_sign(&c_b4, &roe);
        *c = *da / r;
        *s = *db / r;
        z = 1.;
        if (abs(*da) > abs(*db)) {
            z = *s;
        }
        if (abs(*db) >= abs(*da) && *c != 0.) {
            z = 1. / *c;
        }
        *da = r;
        *db = z;
    }
} /* drotg_ */

⌨️ 快捷键说明

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