@@ -336,7 +336,7 @@ DevNotes
336
336
function _buildCalcFactorLambdaSample (
337
337
ccwl:: CommonConvWrapper ,
338
338
smpid:: Integer ,
339
- target = view (ccwl . varValsAll[ccwl . varidx[]][smpid], ccwl . partialDims) ,
339
+ target,
340
340
measurement_ = ccwl. measurement;
341
341
# fmd_::FactorMetadata = cpt_.factormetadata;
342
342
_slack = nothing ,
@@ -421,11 +421,16 @@ function _solveCCWNumeric!(
421
421
islen1 = length (ccwl. partialDims) == 1 || ccwl. partial
422
422
# islen1 = length(cpt_.X[:, smpid]) == 1 || ccwl.partial
423
423
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
424
429
# build the pre-objective function for this sample's hypothesis selection
425
- unrollHypo!, target = _buildCalcFactorLambdaSample (
430
+ unrollHypo!, _ = _buildCalcFactorLambdaSample (
426
431
ccwl,
427
432
smpid,
428
- view (ccwl . varValsAll[ccwl . varidx[]], smpid) ;
433
+ target ;
429
434
_slack = _slack
430
435
)
431
436
@@ -434,7 +439,7 @@ function _solveCCWNumeric!(
434
439
435
440
# _hypoObj = (x) -> (target[] = x; unrollHypo!())
436
441
function _hypoObj (x)
437
- target[] = x
442
+ copyto! ( target, x)
438
443
return unrollHypo! ()
439
444
end
440
445
@@ -444,7 +449,11 @@ function _solveCCWNumeric!(
444
449
445
450
sfidx = ccwl. varidx[]
446
451
# 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
448
457
retval = _solveLambdaNumeric (
449
458
getFactorType (ccwl),
450
459
_hypoObj,
@@ -460,7 +469,11 @@ function _solveCCWNumeric!(
460
469
end
461
470
462
471
# 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
464
477
465
478
return nothing
466
479
end
0 commit comments