Source: tests/expression/generators.cpp
21 #include <tests/myratest.h> 25 #ifdef MYRAMATH_ENABLE_CPP11 27 ADD_TEST(
"expr_generators",
"[expression]")
30 REQUIRE( frobenius(make_LinspaceExpression(0.0,4.0,5) - expr({0.0,1.0,2.0,3.0,4.0})) < tol );
31 REQUIRE( frobenius(make_LogspaceExpression(0.0,4.0,5) - expr({1.0,10.0,100.0,1000.0,10000.0})) < tol );
32 REQUIRE( frobenius(make_ConstantExpression(5,2.0) - expr({2.0,2.0,2.0,2.0,2.0})) < tol );
33 REQUIRE( frobenius(make_ConstantExpression(3,5,2.0) - reshape(make_ConstantExpression(15,2.0),3,5)) < tol );
34 myra::out() << make_RandomExpression< std::complex<double> >(5) << std::endl;
35 myra::out() << make_RandomExpression<double>(3,3) << std::endl;
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> ...
Generators for basic Expression's (constant, random, linspace, etc).
An interface used to fill containers from Expression's (see Matrix::evaluate(), for example)...
Arithmetic operators (+,-,*,/) for Expression's.
Routines for computing Frobenius norms of Expression's.
Prints an Expression, by evaluate()'ing it at every Index i.
Results: [PASS]
size 5 arity-1 Expression of std::complex<double>:
[ (0.856348,0.179825) (-0.221386,-0.962504) (0.854009,-0.303818) (-0.138069,0.970514) (0.0403698,0.133254) ]
size 3 by 3 arity-2 Expression of double:
[ 0.436496 -0.392947 0.152213 ]
[ -0.420534 -0.292403 0.929914 ]
[ 0.516054 0.175849 -0.723981 ]
Go back to Summary of /test programs.