Skip to content

tf_align.tfd silently narrows the returned object's domain to range(arg) #266

@fabian-s

Description

@fabian-s

Pre-existing bug, now more visible after #242. tf_align.tfd (R/register.R:163, 175) constructs its return as tfd(ret, arg = arg, ...) and omits domain = domain, so the returned aligned curve has domain range(arg) rather than the input's wider domain.

The warp itself preserves the input domain — only the aligned tfd is narrowed.

Reproduce

library(tf)
x <- tf_rgp(3, arg = seq(0.1, 0.9, length.out = 9), domain = c(0, 1))
tf_domain(x)                            # 0 1
tf_domain(tf_align(x, method = "srvf")) # 0.1 0.9 — silently narrowed

Fix

Add domain = tf_domain(input) to the tfd() call that constructs the return. Add a regression test verifying domain round-trip.

Reported during the June-2026 ground-up review's PR for #242.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions