Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/affine/transpose.R
#####
## CVXPY SOURCE: atoms/affine/transpose.py
## Transpose -- transpose an expression
# -- Transpose class --------------------------------------------------
## CVXPY SOURCE: atoms/affine/transpose.py lines 26-111
Transpose <- new_class("Transpose", parent = AffAtom, package = "CVXR",
constructor = function(expr) {
if (FALSE) new_object(S7_object()) ## S7 static-check guard
expr <- as_expr(expr)
shape <- rev(.shape(expr))
.fast_new(Transpose, S7_object(),
id = next_expr_id(),
.cache = new.env(parent = emptyenv()),
args = list(expr),
shape = as.integer(shape)
)
}
)
# -- shape_from_args --------------------------------------------------
## CVXPY SOURCE: transpose.py:66-69 (#3080). 2D transpose of the arg's bounds.
method(bounds_from_args, Transpose) <- function(x) {
b <- get_bounds(.args(x)[[1L]])
transpose_bounds(b[[1L]], b[[2L]])
}
## CVXPY SOURCE: transpose.py lines 81-85
method(shape_from_args, Transpose) <- function(x) {
rev(.arg_shape(x))
}
# -- sign_from_args ---------------------------------------------------
## Inherits from AffAtom: sum_signs(args)
# -- log-log curvature: affine (CVXPY transpose.py lines 56-60) ------
method(is_atom_log_log_convex, Transpose) <- function(x) TRUE
method(is_atom_log_log_concave, Transpose) <- function(x) TRUE
# -- numeric_value ----------------------------------------------------
## CVXPY SOURCE: transpose.py lines 52-54
method(numeric_value, Transpose) <- function(x, values, ...) {
val <- values[[1L]]
if (is.matrix(val) || inherits(val, "Matrix")) {
t(val)
} else {
## Scalar: transpose is identity
val
}
}
# -- is_symmetric -----------------------------------------------------
## CVXPY SOURCE: transpose.py lines 66-69
method(is_symmetric, Transpose) <- function(x) {
.arg_shape(x)[1L] == .arg_shape(x)[2L] &&
is_symmetric(.args(x)[[1L]])
}
# -- is_skew_symmetric ------------------------------------------------
## CVXPY SOURCE: transpose.py lines 71-75
## Transposing negates a skew-symmetric matrix (t(K) == -K), which leaves it
## skew-symmetric, so the property passes straight through. Without this,
## Expression's FALSE default (expression.R:124) applied and t() silently lost
## the structure. The square-shape guard matches is_symmetric/is_hermitian
## above; it is redundant (a skew-symmetric matrix is square by definition) but
## keeps the three predicates in this file identical in shape.
method(is_skew_symmetric, Transpose) <- function(x) {
.arg_shape(x)[1L] == .arg_shape(x)[2L] &&
is_skew_symmetric(.args(x)[[1L]])
}
# -- is_hermitian -----------------------------------------------------
## CVXPY SOURCE: transpose.py lines 76-79
method(is_hermitian, Transpose) <- function(x) {
.arg_shape(x)[1L] == .arg_shape(x)[2L] &&
is_hermitian(.args(x)[[1L]])
}
# -- graph_implementation ---------------------------------------------
## CVXPY SOURCE: transpose.py lines 92-111
method(graph_implementation, Transpose) <- function(x, arg_objs, shape, data = NULL, ...) {
list(transpose_linop(arg_objs[[1L]]), list())
}
# -- expr_name --------------------------------------------------------
## CVXPY SOURCE: transpose.py lines 37-41
method(expr_name, Transpose) <- function(x) {
sprintf("t(%s)", expr_name(.args(x)[[1L]]))
}
## CVXPY SOURCE: atoms/affine/transpose.py Transpose.format_labeled.
method(format_labeled, Transpose) <- function(x) {
lbl <- label(x); if (!is.null(lbl)) return(lbl)
sprintf("t(%s)", format_labeled(.args(x)[[1L]]))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.