R/078_atoms_elementwise_inv_pos.R

Defines functions inv_pos

Documented in inv_pos

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/elementwise/inv_pos.R
#####

## CVXPY SOURCE: atoms/elementwise/inv_pos.py
## InvPos -- inverse of positive value x^{-1}

#' Inverse position: \eqn{x^{-1}} (for x > 0)
#'
#' @param x An Expression
#' @returns A Power atom with p=-1
#' @export
inv_pos <- function(x) {
  ## `power()`, NOT `Power()` -- inv_pos.py:7 is `return power(x, -1)`, the
  ## wrapper, whose `approx = TRUE` default canonicalizes to SOC.  Constructing
  ## `Power` directly emits PowCone3D and locks out every SOC-only solver.
  ## p = -1 is exactly representable, so the SOC form is exact.
  power(x, -1)
}

Try the CVXR package in your browser

Any scripts or data that you put into this service are public.

CVXR documentation built on Aug. 24, 2026, 9:10 a.m.