Summary
modf fails with MissingPrimalError because it internally calls isinf which requires primal values.
MWE
using SparseConnectivityTracer
jacobian_sparsity(x -> first.(modf.(x)), rand(2), TracerSparsityDetector())
# ERROR: MissingPrimalError(isinf, GradientTracer{Int64, BitSet}(...))
Root cause
Julia's modf implementation calls isinf internally. Since isinf is a predicate that returns Bool, it needs primal values to evaluate.
Expected behavior
modf(x) returns (fractional_part, integer_part). Both parts depend on x, so the sparsity pattern should show dependencies.
Workaround
Use TracerLocalSparsityDetector (untested - may also fail).
Summary
modffails withMissingPrimalErrorbecause it internally callsisinfwhich requires primal values.MWE
Root cause
Julia's
modfimplementation callsisinfinternally. Sinceisinfis a predicate that returnsBool, it needs primal values to evaluate.Expected behavior
modf(x)returns(fractional_part, integer_part). Both parts depend onx, so the sparsity pattern should show dependencies.Workaround
Use
TracerLocalSparsityDetector(untested - may also fail).