cvxr_power: Create a Power atom

View source: R/066_atoms_elementwise_power.R

cvxr_powerR Documentation

Create a Power atom

Description

CVXPY's power(x, p): x raised to the power p, for any argument (a plain number becomes a constant). cvxr_power() is the preferred name. power() is the same function, kept because existing code uses it; it masks power, the unrelated glm() link constructor, so with CVXR attached write stats::power() in a glm() family. x^p is the same atom for an expression x.

Usage

cvxr_power(x, p, max_denom = 1024L, approx = TRUE)

power(x, p, max_denom = 1024L, approx = TRUE)

Arguments

x

An Expression (the base), OR a positive constant if p is a variable (the identity b^x = exp(x * log(b)) is used).

p

Numeric exponent, Parameter, or Expression. If p is a non-constant Expression and x is a positive constant, dispatches to exp(p * log(x)).

max_denom

Maximum denominator for rational approximation

approx

If TRUE (default), use SOC approximation. If FALSE, use exact power cone.

Value

A Power or PowerApprox atom, or an exp expression for the const-base case.

Note

sqrt(x) on a CVXR expression dispatches to Power(x, 0.5) via the Math group generic. See math_atoms for all standard R function dispatch.


CVXR documentation built on Oct. 19, 2026, 5:07 p.m.