13 auto constexpr
N = 10;
15 SECTION(
"Functions") {
16 auto direct = [](
t_Vector &out,
t_Vector const &input) { out = input * 2 - 1; };
17 auto indirect = [](
t_Vector &out,
t_Vector const &input) { out = input * 4 - 1; };
18 t_Vector const x = t_Vector::Random(2 *
N) * 5;
20 auto op = sopt::linear_transform<t_Vector>(direct, indirect);
22 CHECK((op * x).eval().
cols() == x.cols());
23 CHECK((op * x).eval().
rows() == x.rows());
24 CHECK((op * x).
cols() == x.cols());
25 CHECK((op * x).
rows() == x.rows());
26 CHECK((op * x).matrix() == (2 * x - 1).matrix());
27 CHECK((op.adjoint() * x).matrix() == (4 * x - 1).matrix());
32 t_Vector const x = t_Vector::Random(
N) * 5;
36 CHECK((op * x.matrix()).eval().cols() == x.cols());
37 CHECK((op * x.matrix()).eval().rows() == x.rows());
38 CHECK((op * x.matrix()).cols() == x.cols());
39 CHECK((op * x.matrix()).rows() == x.rows());
40 CHECK(op * x.matrix() == L.matrix() * x.matrix());
41 CHECK(op.adjoint() * x.matrix() == L.conjugate().transpose().matrix() * x.matrix());
44 SECTION(
"Rectangular matrix") {
46 t_Vector const x = t_Vector::Random(2 *
N) * 5;
50 CHECK((op * x.matrix()).eval().cols() == 1);
51 CHECK((op * x.matrix()).eval().rows() ==
N);
52 CHECK((op * x.matrix()).cols() == 1);
53 CHECK((op * x.matrix()).rows() ==
N);
54 CHECK(op * x.matrix() == L.matrix() * x.matrix());
55 CHECK(op.adjoint() * x.head(
N).matrix() ==
56 L.conjugate().transpose().matrix() * x.head(
N).matrix());
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
Eigen::Array< T, Eigen::Dynamic, 1 > Array
A 1-dimensional list of elements of given type.