Skip to content

Commit 63f4cfd

Browse files
chore(cleanup): cleans up codebase (#376)
Clean up incorporates (amid others) the following: - removes duplicate header includes - adds missing header includes - adds Closing namespace comments - removes unnecessary semicolons
1 parent 0c15c30 commit 63f4cfd

34 files changed

+77
-29
lines changed

cpp/examples/primal_dual/inpainting.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "sopt/power_method.h"
1717
#include "sopt/relative_variation.h"
1818
#include "sopt/sampling.h"
19-
#include "sopt/types.h"
2019
#include "sopt/utilities.h"
2120
#include "sopt/wavelets.h"
2221
#include "sopt/wavelets/sara.h"

cpp/sopt/cppflow_utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <cppflow/cppflow.h>
77
#include "cppflow/ops.h"
88
#include <complex>
9+
#include <vector>
910

1011
namespace sopt::cppflowutils {
1112

cpp/sopt/credible_region.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
#define SOPT_CREDIBLE_REGION_H
33

44
#include "sopt/config.h"
5+
#include <algorithm> // for std::min()
56
#include <functional>
67
#include <iostream>
8+
#include <memory> // for make_shared<>
9+
#include <tuple> // for tuple<>
710
#include <type_traits>
811
#include "sopt/bisection_method.h"
912
#include "sopt/exception.h"

cpp/sopt/forward_backward.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "sopt/config.h"
55
#include <functional>
66
#include <limits>
7+
#include <tuple> // for tuple<>
8+
#include <utility> // for std::move<>
79
#include "sopt/exception.h"
810
#include "sopt/linear_transform.h"
911
#include "sopt/logging.h"

cpp/sopt/imaging_forward_backward.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define SOPT_IMAGING_FORWARD_BACKWARD_H
33

44
#include "sopt/config.h"
5+
#include <limits> // for std::numeric_limits<>
6+
#include <memory> // for std::shared_ptr<>
57
#include <numeric>
68
#include <tuple>
79
#include <utility>
@@ -141,7 +143,7 @@ class ImagingForwardBackward {
141143
//! Vector of target measurements
142144
t_Vector const &target() const { return target_; }
143145
//! Minimun of objective_function
144-
Real objmin() const { return objmin_; };
146+
Real objmin() const { return objmin_; }
145147
//! Sets the vector of target measurements
146148
template <class DERIVED>
147149
ImagingForwardBackward<Scalar> &target(Eigen::MatrixBase<DERIVED> const &target) {
@@ -293,7 +295,7 @@ bool ImagingForwardBackward<SCALAR>::residual_convergence(t_Vector const &x,
293295
auto const residual_norm = sopt::l2_norm(residual);
294296
SOPT_LOW_LOG(" - [FB] Residuals: {} <? {}", residual_norm, residual_tolerance());
295297
return residual_norm < residual_tolerance();
296-
};
298+
}
297299

298300
template <class SCALAR>
299301
bool ImagingForwardBackward<SCALAR>::objective_convergence(ScalarRelativeVariation<Scalar> &scalvar,
@@ -304,7 +306,7 @@ bool ImagingForwardBackward<SCALAR>::objective_convergence(ScalarRelativeVariati
304306
auto const current = ((gamma() > 0) ? g_proximal_->proximal_norm(x)
305307
* gamma() : 0) + std::pow(sopt::l2_norm(residual), 2) / (2 * sigma() * sigma());
306308
return scalvar(current);
307-
};
309+
}
308310

309311
#ifdef SOPT_MPI
310312
template <class SCALAR>
@@ -318,7 +320,7 @@ bool ImagingForwardBackward<SCALAR>::objective_convergence(mpi::Communicator con
318320
((gamma() > 0) ? g_proximal_->proximal_norm(x)
319321
* gamma() : 0) + std::pow(sopt::l2_norm(residual), 2) / (2 * sigma_ * sigma_));
320322
return scalvar(current);
321-
};
323+
}
322324
#endif
323325

324326
template <class SCALAR>

cpp/sopt/imaging_padmm.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define SOPT_L1_PROXIMAL_ADMM_H
33

44
#include "sopt/config.h"
5+
#include <limits> // for std::numeric_limits<>
56
#include <numeric>
67
#include <tuple>
78
#include <utility>
@@ -322,7 +323,7 @@ bool ImagingProximalADMM<SCALAR>::residual_convergence(t_Vector const &x,
322323
auto const residual_norm = sopt::l2_norm(residual, l2ball_proximal_weights());
323324
SOPT_LOW_LOG(" - [PADMM] Residuals: {} <? {}", residual_norm, residual_tolerance());
324325
return residual_norm < residual_tolerance();
325-
};
326+
}
326327

327328
template <class SCALAR>
328329
bool ImagingProximalADMM<SCALAR>::objective_convergence(ScalarRelativeVariation<Scalar> &scalvar,
@@ -333,7 +334,7 @@ bool ImagingProximalADMM<SCALAR>::objective_convergence(ScalarRelativeVariation<
333334
auto const current =
334335
sopt::l1_norm(static_cast<t_Vector>(Psi().adjoint() * x), l1_proximal_weights());
335336
return scalvar(current);
336-
};
337+
}
337338

338339
template <class SCALAR>
339340
bool ImagingProximalADMM<SCALAR>::is_converged(ScalarRelativeVariation<Scalar> &scalvar,

cpp/sopt/imaging_primal_dual.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define SOPT_L1_PRIMAL_DUAL_H
33

44
#include "sopt/config.h"
5+
#include <limits> // for std::numeric_limits<>
56
#include <numeric>
67
#include <tuple>
78
#include <utility>
@@ -296,7 +297,7 @@ class ImagingPrimalDual {
296297
no_weights(output, 1, x);
297298
with_weights(outputw, Vector<Real>::Ones(this->l1_proximal_weights().size()), x);
298299
return output.isApprox(outputw);
299-
};
300+
}
300301
};
301302

302303
template <class SCALAR>
@@ -370,7 +371,7 @@ bool ImagingPrimalDual<SCALAR>::residual_convergence(t_Vector const &x,
370371
auto const residual_norm = sopt::l2_norm(residual, l2ball_proximal_weights());
371372
SOPT_LOW_LOG(" - [Primal Dual] Residuals: {} <? {}", residual_norm, residual_tolerance());
372373
return residual_norm < residual_tolerance();
373-
};
374+
}
374375

375376
template <class SCALAR>
376377
bool ImagingPrimalDual<SCALAR>::objective_convergence(ScalarRelativeVariation<Scalar> &scalvar,
@@ -381,7 +382,7 @@ bool ImagingPrimalDual<SCALAR>::objective_convergence(ScalarRelativeVariation<Sc
381382
auto const current =
382383
sopt::l1_norm(static_cast<t_Vector>(Psi().adjoint() * x), l1_proximal_weights());
383384
return scalvar(current);
384-
};
385+
}
385386

386387
template <class SCALAR>
387388
bool ImagingPrimalDual<SCALAR>::is_converged(ScalarRelativeVariation<Scalar> &scalvar,

cpp/sopt/joint_map.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "sopt/config.h"
55
#include <functional>
66
#include <limits>
7+
#include <memory> // for std::shared_ptr<>
8+
#include <utility> // for std::forward<>
79
#include "sopt/exception.h"
810
#include "sopt/forward_backward.h"
911
#include "sopt/imaging_forward_backward.h"
@@ -42,7 +44,7 @@ class JointMAP {
4244
is_converged_([](t_Vector const &, t_Vector const &, t_real const) { return true; }),
4345
relative_variation_(1e-3),
4446
objective_variation_(1e-3),
45-
itermax_(std::numeric_limits<t_uint>::max()){};
47+
itermax_(std::numeric_limits<t_uint>::max()){}
4648

4749
#define SOPT_MACRO(NAME, TYPE) \
4850
TYPE const &NAME() const { return NAME##_; } \
@@ -131,7 +133,7 @@ class JointMAP {
131133
diagnostic.reg_niters = niters;
132134
diagnostic.reg_term = gamma;
133135
return diagnostic;
134-
};
136+
}
135137
};
136138

137139
} // namespace sopt::algorithm

cpp/sopt/l1_g_proximal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class L1GProximal : public GProximal<SCALAR> {
4141
L1GProximal(bool tight_frame = false)
4242
: tight_frame_ (tight_frame),
4343
l1_proximal_() {}
44-
~L1GProximal() {};
44+
~L1GProximal() {}
4545

4646
// Implements the interface in GProximal
4747

cpp/sopt/l1_proximal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "sopt/config.h"
55
#include <array>
66
#include <type_traits>
7+
#include <utility> // for std::forward<>
78
#include <Eigen/Core>
89
#include "sopt/linear_transform.h"
910
#include "sopt/maths.h"

0 commit comments

Comments
 (0)