UnitDiffInfo

public final class UnitDiffInfo

Collection of diffUnits and other infos for a given Unit.

Constructors

UnitDiffInfo

protected UnitDiffInfo(Unit unit, DifferentiationEnv adEnv)

Methods

getAdjoint

protected Unit getAdjoint(ActivityPattern pattern)
Returns

the Adjoint Unit that belongs to the given ActivityPattern, or null if no such Unit exists.

getAllDiffPatterns

protected TapList<ActivityPattern> getAllDiffPatterns(int diffMode)

getAllDiffPatternsAndUnits

protected TapList<TapPair<ActivityPattern, Unit>> getAllDiffPatternsAndUnits(int diffMode)

getAllDiffs

protected TapList<Unit> getAllDiffs(ActivityPattern pattern)
Returns

all differentiation units of this unit for the given activity pattern. Therefore doesn’t return the copied Unit.

getAllDiffs

protected TapList<Unit> getAllDiffs(int diffKind)
Returns

all differentiation units of this unit for the given diffKind.

getAllDiffs

protected TapList<Unit> getAllDiffs()
Returns

all differentiation units of this unit, not geting the copied, non-diff Unit.

getAllDiffsAndMode

protected TapList<Unit>[] getAllDiffsAndMode()
Returns

all differentiation units and differentiation mode of this unit, not geting the copied, non-diff Unit.

getAllDiffsPlusCopy

protected TapList<Unit> getAllDiffsPlusCopy()
Returns

all differentiation units of this unit, plus the copied Unit if exists.

getAnyContainingDiffUnit

protected Unit getAnyContainingDiffUnit(Unit unit, Unit container)
Returns

the most representative differentiated counterpart of a given source unit, contained in a container unit. This is somewhat arbitrary. If possible, we return the TANGENT, which also happens to contain the unique diff for modules (DIFFERENTIATED==TANGENT). Else the ADJOINT. Else the ADJOINT_BWD. Else the ORIGCOPY.

getCopyForDiff

protected Unit getCopyForDiff()
Returns

For a package Unit, returns the corresponding package Unit for the differentiated code, and for a procedure Unit, returns the copy of this Unit for the differentiated code.

getDiff

protected Unit getDiff()
Returns

the differentiated Unit (only for modules?).

getDiffForModeAndActivity

protected Unit getDiffForModeAndActivity(int diffMode, ActivityPattern pattern)

getDiffReturnType

protected WrapperTypeSpec getDiffReturnType(int diffKind)
Returns

the diff unit return type if any differentiated version has a non-void return type. Otherwise, returns null.

getSplitBackward

protected Unit getSplitBackward(ActivityPattern pattern)
Returns

the Adjoint Split mode backward Unit that belongs to the given ActivityPattern, or null if no such Unit exists.

getSplitForward

protected Unit getSplitForward(ActivityPattern pattern)
Returns

the Adjoint Split mode forward Unit that belongs to the given ActivityPattern, or null if no such Unit exists.

getTangent

protected Unit getTangent(ActivityPattern pattern)
Returns

the Tangent Unit that belongs to the given ActivityPattern, or null if no such Unit exists.

getUnitDiffArgsByValueNeedOnlyIncrementInfoS

protected boolean[] getUnitDiffArgsByValueNeedOnlyIncrementInfoS(ActivityPattern pattern)

For each ActivityPattern of the unit.

Returns

an array of booleans indexed by rank as a formal parameter (0 for result), which are true when the diff of this argument is passed by value and yet need be overwritten (cf getUnitDiffArgsByValueNeedOverwriteInfoS), but this overwriting of the diff is only an increment of its value and therefore the special differentiation mechanism for passed-by-value arguments may be simplified.

getUnitDiffArgsByValueNeedOverwriteInfoS

protected boolean[] getUnitDiffArgsByValueNeedOverwriteInfoS(ActivityPattern pattern)

For each ActivityPattern of the unit

Returns

an array of booleans indexed by rank as a formal parameter (0 for result), which are true when this argument is passed by value (and therefore its diff too) or is the result, and at the same time the corresponding diff argument (which is thus passed by value) needs to be modified by the diff of the unit (for this ActivityPattern). For instance in C, this will force to change the diff formal parameter from type T_B to T_B*, and pass the address of v instead of actual parameter v.

getUnitFormalArgsActivityS

protected boolean[] getUnitFormalArgsActivityS(ActivityPattern pattern)
Returns

the unitFormalArgsActivityS for the given pattern. For each Pattern, a boolean array that tells if each formal argument is differentiated.

hasDiffs

protected boolean hasDiffs()

setAdjoint

protected void setAdjoint(ActivityPattern pattern, Unit adjointUnit)

Set the Adjoint Unit for the given pattern.

setDiff

protected void setDiff(Unit diffU)

Set the differentiated Unit (only for modules?).

setSplitBackward

protected void setSplitBackward(ActivityPattern pattern, Unit bwdUnit)

Set the Backward Unit for the given pattern.

setSplitForward

protected void setSplitForward(ActivityPattern pattern, Unit fwdUnit)

Set the Forward Unit for the given pattern.

setTangent

protected void setTangent(ActivityPattern pattern, Unit tangentUnit)

Set the Tangent Unit for the given pattern.

setUnitDiffArgsByValueNeedOnlyIncrementInfoS

protected void setUnitDiffArgsByValueNeedOnlyIncrementInfoS(ActivityPattern pattern, boolean[] val)

Set the info that can be retrieved by getUnitDiffArgsByValueNeedOnlyIncrementInfoS().

setUnitDiffArgsByValueNeedOverwriteInfoS

protected void setUnitDiffArgsByValueNeedOverwriteInfoS(ActivityPattern pattern, boolean[] val)

Set the info that can be retrieved by getUnitDiffArgsByValueNeedOverwriteInfoS().

setUnitFormalArgsActivityS

protected void setUnitFormalArgsActivityS(ActivityPattern pattern, boolean[] args)

Set the unitFormalArgsActivityS for the given pattern.

toString

public String toString()