From 6c4533ed5e3b33c8f2ce57b27c38cafaca97a964 Mon Sep 17 00:00:00 2001 From: Tuomas Koskela Date: Tue, 8 Oct 2024 12:24:15 +0100 Subject: [PATCH 1/2] Fix bugs in examples --- cpp/example/mem_w_algos.cc | 2 +- cpp/example/padmm_real_data.cc | 2 +- cpp/example/plot_wkernel.cc | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/example/mem_w_algos.cc b/cpp/example/mem_w_algos.cc index 41cc6f048..d53e60d57 100644 --- a/cpp/example/mem_w_algos.cc +++ b/cpp/example/mem_w_algos.cc @@ -58,7 +58,7 @@ int main(int nargs, char const **args) { std::vector image_index; std::tie(uv_data, image_index, w_stacks) = utilities::w_stacking_with_all_to_all( uv_data, du, Ju, Jw, world, 100, 0., cost, k_means_rel_diff); - for (t_real k = 0; k < uv_data.size(); k++) { + for (t_int k = 0; k < uv_data.size(); k++) { const t_int Ju_max = widefield::w_support(uv_data.w(k) - w_stacks.at(image_index.at(k)), du, static_cast(Ju), static_cast(Jw)); const t_real mem = (Ju_max * Ju_max) * 16.; diff --git a/cpp/example/padmm_real_data.cc b/cpp/example/padmm_real_data.cc index 6140c2f50..11685490a 100644 --- a/cpp/example/padmm_real_data.cc +++ b/cpp/example/padmm_real_data.cc @@ -46,7 +46,7 @@ void padmm(const std::string &name, const t_uint &imsizex, const t_uint &imsizey auto const Psi = sopt::linear_transform(sara, imsizey, imsizex); const Vector<> dimage = (measurements_transform->adjoint() * uv_data.vis).real(); Matrix point = Matrix::Zero(imsizey, imsizex); - point(std::floor(imsizey / 2), std::floor(imsizex / 2)) = 1.; + point(static_cast(std::floor(imsizey / 2)), static_cast(std::floor(imsizex / 2))) = 1.; const Vector<> psf = (measurements_transform->adjoint() * (*measurements_transform * Vector::Map(point.data(), point.size())).eval()) diff --git a/cpp/example/plot_wkernel.cc b/cpp/example/plot_wkernel.cc index 4d5d1966d..dd5d297ba 100644 --- a/cpp/example/plot_wkernel.cc +++ b/cpp/example/plot_wkernel.cc @@ -2,7 +2,6 @@ #include "purify/config.h" #include -#include "catch.hpp" #include "purify/directories.h" #include "purify/types.h" From 98335ab08986b638e7a6c26665280ce6cd7459f0 Mon Sep 17 00:00:00 2001 From: Tuomas Koskela Date: Wed, 9 Oct 2024 12:21:10 +0100 Subject: [PATCH 2/2] Simplify rounding --- cpp/example/padmm_real_data.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/example/padmm_real_data.cc b/cpp/example/padmm_real_data.cc index 11685490a..ded8a60af 100644 --- a/cpp/example/padmm_real_data.cc +++ b/cpp/example/padmm_real_data.cc @@ -46,7 +46,7 @@ void padmm(const std::string &name, const t_uint &imsizex, const t_uint &imsizey auto const Psi = sopt::linear_transform(sara, imsizey, imsizex); const Vector<> dimage = (measurements_transform->adjoint() * uv_data.vis).real(); Matrix point = Matrix::Zero(imsizey, imsizex); - point(static_cast(std::floor(imsizey / 2)), static_cast(std::floor(imsizex / 2))) = 1.; + point(int(imsizey / 2), int(imsizex / 2)) = 1.; const Vector<> psf = (measurements_transform->adjoint() * (*measurements_transform * Vector::Map(point.data(), point.size())).eval())