Atoms are mathematical functions that can be applied to Expression instances. Applying an atom to an expression yields another expression. Atoms and compositions thereof are precisely the mechanisms that allow you to build up mathematical expression trees in CVXPY.

Every atom is tagged with information about its domain, sign, curvature, log-log curvature, and monotonicity; this information lets atom instances reason about whether or not they are DCP or DGP. See the Atomic Functions page for a compact, accessible summary of each atom’s attributes.


class cvxpy.atoms.atom.Atom(*args)[source]

Bases: cvxpy.expressions.expression.Expression

Abstract base class for atoms.

property domain

A list of constraints describing the closure of the region where the expression is finite.

property grad

Gives the (sub/super)gradient of the expression w.r.t. each variable.

Matrix expressions are vectorized, so the gradient is a matrix. None indicates variable values unknown or outside domain.


A map of variable to SciPy CSC sparse matrix or None.


Is the atom affine?

abstract is_atom_concave()[source]

Is the atom concave?

abstract is_atom_convex()[source]

Is the atom convex?


Is the atom log-log affine?


Is the atom log-log concave?


Is the atom log-log convex?

abstract is_decr(idx)[source]

Is the composition non-increasing in argument idx?

abstract is_incr(idx)[source]

Is the composition non-decreasing in argument idx?