For the types that implement ComplexField, the implementation of norm1 delegates to abs.
I would propose to change the implementation such that it computes the sum of the absolute values of all coefficients.
- for
Dual this is simply re.abs() + eps.abs().
- for
DualVec, this is re.abs() plus the sum of all e.abs(), where e are the entries of eps.
- for
Dual2 and Dual2Vec, we need to agree on how to interpret the 1-norm of v2. I would take the sum of the abs values scaled by 1/2, such that it coincides with the sum of the abs values of the second-order coefficients of the Taylor expansion.
This new behavior would then mimic, for example, that of GTPSA.normTPS. It would also allow to use its output as convergence criterion in iterative algorithms that update dual numbers recursively until some convergence is achieved.
For the types that implement
ComplexField, the implementation ofnorm1delegates toabs.I would propose to change the implementation such that it computes the sum of the absolute values of all coefficients.
Dualthis is simplyre.abs() + eps.abs().DualVec, this isre.abs()plus the sum of alle.abs(), whereeare the entries ofeps.Dual2andDual2Vec, we need to agree on how to interpret the 1-norm ofv2. I would take the sum of the abs values scaled by1/2, such that it coincides with the sum of the abs values of the second-order coefficients of the Taylor expansion.This new behavior would then mimic, for example, that of
GTPSA.normTPS. It would also allow to use its output as convergence criterion in iterative algorithms that update dual numbers recursively until some convergence is achieved.