Problem
LinearAlgebra.normalize fails with TypeError due to a boolean check in __normalize!.
MWE
using SparseConnectivityTracer
using LinearAlgebra
detector = TracerSparsityDetector()
# This fails
jacobian_sparsity(x -> normalize(x), [3.0, 4.0], detector)
# TypeError: non-boolean (GradientTracer...) used in boolean context
# Manual implementation works
jacobian_sparsity(x -> x / norm(x), [3.0, 4.0], detector)
# OK: nnz=4
Root cause
LinearAlgebra.__normalize! at generic.jl:2010 uses a boolean check (likely iszero on the norm).
Workaround
Use manual implementation x / norm(x) or TracerLocalSparsityDetector.
Problem
LinearAlgebra.normalizefails withTypeErrordue to a boolean check in__normalize!.MWE
Root cause
LinearAlgebra.__normalize!at generic.jl:2010 uses a boolean check (likelyiszeroon the norm).Workaround
Use manual implementation
x / norm(x)orTracerLocalSparsityDetector.