Internals Reference

Internals may change

This part of the developer documentation exclusively refers to internals that may change without warning in a future release of SparseConnectivityTracer. Anything written on this page should be treated as if it was undocumented. Only functionality that is exported or part of the user documentation adheres to semantic versioning.

Tracer Types

SparseConnectivityTracer.GradientTracerType
struct GradientTracer{I<:Integer, G<:AbstractSet{I<:Integer}} <: SparseConnectivityTracer.AbstractTracer

Real number type keeping track of non-zero gradient entries.

Fields

  • gradient::AbstractSet{I} where I<:Integer: Set of indices $i$ of non-zero values $∇f(x)_i ≠ 0$ in the gradient.

  • isempty::Bool: Indicator whether gradient in tracer contains only zeros.

source
SparseConnectivityTracer.HessianTracerType
struct HessianTracer{I<:Integer, G<:AbstractSet{I<:Integer}, H<:Union{AbstractDict{I<:Integer, G<:AbstractSet{I<:Integer}}, AbstractSet{Tuple{I<:Integer, I<:Integer}}}, S<:SparseConnectivityTracer.SharingBehavior} <: SparseConnectivityTracer.AbstractTracer

Real number type keeping track of non-zero gradient and Hessian entries.

Fields

  • gradient::AbstractSet{I} where I<:Integer: Set of indices $i$ of non-zero values $∇f(x)_i ≠ 0$ in the gradient.

  • hessian::Union{AbstractDict{I, G}, AbstractSet{Tuple{I, I}}} where {I<:Integer, G<:AbstractSet{I}}: Set of index-tuples $(i, j)$ of non-zero values $∇²f(x)_{ij} ≠ 0$ in the Hessian.

  • isempty::Bool: Indicator whether gradient and Hessian in tracer both contain only zeros.

source
SparseConnectivityTracer.DualType
struct Dual{P<:Real, T<:SparseConnectivityTracer.AbstractTracer} <: Real

Dual Real number type keeping track of the results of a primal computation as well as a tracer.

Fields

  • primal::Real

  • tracer::SparseConnectivityTracer.AbstractTracer

source

Traits

SparseConnectivityTracer.NotSharedType

Indicates that patterns can share memory and operators are prohibited from mutating HessianTracer arguments. In practice, memory sharing is limited to second-order information in HessianTracer.

source
SparseConnectivityTracer.SharedType

Indicates that patterns always share memory and that operators are allowed to mutate their HessianTracer arguments. In practice, memory sharing is limited to second-order information in HessianTracer.

source
SparseConnectivityTracer.sharedFunction
shared(pattern)

Indicates whether patterns always share memory and whether operators are allowed to mutate their HessianTracer arguments. Returns either the Shared() or NotShared() trait.

If NotShared(), patterns can share memory and operators are prohibited from mutating HessianTracer arguments.

Note

In practice, memory sharing is limited to second-order information in HessianTracer.

source

Utilities

SparseConnectivityTracer.myemptyFunction
myempty(T)
myempty(tracer::AbstractTracer)

Constructor for an empty tracer or pattern of type T representing a new number (usually an empty pattern).

source