outer.cpp

来自「数值计算工具库,C语言编写的,可以直接调用.」· C++ 代码 · 共 37 行

CPP
37
字号
/*****************************************************************************
 * outer.cpp        Blitz++ outer product (tensor notation) example
 *
 * $Id: outer.cpp,v 1.1 1997/07/16 19:38:23 tveldhui Exp $
 *
 * $Log: outer.cpp,v $
 * Revision 1.1  1997/07/16 19:38:23  tveldhui
 * Update: Alpha release 0.2 (Arrays)
 *
 *****************************************************************************
 */

#include <blitz/array.h>

#ifdef BZ_NAMESPACES
using namespace blitz;
#endif

int main()
{
    Array<float,1> x(4), y(4);
    Array<float,2> A(4,4);

    x = 1, 2, 3, 4;
    y = 1, 0, 0, 1;

    firstIndex i;
    secondIndex j;

    A = x(i) * y(j);

    cout << A << endl;

    return 0;
}

⌨️ 快捷键说明

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