@@ -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
@@ -117,10 +118,19 @@ function _solveLambdaNumeric(
117118 retraction_method = ExponentialRetraction ()
118119 )
119120 return r
121+ elseif false
122+ r = gradient_descent (
123+ M,
124+ (M,x)-> hypoCalcFactor (x),
125+ (M, x)-> factorGradient (hypoCalcFactor, M, x),
126+ u0;
127+ stepsize= ConstantStepsize (0.1 ),
128+ )
129+ return r
120130 end
121131
122132 r = Optim. optimize (
123- x-> hypoCalcFactor (M, x),
133+ x-> hypoCalcFactor (OptimCalcConv, M, x),
124134 X0c,
125135 alg
126136 )
@@ -394,6 +404,8 @@ function (cf::CalcFactorNormSq)(::Type{CalcConv}, x)
394404 res = isnothing (cf. slack) ? res : res .- cf. slack
395405 return sum (x-> x^ 2 , res)
396406end
407+ # default to conv
408+ (cf:: CalcFactorNormSq )(x) = cf (CalcConv, x)
397409
398410function _buildHypoCalcFactor (ccwl:: CommonConvWrapper , smpid:: Integer , _slack= nothing )
399411 # build a view to the decision variable memory
0 commit comments