当前位置: 首页>>代码示例>>C++>>正文


C++ ArrayViewTest::view方法代码示例

本文整理汇总了C++中ArrayViewTest::view方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayViewTest::view方法的具体用法?C++ ArrayViewTest::view怎么用?C++ ArrayViewTest::view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayViewTest的用法示例。


在下文中一共展示了ArrayViewTest::view方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: only_extent

runall_result only_extent()
{
	ArrayTest<int, 1> original(extent<1>(10));
    ArrayViewTest<int, 1> section = original.section(original.arr().section(extent<1>(5)), index<1>(0));
    
    original.set_value(index<1>(2), 13);
    
    section.view()(3) = 15;
    section.set_known_value(index<1>(3), 15);
    
    return (gpu_read(original.arr(),index<1>(3)) == 15 && section.view()(2) == 13) ? original.pass() : original.fail();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:12,代码来源:test.cpp

示例2: only_extent

runall_result only_extent()
{
	ArrayViewTest<int, 3> original(extent<3>(2, 3, 4));
    ArrayViewTest<int, 3> section = original.section(original.view().section(extent<3>(2, 2, 2)), index<3>(0, 0, 0));
    
    original.view()(1, 2, 2) = 13;
    original.set_known_value(index<3>(1, 2, 2), 13);
    
    section.view()(0, 0, 0) = 15;
    section.set_known_value(index<3>(0, 0, 0), 15);
    
    return (original.view()(0, 0, 0) == 15 && section.view()(1, 2, 2) == 13) ? original.pass() : original.fail();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:13,代码来源:test.cpp

示例3: only_extent

runall_result only_extent()
{
	ArrayViewTest<int, 2> original(extent<2>(10, 10));
    ArrayViewTest<int, 2> section = original.section(original.view().section(extent<2>(5, 3)), index<2>(0, 0));
    
    original.view()(3, 2) = 13;
    original.set_known_value(index<2>(3, 2), 13);
    
    section.view()(3, 1) = 15;
    section.set_known_value(index<2>(3, 1), 15);
    
    return (original.view()(3, 1) == 15 && section.view()(3, 2) == 13) ? original.pass() : original.fail();
}
开发者ID:8l,项目名称:kalmar,代码行数:13,代码来源:test.cpp

示例4: scalar_values

runall_result scalar_values()
{
	ArrayViewTest<int, 2> original(extent<2>(10, 10));
    ArrayViewTest<int, 2> section = original.section(original.view().section(2, 3, 5, 2), index<2>(2, 3));
    
    original.view()(3, 4) = 13;
    original.set_known_value(index<2>(3, 4), 13);
    
    section.view()(3, 1) = 15;
    section.set_known_value(index<2>(3, 1), 15);
    
    return (original.view()(5, 4) == 15 && section.view()(1, 1) == 13) ? original.pass() : original.fail();
}
开发者ID:8l,项目名称:kalmar,代码行数:13,代码来源:test.cpp

示例5: main

int main()
{
    ArrayViewTest<int, 2> original(extent<2>(5, 5));

    // this section is from [2-5), 2-5) of the original
    ArrayViewTest<int, 2> section = original.section(original.view().section(index<2>(2, 2)), index<2>(2, 2));

    // create a projection -- this is row 2 of the original (2, [2-5))
    ArrayViewTest<int, 1, 2> projection = section.projection(section.view()[0], 0);

    // set some data in the original
    original.view()[index<2>(2, 3)] = 13;
    original.set_known_value(index<2>(2, 3), 13);

    // set some data in the section -- (2, 4) in the original
    section.view()[index<2>(0, 2)] = 17;
    section.set_known_value(index<2>(0, 2), 17);

    // set some data in the projection -- (2, 2) in the original
    projection.view()[index<1>(0)] = 11;
    projection.set_known_value(index<1>(0), 11);

    // verify each data point through the array_view interface
    return
        original.view()(2, 2) == 11 &&
        original.view()(2, 3) == 13 &&
        original.view()(2, 4) == 17 &&
        section.view()(0, 0) == 11 &&
        section.view()(0, 1) == 13 &&
        section.view()(0, 2) == 17 &&
        projection.view()(0) == 11 &&
        projection.view()(1) == 13 &&
        projection.view()(2) == 17
        ? original.pass() : original.fail();
}
开发者ID:UncleHandsome,项目名称:hcc,代码行数:35,代码来源:test.cpp

示例6: main

int main()
{
    ArrayViewTest<int, 2> original(extent<2>(3, 3));
    ArrayViewTest<int, 2> section = original.section(original.view().section(index<2>(1, 1)), index<2>(1, 1));
    
    // set a value through the section -- this is (1,1) in the original view
    section.view()[index<2>(0, 0)] = 5;
    section.set_known_value(index<2>(0, 0), 5);
    
    // set a value through the original -- this is (1, 0) in the section
    original.view()[index<2>(2, 1)] = 2;
    original.set_known_value(index<2>(2, 1), 2);
    
    return
        original.view()[index<2>(1, 1)] == 5 &&
        section.view()[index<2>(1, 0)] == 2
        ? original.pass() : original.fail();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:18,代码来源:test.cpp

示例7: main

int main()
{
    ArrayViewTest<int, 2> av(extent<2>(10, 10));
    ArrayViewTest<int, 1, 2> projection = av.section(index<2>(), extent<2>(5, 5)).projection(1);
    
    projection.view()[1] = 15;
    projection.set_known_value(index<1>(1), 15);
    return av.view()[index<2>(1, 1)] == 15 ? av.pass() : av.fail();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:9,代码来源:test.cpp

示例8: test_main

runall_result test_main()
{
    ArrayViewTest<const int, 1> original(extent<1>(10));
    ArrayViewTest<const int, 1> section = original.section(extent<1>(5));
    
    // set values through the data pointer
    original.set_value(index<1>(4), 13);
    section.set_value(index<1>(3), 15);
    
    return (original.view()(3) == 15 && section.view()(4) == 13) ? original.pass() : original.fail();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:11,代码来源:test.cpp


注:本文中的ArrayViewTest::view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。