From: <kin...@us...> - 2010-02-14 02:22:31
|
Revision: 4564 http://teem.svn.sourceforge.net/teem/?rev=4564&view=rev Author: kindlmann Date: 2010-02-14 02:22:25 +0000 (Sun, 14 Feb 2010) Log Message: ----------- added pullPropNeighTanCovar (neighborhood+self covariance of constraint satisfaction motion tangent), which refers to point->neighTanCovar. added iterParm.energyIncreasePermitHalfLife, which allows the system to cool off with time, added flag.popCntlEnoughTest, which allows explicit control over whether popcntl adding uses a heuristic for whether there are enough neighbors (since that heuristic always assumes only one-neighbor-deep potentials Modified Paths: -------------- teem/trunk/src/pull/actionPull.c teem/trunk/src/pull/contextPull.c teem/trunk/src/pull/corePull.c teem/trunk/src/pull/parmPull.c teem/trunk/src/pull/pointPull.c teem/trunk/src/pull/popcntl.c teem/trunk/src/pull/pull.h Modified: teem/trunk/src/pull/actionPull.c =================================================================== --- teem/trunk/src/pull/actionPull.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/actionPull.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -331,6 +331,7 @@ ** point->neighMode ** if pullProcessModeNeighLearn == task->processMode: ** point->neighCovar +** point->neighTanCovar */ double _pullEnergyFromPoints(pullTask *task, pullBin *bin, pullPoint *point, @@ -429,6 +430,18 @@ point->neighMode = 0.0; if (pullProcessModeNeighLearn == task->processMode) { ELL_10V_ZERO_SET(point->neighCovar); + if (task->pctx->ispec[pullInfoTangent1]) { + double *tng; + float outer[9]; + tng = point->info + task->pctx->infoIdx[pullInfoTangent1]; + ELL_3MV_OUTER_TT(outer, float, tng, tng); + point->neighTanCovar[0] = outer[0]; + point->neighTanCovar[1] = outer[1]; + point->neighTanCovar[2] = outer[2]; + point->neighTanCovar[3] = outer[4]; + point->neighTanCovar[4] = outer[5]; + point->neighTanCovar[5] = outer[8]; + } } if (egradSum) { ELL_4V_SET(egradSum, 0, 0, 0, 0); @@ -496,6 +509,17 @@ point->neighCovar[7] += outer[10]; point->neighCovar[8] += outer[11]; point->neighCovar[9] += outer[15]; + if (task->pctx->ispec[pullInfoTangent1]) { + double *tng; + tng = herPoint->info + task->pctx->infoIdx[pullInfoTangent1]; + ELL_3MV_OUTER_TT(outer, float, tng, tng); + point->neighTanCovar[0] += outer[0]; + point->neighTanCovar[1] += outer[1]; + point->neighTanCovar[2] += outer[2]; + point->neighTanCovar[3] += outer[4]; + point->neighTanCovar[4] += outer[5]; + point->neighTanCovar[5] += outer[8]; + } } if (task->pctx->ispec[pullInfoTangentMode]) { double mm; @@ -520,6 +544,9 @@ if (pullProcessModeNeighLearn == task->processMode) { ELL_10V_SCALE(point->neighCovar, 1.0f/point->neighInterNum, point->neighCovar); + /* using 1 + # neigh because this includes tan1 of point itself */ + ELL_6V_SCALE(point->neighTanCovar, 1.0f/(1 + point->neighInterNum), + point->neighTanCovar); } } else { /* we had no neighbors at all */ @@ -527,7 +554,7 @@ if (task->pctx->ispec[pullInfoTangentMode]) { point->neighMode = AIR_NAN; } - /* point->neighCovar stays set at all zeros */ + /* point->neighCovar,neighTanCovar stay as initialized above */ } return energySum; Modified: teem/trunk/src/pull/contextPull.c =================================================================== --- teem/trunk/src/pull/contextPull.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/contextPull.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -72,6 +72,7 @@ pctx->targetDim = AIR_NAN; pctx->voxelSizeSpace = AIR_NAN; pctx->voxelSizeScale = AIR_NAN; + pctx->eipScale = 1.0; pctx->bin = NULL; ELL_4V_SET(pctx->binsEdge, 0, 0, 0, 0); @@ -544,6 +545,7 @@ typeOut = nrrdTypeFloat; break; case pullPropNeighCovar7Ten: + case pullPropNeighTanCovar: dim = 2; size[0] = 7; size[1] = pointNum; @@ -613,6 +615,15 @@ point->neighCovar[5], point->neighCovar[7]); break; + case pullPropNeighTanCovar: + TEN_T_SET(out_f + 7*outIdx, 1.0f, + point->neighTanCovar[0], + point->neighTanCovar[1], + point->neighTanCovar[2], + point->neighTanCovar[3], + point->neighTanCovar[4], + point->neighTanCovar[5]); + break; } ++outIdx; } /* for (pointIdx) */ Modified: teem/trunk/src/pull/corePull.c =================================================================== --- teem/trunk/src/pull/corePull.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/corePull.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -226,14 +226,19 @@ return 1; } + /* if this is descent, pull down eip a bit */ + if (pullProcessModeDescent == mode) { + pctx->sysParm.energyIncreasePermit *= pctx->eipScale; + } + /* tell all tasks what mode they're in */ for (ti=0; ti<pctx->threadNum; ti++) { pctx->task[ti]->processMode = mode; } if (pctx->verbose) { - printf("%s(%s): iter %d goes w/ %u thrd, %u pnts, enr %g%s\n", + printf("%s(%s): iter %d goes w/ eip %g, %u pnts, enr %g%s\n", me, airEnumStr(pullProcessMode, mode), - pctx->iter, pctx->threadNum, + pctx->iter, pctx->sysParm.energyIncreasePermit, pullPointNumber(pctx), _pullEnergyTotal(pctx), (pctx->flag.permuteOnRebin ? " (por)" : "")); } Modified: teem/trunk/src/pull/parmPull.c =================================================================== --- teem/trunk/src/pull/parmPull.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/parmPull.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -36,6 +36,7 @@ iterParm->addDescent = 10; iterParm->callback = 1; iterParm->snap = 0; + iterParm->energyIncreasePermitHalfLife = 0; return; } @@ -73,6 +74,7 @@ flag->nixAtVolumeEdgeSpace = AIR_FALSE; flag->constraintBeforeSeedThresh = AIR_FALSE; flag->noAdd = AIR_FALSE; + flag->popCntlEnoughTest = AIR_TRUE; /* really needs to be true by default */ flag->binSingle = AIR_FALSE; return; } @@ -124,6 +126,14 @@ case pullIterParmSnap: pctx->iterParm.snap = pval; break; + case pullIterParmEnergyIncreasePermitHalfLife: + pctx->iterParm.energyIncreasePermitHalfLife = pval; + if (pval) { + pctx->eipScale = pow(0.5, 1.0/pval); + } else { + pctx->eipScale = 1; + } + break; default: biffAddf(me, "%s: sorry, iter parm %d valid but not handled?", me, which); return 1; @@ -283,6 +293,9 @@ case pullFlagNoAdd: pctx->flag.noAdd = flag; break; + case pullFlagPopCntlEnoughTest: + pctx->flag.popCntlEnoughTest = flag; + break; case pullFlagBinSingle: pctx->flag.binSingle = flag; break; Modified: teem/trunk/src/pull/pointPull.c =================================================================== --- teem/trunk/src/pull/pointPull.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/pointPull.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -66,6 +66,7 @@ pnt->neighDistMean = 0; pnt->neighMode = AIR_NAN; ELL_10V_ZERO_SET(pnt->neighCovar); + ELL_6V_ZERO_SET(pnt->neighTanCovar); pnt->neighInterNum = 0; pnt->stuckIterNum = 0; #if PULL_PHIST @@ -105,6 +106,7 @@ dst->neighDistMean = src->neighDistMean; dst->neighMode = src->neighMode; ELL_10V_COPY(dst->neighCovar, src->neighCovar); + ELL_6V_COPY(dst->neighTanCovar, src->neighTanCovar); dst->neighInterNum = src->neighInterNum; #if PULL_PHIST dst->phist = src->phist; Modified: teem/trunk/src/pull/popcntl.c =================================================================== --- teem/trunk/src/pull/popcntl.c 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/popcntl.c 2010-02-14 02:22:25 UTC (rev 4564) @@ -70,7 +70,8 @@ return 0; } - if (point->neighPointNum && task->pctx->targetDim) { + if (point->neighPointNum && task->pctx->targetDim + && task->pctx->flag.popCntlEnoughTest) { unsigned int plenty; plenty = (1 == task->pctx->targetDim ? 3 Modified: teem/trunk/src/pull/pull.h =================================================================== --- teem/trunk/src/pull/pull.h 2010-02-14 02:00:29 UTC (rev 4563) +++ teem/trunk/src/pull/pull.h 2010-02-14 02:22:25 UTC (rev 4564) @@ -112,8 +112,10 @@ population control */ pullInfoLiveThresh2, /* 13: [1] another pullInfoLiveThresh */ pullInfoLiveThresh3, /* 14: [1] yet another pullInfoLiveThresh */ - pullInfoTangent1, /* 15: [3] first tangent to constraint surf */ - pullInfoTangent2, /* 16: [3] second tangent to constraint surf */ + pullInfoTangent1, /* 15: [3] first tangent to motion allowed + for constraint satisfaction */ + pullInfoTangent2, /* 16: [3] second tangent to motion allowed + for constraint satisfaction */ pullInfoTangentMode, /* 17: [1] for morphing between co-dim 1 and 2; User must set scale so mode from -1 to 1 means co-dim 1 (surface) to 2 (line) */ @@ -166,6 +168,9 @@ . 9:ss */ pullPropNeighCovar7Ten, /* 12: [7] spatial 3x3 submatrix of covariance, formatted as ten-compatible 7-tensor */ + pullPropNeighTanCovar, /* 13: [6] covariance of "tangents" of neighbors, + (e.g. pullInfoTangent1 for crease surfaces) + including point itself */ pullPropLast }; @@ -292,8 +297,9 @@ points with whom this point interacted, in rs-normalized space */ neighMode; /* some average of mode of nearby points */ - float neighCovar[10]; /* unique coeffs in 4x4 covariance matrix of + float neighCovar[10], /* unique coeffs in 4x4 covariance matrix of neighbors with whom this point interacted */ + neighTanCovar[6]; /* covariance of "tangent" info of neighbors */ unsigned int neighInterNum, /* number of particles with which I had some non-zero interaction on last iteration */ stuckIterNum; /* how many iterations I've been stuck */ @@ -508,6 +514,11 @@ /* if non-zero, interval between iters at which output snapshots are saved */ pullIterParmSnap, + + /* the half-life of energyIncreasePermit, in terms of iterations, or + 0 if no such decay is wanted */ + pullIterParmEnergyIncreasePermitHalfLife, + pullIterParmLast }; @@ -518,7 +529,8 @@ constraintMax, stuckMax, callback, - snap; + snap, + energyIncreasePermitHalfLife; } pullIterParm; /* @@ -666,6 +678,13 @@ /* do no adding during population control */ pullFlagNoAdd, + /* use the targetDim-based "enough" heuristic to guess whether + adding a point could usefully reduce system energy. On by + default; turn this off when using a large-support energy that + involves more neighbors than the single-neighbor-deep energies + that are normally used (like cwell:0.66,x or qwell:0.64) */ + pullFlagPopCntlEnoughTest, + /* no binning: all particles can potentially interact (for debugging) */ pullFlagBinSingle, @@ -680,6 +699,7 @@ energyFromStrength, nixAtVolumeEdgeSpace, constraintBeforeSeedThresh, + popCntlEnoughTest, noAdd, binSingle; } pullFlag; @@ -783,9 +803,12 @@ voxelSizeSpace, /* mean spatial voxel edge length, for limiting travel distance for descent and constraint satisfaction */ - voxelSizeScale; /* mean voxel edge length in space, for + voxelSizeScale, /* mean voxel edge length in space, for limiting travel (along scale) distance during descent */ + eipScale; /* how to scale energyIncreasePermit + at each iteration, in accordance with + energyIncreasePermitHalfLife */ pullBin *bin; /* volume of bins (see binsEdge, binNum) */ unsigned int binsEdge[4], /* # bins along each volume edge, determined by maxEval and scale */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |