From 6f3556ec5f48cf7505b751ea0873081cf11204f2 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trustRegion.jl b/src/trustRegion.jl index bb7d05cbb..e4d40a747 100644 --- a/src/trustRegion.jl +++ b/src/trustRegion.jl @@ -365,7 +365,7 @@ function retrospective_step!(cache::TrustRegionCache) @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) @@ -373,7 +373,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