Skip to content

Commit c812593

Browse files
committed
Refactoring
1 parent 4a42dd9 commit c812593

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

cpp/benchmarks/stochastic_algorithm.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,15 @@ BENCHMARK_DEFINE_F(StochasticAlgoFixture, ForwardBackward)(benchmark::State &sta
7676
factory::distributed_measurement_operator::mpi_distribute_image, uv_data, m_imsizex,
7777
m_imsizey, 1, 1, 2, kernels::kernel_from_string.at("kb"), 4, 4);
7878

79-
return std::make_shared<sopt::IterationState<Vector<t_complex>>>(uv_data.vis, phi);
80-
};
81-
82-
auto IS = random_updater();
83-
auto Phi = IS->Phi();
79+
auto const power_method_stuff = sopt::algorithm::power_method<Vector<t_complex>>(
80+
*phi, 1000, 1e-5,
81+
m_world.broadcast(Vector<t_complex>::Ones(m_imsizex * m_imsizey).eval()));
8482

85-
auto const power_method_stuff = sopt::algorithm::power_method<Vector<t_complex>>(
86-
Phi, 1000, 1e-5, m_world.broadcast(Vector<t_complex>::Ones(m_imsizex * m_imsizey).eval()));
83+
const t_real op_norm = std::get<0>(power_method_stuff);
84+
phi->set_norm(op_norm);
8785

88-
const t_real op_norm = std::get<0>(power_method_stuff);
89-
Phi.set_norm(op_norm);
86+
return std::make_shared<sopt::IterationState<Vector<t_complex>>>(uv_data.vis, phi);
87+
};
9088

9189
// wavelets
9290
auto const wavelets = factory::wavelet_operator_factory<Vector<t_complex>>(

0 commit comments

Comments
 (0)