Skip to content

Commit

Permalink
Merge pull request #439 from astro-informatics/mm/pd_norm
Browse files Browse the repository at this point in the history
Fix normalisation of initial guess
  • Loading branch information
mmcleod89 authored Nov 11, 2024
2 parents f01713d + 67db1d5 commit 7791c4d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpp/sopt/primal_dual.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,22 @@ class PrimalDual {

//! \brief Computes initial guess for x and the residual using the targets
//! \details with y the vector of measurements
//! - x = Φ^T y * xi * tau
//! - x = Φ^T y / nu = Φ^T y / (Φ_norm^2)
//! - residuals = Φ x - y
std::tuple<t_Vector, t_Vector> initial_guess() const {
return PrimalDual<SCALAR>::initial_guess(target(), Phi(), xi());
return PrimalDual<SCALAR>::initial_guess(target(), Phi(), nu());
}

//! \brief Computes initial guess for x and the residual using the targets
//! \details with y the vector of measurements
//! - x = Φ^T y * xi * tau
//! - x = Φ^T y / nu = Φ^T y / (Φ_norm^2)
//! - residuals = Φ x - y
//!
//! This function simplifies creating overloads for operator() in PD wrappers.
static std::tuple<t_Vector, t_Vector> initial_guess(t_Vector const &target,
t_LinearTransform const &phi, Real nu) {
std::tuple<t_Vector, t_Vector> guess;
std::get<0>(guess) = static_cast<t_Vector>(phi.adjoint() * target);
std::get<0>(guess) = static_cast<t_Vector>(phi.adjoint() * target) / nu;
std::get<1>(guess) = target;
return guess;
}
Expand Down

0 comments on commit 7791c4d

Please sign in to comment.