Skip to content

Consistency of exp, retract, log and inverse_retract and their keywords #242

Description

@kellertuer

I noticed a slight inconsistency:

Retract often does pass down kwargs, inverse_retract as well, but exp, exp_fused, retract_fused (!), nor log seem to, for example in decorators or throughout the levels.

On the other hand we have

  • a log that has keywords, cf. https://github.com/JuliaManifolds/Manifolds.jl/blob/89453904dc4870d171d588aec2219cd12d2c0f2a/src/manifolds/StiefelSubmersionMetric.jl#L183-L210
  • we have a separate retraction with keywords stored
    """
    RetractionWithKeywords{R<:AbstractRetractionMethod,K} <: AbstractRetractionMethod
    Since retractions might have keywords, this type is a way to set them as an own type to be
    used as a specific retraction.
    Another reason for this type is that we dispatch on the retraction first and only the
    last layer would be implemented with keywords, so this way they can be passed down.
    ## Fields
    * `retraction` the retraction that is decorated with keywords
    * `kwargs` the keyword arguments
    Note that you can nest this type. Then the most outer specification of a keyword is used.
    ## Constructor
    RetractionWithKeywords(m::T; kwargs...) where {T <: AbstractRetractionMethod}
    Specify the subtype `T <: `[`AbstractRetractionMethod`](@ref) to have keywords `kwargs...`.
    """
    struct RetractionWithKeywords{T <: AbstractRetractionMethod, K} <: AbstractRetractionMethod
    retraction::T
    kwargs::K
    end
    function RetractionWithKeywords(m::T; kwargs...) where {T <: AbstractRetractionMethod}
    return RetractionWithKeywords{T, typeof(kwargs)}(m, kwargs)
    end
    maybe for placed where they were not passed down

How can we best unify this?
Always passing down keywords is maybe a bit imprecise and one might “loose keywords” and not recognise they stayed unused?

Maybe the log above is not a log but an approximate log (we do not yet have a type for that) - and we could omit all “pass down of keywords” if we would be more strict with the second type linked.

What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions