MyraMath
expr_transpose


Source: tests/expression/transpose.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 
17 
18 // Reporting.
19 #include <tests/myratest.h>
20 
21 using namespace myra;
22 
23 #ifdef MYRAMATH_ENABLE_CPP11
24 
25 ADD_TEST("expr_transpose","[expression]")
26  {
27  auto E1 = expr({1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0});
28  auto E2 = make_complex(E1,E1);
29  auto E3 = transpose( reshape(E2,3,3) );
30  std::complex<double> j(0,1);
31  REQUIRE( E3.evaluate({0,0}) == 1.0 + j*1.0);
32  REQUIRE( E3.evaluate({0,1}) == 2.0 + j*2.0 );
33  REQUIRE( E3.evaluate({0,2}) == 3.0 + j*3.0 );
34  REQUIRE( E3.evaluate({1,0}) == 4.0 + j*4.0 );
35  REQUIRE( E3.evaluate({1,1}) == 5.0 + j*5.0 );
36  REQUIRE( E3.evaluate({1,2}) == 6.0 + j*6.0 );
37  REQUIRE( E3.evaluate({2,0}) == 7.0 + j*7.0 );
38  REQUIRE( E3.evaluate({2,1}) == 8.0 + j*8.0 );
39  REQUIRE( E3.evaluate({2,2}) == 9.0 + j*9.0 );
40  }
41 
42 #endif
43 
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
Returns the transpose of an arity-2 Expression.
Function overloads (sin, exp, etc) for Expression&#39;s.
Expression< 1, NumberC > make_complex(const Expression< 1, NumberS > &A)
Promotes a real Expression into a complex one.
Definition: functions_complex.cpp:122


Results: [PASS]


Go back to Summary of /test programs.