@@ -504,7 +504,6 @@ function _beforeSolveCCW!(
504504 F_:: Type{<:AbstractRelative} ,
505505 ccwl:: CommonConvWrapper{F} ,
506506 variables:: AbstractVector{<:DFGVariable} ,
507- # destVarVals::AbstractVector,
508507 sfidx:: Int ,
509508 N:: Integer ;
510509 measurement = Vector {Tuple{}} (),
@@ -519,46 +518,27 @@ function _beforeSolveCCW!(
519518 end
520519
521520 # in forward solve case, important to set which variable is being solved early in this sequence
521+ # set the 'solvefor' variable index -- i.e. which connected variable of the factor is being computed in this convolution.
522522 ccwl. varidx[] = sfidx
523+ # ccwl.varidx[] = findfirst(==(solvefor), getLabel.(variables))
523524
524- # TBD, order of fmd ccwl cf are a little weird and should be revised.
525525 # TODO , maxlen should parrot N (barring multi-/nullhypo issues)
526- # set the 'solvefor' variable index -- i.e. which connected variable of the factor is being computed in this convolution.
527- # ccwl.varidx[] = findfirst(==(solvefor), getLabel.(variables))
528526 # everybody use maxlen number of points in belief function estimation
529527 maxlen = maximum ((N, length .(ccwl. varValsAll[])... ,))
530528
531- # splice
532- # should be type stable
529+ # splice, type stable
530+ # make deepcopy of destination variable since multiple approxConv type computations should happen from different factors to the same variable
533531 tvarv = tuple (
534532 map (s-> getVal (s; solveKey), variables[1 : sfidx- 1 ])... ,
535- deepcopy (ccwl . varValsAll[][ sfidx]) , # destVarVals = deepcopy(ccwl.varValsAll[][sfidx])
533+ deepcopy (getVal (variables[ sfidx]; solveKey)) , # deepcopy(ccwl.varValsAll[][sfidx]),
536534 map (s-> getVal (s; solveKey), variables[sfidx+ 1 : end ])... ,
537- )
538- # not type-stable
539- # varvals = [getVal(s; solveKey) for s in variables]
540- # varvals[sfidx] = destVarVals
541- # varvals_ = [varvals[1:sfidx-1]..., destVarVals, varvals[sfidx+1:end]...]
542- # tvarv = tuple(varvals...)
543-
544-
545- # @info "TYPES" typeof(ccwl.varValsAll[]) typeof(tvarv)
535+ )
546536 ccwl. varValsAll[] = tvarv
547- # ccwl.varValsAll[] = map(s->getVal(s; solveKey), tuple(variables...))
548- # # PLAN B, make deep copy of ccwl.varValsAll[ccwl.varidx[]] just before the numerical solve
549-
550- # maxlen, ccwl.varidx[] = _updateParamVec(variables, solvefor, ccwl.varValsAll, N; solveKey)
551- # # TODO , ensure all values (not just multihypothesis) is correctly used from here
552- # for (i,varVal) in enumerate(_varValsAll)
553- # resize!(ccwl.varValsAll[i],length(varVal))
554- # ccwl.varValsAll[i][:] = varVal #TODO Kyk hierna: this looks like it will effectively result in vnd.val memory being overwritten
555- # end
556537
557- # TODO better consolidation still possible
558- # FIXME ON FIRE, what happens if this is a partial dimension factor? See #1246
559- # FIXME , confirm this is hypo sensitive selection from variables, better to use double indevariablesng for clarity getDimension(ccw.fullvariables[hypoidx[ccwl.varidx[]]])
560- xDim = getDimension (getVariableType (variables[ccwl. varidx[]])) # ccwl.varidx[]
561- # ccwl.xDim = xDim
538+
539+ # FIXME , confirm what happens when this is a partial dimension factor? See #1246
540+ # indexing over all possible hypotheses
541+ xDim = getDimension (getVariableType (variables[ccwl. varidx[]]))
562542 # TODO maybe refactor different type or api call?
563543
564544 # setup the partial or complete decision variable dimensions for this ccwl object
@@ -567,7 +547,6 @@ function _beforeSolveCCW!(
567547 _setCCWDecisionDimsConv! (ccwl, xDim)
568548
569549 # FIXME do not divert Mixture for sampling
570-
571550 updateMeasurement! (ccwl, maxlen; needFreshMeasurements, measurement, _allowThreads= true )
572551
573552 # used in ccw functor for AbstractRelativeMinimize
@@ -584,7 +563,6 @@ function _beforeSolveCCW!(
584563 F_:: Type{<:AbstractPrior} ,
585564 ccwl:: CommonConvWrapper{F} ,
586565 variables:: AbstractVector{<:DFGVariable} ,
587- # destVarVals::AbstractVector,
588566 sfidx:: Int ,
589567 N:: Integer ;
590568 measurement = Vector {Tuple{}} (),
@@ -594,12 +572,7 @@ function _beforeSolveCCW!(
594572 # FIXME , NEEDS TO BE CLEANED UP AND WORK ON MANIFOLDS PROPER
595573
596574 ccwl. varidx[] = sfidx
597- # fnc = ccwl.usrfnc!
598- # sfidx = findfirst(getLabel.(variables) .== solvefor)
599575 @assert ccwl. varidx[] == 1 " Solving on Prior with CCW should have sfidx=1, priors are unary factors."
600- # @assert sfidx == 1 "Solving on Prior with CCW should have sfidx=1, priors are unary factors."
601- # ccwl.varidx[] = sfidx
602- # sfidx = 1 # why hardcoded to 1, maybe for only the AbstractPrior case here
603576
604577 # setup the partial or complete decision variable dimensions for this ccwl object
605578 # NOTE perhaps deconv has changed the decision variable list, so placed here during consolidation phase
0 commit comments