MyraMath
expr_permdim


Source: tests/expression/permdim.cpp

1 
2 // ========================================================================= //
3 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
4 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
5 // ========================================================================= //
6 
16 
17 // Reporting.
18 #include <tests/myratest.h>
19 
20 using namespace myra;
21 
22 #ifdef MYRAMATH_ENABLE_CPP11
23 
24 ADD_TEST("expr_permdim","[expression]")
25  {
26  auto E1 = expr({1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0});
27  auto E2 = permdim( reshape(E1,3,3), {1,0} );
28  REQUIRE( E2.evaluate({0,0}) == 1.0 );
29  REQUIRE( E2.evaluate({0,1}) == 2.0 );
30  REQUIRE( E2.evaluate({0,2}) == 3.0 );
31  REQUIRE( E2.evaluate({1,0}) == 4.0 );
32  REQUIRE( E2.evaluate({1,1}) == 5.0 );
33  REQUIRE( E2.evaluate({1,2}) == 6.0 );
34  REQUIRE( E2.evaluate({2,0}) == 7.0 );
35  REQUIRE( E2.evaluate({2,1}) == 8.0 );
36  REQUIRE( E2.evaluate({2,2}) == 9.0 );
37  }
38 
39 #endif
40 
Reshapes an Expression (for instance, reinterpret an arity-1 Expression of size 25 into an arity-2 Ex...
Overloads expr() for std::vector<Number> and (C++11 only) std::initializer_list<Number> ...
An interface used to fill containers from Expression&#39;s (see Matrix::evaluate(), for example)...
Definition: syntax.dox:1
Permutes the dimensions of an Expression.


Results: [PASS]


Go back to Summary of /test programs.