linear_expand_expr {lazy.symbolic} | R Documentation |
Lienarly Distribute Functions
Usage
linear_expand_expr(
expr,
...,
exchangable_ops = c(""),
most_out = c("+", "-"),
type = c("binary", "unary", "both")
)
Arguments
expr |
an expression or a string |
... |
Character strings giving function or operator names to be linearly expanded (e.g., '"tr"', '"inv"', '"*"'). |
exchangable_ops |
Character vector of additional operators/functions to be expanded. By default empty, but the names supplied in '...' are automatically included here. |
most_out |
specifies which operators are regarded as the "outermost" targets for distribution. By default c("+","-"), so functions are distributed over addition/subtraction (e.g., tr(A-B) -> tr(A) - tr(B)). If changed, distribution can be applied with respect to other operators. For example, most_out = " \itemtypeOne of '"binary"', '"unary"', or '"both"'. Controls whether only binary calls (length 3), only unary calls (length 2), or both are targeted for expansion. Default is '"both"'. |
an expression Japanese help file: linear_expand_expr_JPH
linear_expand_expr("tr(A-B)", "tr", "inv") linear_expand_expr("inv(tr(A-B)) %*% C", "tr") linear_expand_expr("tr(A-B+C)", "tr") linear_expand_expr("A-B", "tr")
linear_expand_expr("A%*%(X-B)", "%*%") linear_expand_expr("tr(A%*%(X-B))", "tr", "%*%", "(") linear_expand_expr("tr(A%*%(X-B))", exchangable_ops = c("tr", "%*%", "("))
linear_expand_expr("(A-B)*(A-B)", "*")
linear_expand_expr("tr(A%*%B)", "tr", most_out = "%*%")
linear_expand_expr("tr(A-B) - tr(-A)", "tr", type="binary") linear_expand_expr("tr(A-B) - tr(-A)", "tr", type="unary") linear_expand_expr("tr(A-B) - tr(-A)", "tr", type="both")