struct DifferentialPtrPair<T>
Conforms to: IDifferentiablePtrType
Experimental Feature
The feature described in this page is marked as experimental, and may be subject to change in future releases. Users are advised that any code that depend on this feature may not be compilable by future versions of the compiler.
Description
DifferentialPtrPair<T> is a built-in type that carries both the original and differential of a pointer-like object. T must conform to IDifferentiablePtrType
It is defined as follows:
struct DifferentialPtrPair<T : IDifferentiablePtrType> : IDifferentiablePtrType
{
typealias Differential = DifferentialPtrPair<T.Differential>;
property T p {get;}
property T.Differential d {get;}
}
Generic Parameters
T: IDifferentiablePtrType
Properties
d
p
v
Methods
Remarks
Differential ptr pairs can be created via constructor.
struct DPtrFloat : IDifferentialPtrType
{
typealias Differential = DPtrFloat;
float* ptr;
};
DifferentialPtrPair<DPtrFloat> dpa =
DifferentialPtrPair<float>({&outputBuffer[0]}, {&outputBuffer[1]});
Note that derivative ptr pairs are used to pass derivatives into and out of auto-diff functions. See documentation on fwd_diff and bwd_diff operators for more information.