trace_reorder {lazy.symbolic}R Documentation

Reorder the arguments of the tr and * functions

Description

Reorder the arguments of the tr and * functions so that the objects specified by X_ is placed at the right most position.

Usage

trace_reorder(expr, X_, op = c("both", "%*%", "*", "%.%"), attr = FALSE)

Arguments

expr

an expression of a string

X_

a string containing the object name to be moved

op

a vector of operators to be used

attr

= TRUE to use the flag for transposition

Value

an epression

Examples

# see tests/mD0_test.R

modify_math_operators()

trace_reorder("tr(A%*%(X*C))", "X")

trace_reorder("tr(A%*%(X*B%.%C))","X")
trace_reorder("tr(A%*%(X*B*C))","X")

trace_reorder("X*B*C", "X")
trace_reorder("X%.%B*C", "X")
trace_reorder("A%*%(t(X*B)*C)","X")
trace_reorder("A%*%(t(t(X*B)*C))","X")

trace_reorder("t(X)*B*C", "X", op = "*", attr = TRUE)


[Package lazy.symbolic version 1.0.0.20250803 ]