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

📄 transform.cpp

📁 数值计算工具库,C语言编写的,可以直接调用.
💻 CPP
字号:
#include <blitz/tinymat.h>
#include <blitz/tinyvec.h>

#ifdef BZ_NAMESPACES
using namespace blitz;
#endif

int main()
{
    cout << "This example is interesting only for the code generated."
         << endl;
    return 0;
}

/*
 * Blitz++ version
 */
void transform(double alpha, TinyVector<double,3>& x, 
    const TinyVector<double,3>& y)
{
    TinyMatrix<double,3,3> C;

    double cosa = cos(alpha),
           sina = sin(alpha);

    // Create the principal rotation matrix C_3(alpha)
    C = cosa, -sina,   0.0,
        sina,  cosa,   0.0,
         0.0,   0.0,   1.0;

    x = product(C,y);
}

/*
 * Low level version
 */
void transform2(double alpha, double* x, double* y)
{
    double c = cos(alpha),
           s = sin(alpha);

    x[0] = c * y[0] - s * y[1];
    x[1] = s * y[0] + c * y[1];
    x[2] = y[2];
}

⌨️ 快捷键说明

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