CVXMOD – Built-in atoms

Introduction

Atoms in CVXMOD are used to manipulate expressions and generate functions. All atoms take one or more expressions as arguments, and generate a new expression. CVXMOD supplies several common atoms. Here they are split into two groups: LP representable atoms, which can be used within linear programs, and other atoms, which cannot.

LP representable atoms

  • sum(expr)
    Sum of the elements of expr.
    Affine and increasing in expr.

  • max(expr)
    Maximum element of expr.
    Convex and increasing in expr.

  • max((expr1, expr2, ...))
    Maximum element of a list of (scalar) expressions.
    Convex and increasing in expr.

  • min(expr)
    Minimum element of expr.
    Concave and increasing in expr.

  • min((expr1, expr2, ...))
    Minimum element of a list of (scalar) expressions.
    Concave and increasing in expr.

  • abs(expr)
    Elementwise absolute value of expr.
    Convex in expr.

  • pos(expr)
    Elementwise positive portion of expr. Equivalent to max(expr, 0).
    Positive; convex and increasing in expr.

  • neg(expr)
    Elementwise negative portion of expr. It is equivalent to min(expr, 0).
    Negative; concave and increasing in expr.

  • norm1(expr)
    1-norm of expr. Equivalent to sum(abs(expr)).
    Positive; convex in expr.

  • norminf(expr)
    Infinity-norm of expr. Equivalent to max(abs(expr)).
    Positive; convex in expr.

Other atoms

  • norm2(expr)
    2-norm (euclidean norm) of expr. Mathematically equivalent to sqrt(sum(square(expr))).
    Positive; convex in expr.

  • entropy(expr)
    Entropy of expr. Mathematically equivalent to the sum over i of -expr_i*log(expr_i).
    Concave in expr.

  • exp(expr)
    Elementwise exponentiation of expr.
    Positive; convex and increasing in expr.

  • huber(expr, M=1)
    Huber penalty function of expr, with halfwidth M. Defined as 2*M*abs(x) - M**2 for abs(x) >= M, and abs(x)**2 for abs(x) <= M. M must be a positive constant.
    Convex in expr.

  • kl(u, v)
    Kullback Leibler divergence between u and v. Defined as the sum over i of u_i*log(u_i/v_i).
    Jointly convex in u and v.

  • log(expr)
    Elementwise logarithm of expr.
    Concave and increasing in expr.

  • lse(expr)
    Logarithm of the sum of the elementwise exponentiation of expr. (Often called log-sum-exp.) Equivalent to log(sum(exp(expr))).
    Convex and increasing in expr.

  • power(expr, p)
    Elementwise pth power.
    Positive; convex and increasing in expr if p is a positive even integer.
    Positive; convex and increasing in expr if p > 1 and expr is known positive.
    Positive; concave and increasing in expr if 0 < p < 1 and expr is known positive.

  • quadform(expr, Q)
    Quadratic form. Mathematically equivalent to transpose(expr)*Q*expr.
    Positive; convex in expr if Q is known positive semidefinite (PSD).
    Negative; concave in expr if Q is known negative semidefinite (NSD).
    Monotonic when the sign of expr is known.

  • square(expr)
    Elementwise square of expr.
    Positive; convex in expr.
    Monotonic when the sign of expr is known.

  • sqrt(expr)
    Concave; increasing in expr, with the domain constraint expr >= 0.