Cheat Sheet

Manipulate expressions

Operator

Interpretation

+

addition

+=

inplace addition

-

substraction

*

multiplication

^

Hadamard (elementwise) product

|

scalar product

/

division

**

exponentiation

abs()

Euclidean (or Frobenius) norm

[]

slicing

&

horizontal concatenation

//

vertical concatenation

.T

transposition

.H

Hermitian transposition

.Tx

partial transposition

.conj

complex conjugate

.real

real part

.imag

imaginary part

Create constraints

Operator

Interpretation

< or <=

less or equal

> or >=

larger or equal

==

equal

<<

Löwner ordering \preceq, or set membership \in

>>

Löwner ordering \succeq, or set membership \ni

Create affine expressions

function

short doc

sum()

sums a list of affine expressions

diag()

diagonal matrix defined by its diagonal

diag_vect()

vector of diagonal elements of a matrix

new_param()

constant affine expression

trace()

trace of a square affine expression

lowtri()

vector of lower triangular elements

partial_transpose()

partial transposition

partial_trace()

partial trace

Create convex expressions

function

short doc

geomean()

geometric mean

norm()

(generalized) L_p- norm

tracepow()

trace of a p-th matrix power

detrootn()

n-th root of determinant

sum_k_largest()

sum of k largest elements

sum_k_smallest()

sum of k smallest elements

sum_k_largest_lambda()

sum of k largest eigenvalues

sum_k_smallest_lambda()

sum of k smallest eigenvalues

lambda_max()

largest eigenvalue

lambda_min()

smallest eigenvalue

Create sets

function

short doc

ball(r,p)

a L_p- ball of radius r

simplex(a)

a standard simplex \{x\geq 0: \Vert x \Vert_1 \leq a \}

truncated_simplex(a)

a set of the form \{ 0\leq x\leq 1: \Vert x \Vert_1 \leq a\}, or \{x: \Vert x \Vert_\infty \leq 1; \Vert x \Vert_1 \leq a\}

Other useful functions

Transform a problem

function

short doc

convert_quad_to_socp()

replaces quadratic constraints by equivalent second order cone constraints

as_real()

transform complex SDP to equivalent real-valued SDP

as_dual()

returns Lagrangian dual of a problem

Get information on a problem

function

short doc

get_variable(name)

gets the variable object name

get_valued_variable(name)

gets the value of the variable name

check_current_value_feasibility()

are the current variable value feasible?

obj_value()

objective for the current variable values

.type

returns problem’s type

Miscellaneous

function

short doc

available_solvers()

lists installed solvers

import_cbf()

imports data from a .cbf file

eval_dict()

evaluates a dictionary of picos variables (after a problem has been solved)

write_to_file()

writes problem to a file