@@ -71,15 +71,16 @@ function _solveLambdaNumeric(
7171 return r. minimizer
7272end
7373
74- # struct OptimCalcConv end
74+ struct OptimCalcConv end
7575# CalcFactorNormSq cost function for an input in coordinates as used by Optim.jl
76- function (hypoCalcFactor:: CalcFactorNormSq )(M:: AbstractManifold , Xc:: AbstractVector )
76+ function (hypoCalcFactor:: CalcFactorNormSq )(:: Type{OptimCalcConv} , M:: AbstractManifold , Xc:: AbstractVector )
7777 # hypoCalcFactor.manifold is the factor's manifold, not the variable's manifold that is needed here
7878 ϵ = getPointIdentity (M)
7979 X = get_vector (M, ϵ, SVector (Xc), DefaultOrthogonalBasis ())
8080 p = exp (M, ϵ, X)
8181 return hypoCalcFactor (CalcConv, p)
8282end
83+ (hypoCalcFactor:: CalcFactorNormSq )(M:: AbstractManifold , p) = hypoCalcFactor (OptimCalcConv, M, p)
8384
8485struct ManoptCalcConv end
8586
@@ -127,10 +128,19 @@ function _solveLambdaNumeric(
127128 retraction_method = ExponentialRetraction ()
128129 )
129130 return r
131+ elseif false
132+ r = gradient_descent (
133+ M,
134+ (M,x)-> hypoCalcFactor (x),
135+ (M, x)-> factorGradient (hypoCalcFactor, M, x),
136+ u0;
137+ stepsize= ConstantStepsize (0.1 ),
138+ )
139+ return r
130140 end
131141
132142 r = Optim. optimize (
133- x-> hypoCalcFactor (M, x),
143+ x-> hypoCalcFactor (OptimCalcConv, M, x),
134144 X0c,
135145 alg
136146 )
@@ -396,6 +406,8 @@ function (cf::CalcFactorNormSq)(::Type{CalcConv}, x)
396406 res = isnothing (cf. slack) ? res : res .- cf. slack
397407 return sum (x-> x^ 2 , res)
398408end
409+ # default to conv
410+ (cf:: CalcFactorNormSq )(x) = cf (CalcConv, x)
399411
400412function _buildHypoCalcFactor (ccwl:: CommonConvWrapper , smpid:: Integer , _slack)
401413 # build a view to the decision variable memory
0 commit comments