From 1d39ebddc0e202e82f380b28198ee0b8d21ccee6 Mon Sep 17 00:00:00 2001 From: Chris Coey Date: Mon, 15 Nov 2021 11:29:18 -0500 Subject: [PATCH] add some more initial point oracle tests --- src/Cones/epinormspectral.jl | 2 +- test/cone.jl | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Cones/epinormspectral.jl b/src/Cones/epinormspectral.jl index f0e82cc73..e68dd4e34 100644 --- a/src/Cones/epinormspectral.jl +++ b/src/Cones/epinormspectral.jl @@ -209,7 +209,7 @@ function update_hess(cone::EpiNormSpectral{T, R}) where {T, R} Zi = mul!(U1, Urzi, Urzi') ZiW = mul!(w1, Urzi, mrziVt) WZiWI = mul!(cone.VVt, mrziVt', mrziVt, T(0.5), false) - for i in 1:d2 + @inbounds for i in 1:d2 WZiWI[i, i] += ui end diff --git a/test/cone.jl b/test/cone.jl index 7739845d8..3d68b7850 100644 --- a/test/cone.jl +++ b/test/cone.jl @@ -46,17 +46,20 @@ function test_oracles( @test Cones.get_proxsqr(cone, one(T), true) <= 1 # max proximity @test Cones.get_proxsqr(cone, one(T), false) <= dim # sum proximity - prod_vec = zero(point) - @test Cones.hess_prod!(prod_vec, point, cone) ≈ dual_point atol=tol rtol=tol - # test centrality of initial point if isfinite(init_tol) @test point ≈ dual_point atol=init_tol rtol=init_tol end init_only && return + # test at initial point + prod_vec = zero(point) hess = Cones.hess(cone) + @test hess * point ≈ dual_point atol=tol rtol=tol + @test Cones.hess_prod!(prod_vec, point, cone) ≈ dual_point atol=tol rtol=tol inv_hess = Cones.inv_hess(cone) + @test inv_hess * dual_point ≈ point atol=tol rtol=tol + @test Cones.inv_hess_prod!(prod_vec, dual_point, cone) ≈ point atol=tol rtol=tol @test hess * inv_hess ≈ I atol=tol rtol=tol # perturb and scale the initial point