Source: tests/expression/reshape.cpp
17 #include <tests/myratest.h> 21 #ifdef MYRAMATH_ENABLE_CPP11 23 ADD_TEST(
"expr_reshape",
"[expression]")
25 auto E1 = expr({1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0});
26 auto E2 = reshape(E1,3,3);
27 REQUIRE( E2.evaluate({0,0}) == 1.0 );
28 REQUIRE( E2.evaluate({1,0}) == 2.0 );
29 REQUIRE( E2.evaluate({2,0}) == 3.0 );
30 REQUIRE( E2.evaluate({0,1}) == 4.0 );
31 REQUIRE( E2.evaluate({1,1}) == 5.0 );
32 REQUIRE( E2.evaluate({2,1}) == 6.0 );
33 REQUIRE( E2.evaluate({0,2}) == 7.0 );
34 REQUIRE( E2.evaluate({1,2}) == 8.0 );
35 REQUIRE( E2.evaluate({2,2}) == 9.0 );
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's (see Matrix::evaluate(), for example)...
Results: [PASS]
Go back to Summary of /test
programs.