MCPcopy Create free account
hub / github.com/KindDragon/CPPDebuggerVisualizers / TestMultiArray

Function TestMultiArray

Tests/BoostTest/BoostTest.cpp:480–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479
480void TestMultiArray()
481{
482 // Create a 3D array that is 3 x 4 x 2
483 typedef boost::multi_array<double, 3> array_type;
484 typedef array_type::index index;
485 array_type A(boost::extents[3][4][2]);
486
487 // Assign values to the elements
488 int values = 0;
489 for (index i = 0; i != 3; ++i)
490 for (index j = 0; j != 4; ++j)
491 for (index k = 0; k != 2; ++k)
492 A[i][j][k] = values++;
493
494 typedef boost::multi_array<double, 2> array_type_2D;
495 array_type_2D myarray(boost::extents[3][4]);
496 typedef boost::multi_array_types::index_range range;
497 array_type_2D::array_view<2>::type myview =
498 myarray[boost::indices[range(1, 3)][range(0, 4, 2)]];
499
500 for (array_type_2D::index i = 0; i != 2; ++i)
501 for (array_type_2D::index j = 0; j != 2; ++j)
502 myview[i][j];
503}
504
505void TestMultiprecision()
506{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected