Differences between revisions 5 and 11 (spanning 6 versions)
Revision 5 as of 2018-03-13 00:50:04
Size: 1414
Editor: BevinBrett
Comment:
Revision 11 as of 2018-03-25 04:28:18
Size: 283
Editor: BevinBrett
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Parent: MorphoOptimizationProject
Line 3: Line 5:
=== Creating shape manipulation functions ===
See MorphoOptimizationProject_Manipulating_MRIS_et_al
Line 4: Line 9:
mris_fix_topology has a hot loop, which does unnecessary calculations of the face normals

mrisComputeOptimalRetessellation and mrisComputeRandomRetessellation have a similar structure

_:_: it loops over a set of patches, or iterates on one patch. For each patch it calls

_:_:_: mrisDefectPatchFitness, which calls

_:_:_:_: mrisComputeDefectLogLikelihood, which calls

_:_:_:_:_: mrisComputeDefectMRILogUnlikelihood, which

_:_:_:_:_:_: does an expensive computation all the face normals for ALL the faces

_:_:_:_:_:_: does two other expensive steps, which only use a few of the face normals

To simplify, the original code does this

_: loop

_:_: for all fno normal[fno] = f (inputs)

_:_: for a few fno use normal[fno]

_: end loop

_: change some inputs

_: use some normal[fno]

Since only a few of the face normals are used, it is a waste of time to calculate all of them every time around the loop!

This is replaced by code that does

_: loop

_:_: for all fno: normal[fno].deferred = true

_:_: for a few fno: use normal[fno], computing it from f (inputs) if is deferred, and changing it to being no-longer deferred

_: end loop

_: compute any remaining deferred normal[fno] before their inputs can change

_: change some inputs

_: use some normal[fno]
See MorphoOptimizationProject_Deferring_calculations

Parent: MorphoOptimizationProject

A variety of techniques have been used.

Creating shape manipulation functions

See MorphoOptimizationProject_Manipulating_MRIS_et_al

Deferring calculations until needed

See MorphoOptimizationProject_Deferring_calculations

MorphoOptimizationProject_BetterSerialCode_DeferCalculations (last edited 2021-09-22 09:46:34 by DevaniCordero)