@@ -362,10 +362,9 @@ function _solveCCWNumeric!(
362362 perturb:: Real = 1e-10 ,
363363) where {N_, F <: AbstractRelative , S, T}
364364 #
365-
365+
366366 #
367367 # thrid = Threads.threadid()
368-
369368 smpid = ccwl. particleidx[]
370369 # cannot Nelder-Mead on 1dim, partial can be 1dim or more but being conservative.
371370 islen1 = length (ccwl. partialDims) == 1 || ccwl. partial
@@ -377,10 +376,11 @@ function _solveCCWNumeric!(
377376 # a separate deepcopy of the destination (aka target) memory is necessary.
378377 # Choosen solution is to splice together ccwl.varValsAll each time, with destination as
379378 # deepcopy but other input variables are just point to the source variable values directly.
380- if ccwl. partial
381- target = view (ccwl. varValsAll[][ccwl. varidx[]][smpid], ccwl. partialDims)
379+ target = if ccwl. partial # FIXME likely type-instability on `typeof(target)`
380+ # view(ccwl.varValsAll[][ccwl.varidx[]][smpid], ccwl.partialDims)
381+ ccwl. varValsAll[][ccwl. varidx[]][smpid][ccwl. partialDims]
382382 else
383- target = ccwl. varValsAll[][ccwl. varidx[]][smpid];
383+ ccwl. varValsAll[][ccwl. varidx[]][smpid]
384384 end
385385 # build the pre-objective function for this sample's hypothesis selection
386386 unrollHypo!, _ = _buildCalcFactorLambdaSample (
@@ -407,12 +407,13 @@ function _solveCCWNumeric!(
407407 # target .+= _perturbIfNecessary(getFactorType(ccwl), length(target), perturb)
408408 sfidx = ccwl. varidx[]
409409 # do the parameter search over defined decision variables using Minimization
410- if ccwl. partial
411- X = collect (view (ccwl. varValsAll[][sfidx][smpid], ccwl. partialDims))
412- else
413- X = ccwl. varValsAll[][sfidx][smpid][ccwl. partialDims]
414- end
415- # X = destVarVals[smpid]#[ccwl.partialDims]
410+ X = ccwl. varValsAll[][sfidx][smpid][ccwl. partialDims]
411+ # X = if ccwl.partial # TODO check for type-instability on `X`
412+ # collect(view(ccwl.varValsAll[][sfidx][smpid], ccwl.partialDims))
413+ # else
414+ # ccwl.varValsAll[][sfidx][smpid][ccwl.partialDims]
415+ # end
416+ # # X = destVarVals[smpid]#[ccwl.partialDims]
416417
417418 retval = _solveLambdaNumeric (
418419 getFactorType (ccwl),
@@ -430,7 +431,13 @@ function _solveCCWNumeric!(
430431
431432 # insert result back at the correct variable element location
432433 if ccwl. partial
433- ccwl. varValsAll[][sfidx][smpid][ccwl. partialDims] .= retval
434+ # NOTE use workaround of TranslationGroup for coordinates on partial assignment
435+ # FIXME consolidate to Manopt and upgrade to Riemannian (i.e. incl non-groups)
436+ M = getManifold (ccwl) # TranslationGroup(length(ccwl.varValsAll[][sfidx][smpid]))
437+ src = Vector {typeof(retval)} ()
438+ push! (src, retval)
439+ setPointPartial! (M, ccwl. varValsAll[][sfidx], M, src, ccwl. partialDims, smpid, 1 , true )
440+ # ccwl.varValsAll[][sfidx][smpid][ccwl.partialDims] .= retval
434441 else
435442 # copyto!(ccwl.varValsAll[sfidx][smpid], retval)
436443 copyto! (ccwl. varValsAll[][sfidx][smpid][ccwl. partialDims], retval)
0 commit comments