@@ -336,7 +336,7 @@ DevNotes
336336function _buildCalcFactorLambdaSample (
337337 ccwl:: CommonConvWrapper ,
338338 smpid:: Integer ,
339- target = view (ccwl . varValsAll[ccwl . varidx[]][smpid], ccwl . partialDims) ,
339+ target,
340340 measurement_ = ccwl. measurement;
341341 # fmd_::FactorMetadata = cpt_.factormetadata;
342342 _slack = nothing ,
@@ -421,11 +421,16 @@ function _solveCCWNumeric!(
421421 islen1 = length (ccwl. partialDims) == 1 || ccwl. partial
422422 # islen1 = length(cpt_.X[:, smpid]) == 1 || ccwl.partial
423423
424+ if ccwl. partial
425+ target = view (ccwl. varValsAll[ccwl. varidx[]][smpid], ccwl. partialDims)
426+ else
427+ target = ccwl. varValsAll[ccwl. varidx[]][smpid];
428+ end
424429 # build the pre-objective function for this sample's hypothesis selection
425- unrollHypo!, target = _buildCalcFactorLambdaSample (
430+ unrollHypo!, _ = _buildCalcFactorLambdaSample (
426431 ccwl,
427432 smpid,
428- view (ccwl . varValsAll[ccwl . varidx[]], smpid) ;
433+ target ;
429434 _slack = _slack
430435 )
431436
@@ -434,7 +439,7 @@ function _solveCCWNumeric!(
434439
435440 # _hypoObj = (x) -> (target[] = x; unrollHypo!())
436441 function _hypoObj (x)
437- target[] = x
442+ copyto! ( target, x)
438443 return unrollHypo! ()
439444 end
440445
@@ -444,7 +449,11 @@ function _solveCCWNumeric!(
444449
445450 sfidx = ccwl. varidx[]
446451 # do the parameter search over defined decision variables using Minimization
447- X = ccwl. varValsAll[sfidx][smpid][ccwl. partialDims]
452+ if ccwl. partial
453+ X = collect (view (ccwl. varValsAll[sfidx][smpid], ccwl. partialDims))
454+ else
455+ X = ccwl. varValsAll[sfidx][smpid][ccwl. partialDims]
456+ end
448457 retval = _solveLambdaNumeric (
449458 getFactorType (ccwl),
450459 _hypoObj,
@@ -460,7 +469,11 @@ function _solveCCWNumeric!(
460469 end
461470
462471 # insert result back at the correct variable element location
463- copyto! (ccwl. varValsAll[sfidx][smpid][ccwl. partialDims], retval)
472+ if ccwl. partial
473+ ccwl. varValsAll[sfidx][smpid][ccwl. partialDims] .= retval
474+ else
475+ copyto! (ccwl. varValsAll[sfidx][smpid], retval)
476+ end
464477
465478 return nothing
466479end
0 commit comments