Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/affine/imag.R
#####
## CVXPY SOURCE: atoms/affine/imag.py
## Imag_ -- extract the imaginary part of an expression
Imag_ <- new_class("Imag_", parent = AffAtom, package = "CVXR",
constructor = function(expr, id = NULL) {
if (FALSE) new_object(S7_object()) ## S7 static-check guard
if (is.null(id)) id <- next_expr_id()
expr <- as_expr(expr)
shape <- .shape(expr)
.fast_new(Imag_, S7_object(),
id = as.integer(id),
.cache = new.env(parent = emptyenv()),
args = list(expr),
shape = shape
)
}
)
# -- numeric_value: R's native Im() ----------------------------------
## CVXPY SOURCE: imag.py lines 29-32
method(numeric_value, Imag_) <- function(x, values, ...) {
Im(values[[1L]])
}
# -- shape_from_args --------------------------------------------------
## CVXPY SOURCE: imag.py lines 34-37
method(shape_from_args, Imag_) <- function(x) {
.arg_shape(x)
}
# -- Complex queries: imaginary part is always real -------------------
## CVXPY SOURCE: imag.py lines 39-47
method(is_imag, Imag_) <- function(x) FALSE
method(is_complex, Imag_) <- function(x) FALSE
# -- Symmetry --------------------------------------------------------
## CVXPY v1.8.2 fix: Im(Hermitian) is skew-symmetric, not symmetric.
## Im(A) is symmetric only when A is symmetric (real), because then
## Im(A) is the zero matrix. Prior to v1.8.2, this incorrectly
## returned is_hermitian(arg).
method(is_symmetric, Imag_) <- function(x) {
is_symmetric(.args(x)[[1L]])
}
# -- No graph_implementation: consumed by Complex2Real reduction ------
## CVXPY imag.py has no graph_implementation method.
#' Extract Imaginary Part of Expression
#'
#' Returns the imaginary part of a complex expression. R's native \code{Im()}
#' dispatches here for CVXR expressions via the Complex S3 group handler.
#'
#' @param expr A CVXR Expression.
#' @returns An \code{Imag_} atom.
#' @keywords internal
imag_expr <- function(expr) Imag_(expr)
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.