Skip to content

t2s invariants: fold negated arguments and trace of a rank-1 outer product #427

Description

@petlenz

The t2s invariants don't fold a negated tensor argument or a rank-1 outer product. On main (dim 2 and 3):

Expression Today Expected
trace(-A) tr(-A) -tr(A)
norm(-A) norm(-A) norm(A)
det(-A) det(-A) det(A) for even dim, -det(A) for odd dim
dot(-A) dot(-A) dot(A)
trace(otimes(u, v)), u,v rank-1 tr(outer(u, {1}, v, {2})) dot_product(u, {1}, v, {1})

Scaled arguments already fold (trace((-2)*A)-2*tr(A)); only the bare tensor_negative node is missed. The trace(-A) and trace(u⊗v) rules existed on the old 72-trace-simplifier branch but were not part of the #70#72 rescue (5252027).

Plan: add them as t2s_rules (try_trace_negative, try_trace_outer_product, try_norm_negative, try_det_negative, try_dot_negative) driven by the factories, with rule unit tests and end-to-end checks.

Signed-off-by: petlenz peterlenz89.pl@gmail.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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