From 332a3bf6e0b8b9d115bb029d5d48579d701dbebc Mon Sep 17 00:00:00 2001 From: FHoltorf <32248677+FHoltorf@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:27:39 -0400 Subject: [PATCH] expose quadratic form structure explicitly --- src/trustRegion.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trustRegion.jl b/src/trustRegion.jl index e963be0d9..f380cef4c 100644 --- a/src/trustRegion.jl +++ b/src/trustRegion.jl @@ -458,7 +458,7 @@ function retrospective_step!(cache::TrustRegionCache{true}) @unpack H, g, step_size = cache return -(get_loss(fu_prev) - get_loss(fu)) / - (step_size' * g + step_size' * H * step_size / 2) + (dot(step_size, g) + dot(step_size, H, step_size) / 2) end function retrospective_step!(cache::TrustRegionCache{false}) @@ -470,7 +470,7 @@ function retrospective_step!(cache::TrustRegionCache{false}) @unpack H, g, step_size = cache return -(get_loss(fu_prev) - get_loss(fu)) / - (step_size' * g + step_size' * H * step_size / 2) + (dot(step_size, g) + dot(step_size, H, step_size) / 2) end function trust_region_step!(cache::TrustRegionCache) @@ -478,7 +478,7 @@ function trust_region_step!(cache::TrustRegionCache) cache.loss_new = get_loss(fu_new) # Compute the ratio of the actual reduction to the predicted reduction. - cache.r = -(loss - cache.loss_new) / (step_size' * g + step_size' * H * step_size / 2) + cache.r = -(loss - cache.loss_new) / (dot(step_size, g) + dot(step_size, H, step_size) / 2) @unpack r = cache if radius_update_scheme === RadiusUpdateSchemes.Simple