Skip to content

Commit

Permalink
Updated the broyden tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierandrade committed Sep 18, 2024
1 parent b0c000c commit 09ff39b
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/mixers/broyden.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,33 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {

using namespace inq;
using namespace Catch::literals;
#if 0

gpu::array<double, 1> vin({10.0, -20.0});
gpu::array<double, 1> vout({0.0, 22.2});

mixers::broyden<decltype(vin)> lm(5, 0.5, 2, boost::mpi3::environment::get_self_instance());
auto comm = parallel::communicator{boost::mpi3::environment::get_self_instance()};

lm(vin, vout);

CHECK(vin[0] == 5.0_a);
CHECK(vin[1] == 1.1_a);
basis::trivial bas(2, comm);

basis::field_set<basis::trivial, double> vin(bas, 1);
vin.matrix()[0][0] = 10.0;
vin.matrix()[1][0] = -20.0;

vout = gpu::array<double, 1>({4.0, 5.5});
basis::field_set<basis::trivial, double> vout(bas, 1);
vout.matrix()[0][0] = 0.0;
vout.matrix()[1][0] = 22.2;

lm(vin, vout);
mixers::broyden<decltype(vin)> mixer(5, 0.5, 2, comm);

mixer(vin, vout);

CHECK(vin.matrix()[0][0] == 5.0_a);
CHECK(vin.matrix()[1][0] == 1.1_a);

CHECK(vin[0] == 4.4419411001_a);
CHECK(vin[1] == 3.5554591594_a);
#endif
vout.matrix()[0][0] = 4.0;
vout.matrix()[1][0] = 5.5;

mixer(vin, vout);

CHECK(vin.matrix()[0][0] == 4.4419411001_a);
CHECK(vin.matrix()[1][0] == 3.5554591594_a);

}
#endif

0 comments on commit 09ff39b

Please sign in to comment.