getbase

getbase returns the full basis used in an sdpvar expression.

Syntax

B = getbase(x)

Examples

Expressions are built-up from internal variable indicies (getvariables) and a basis (getbase). We can extract the full basis (stacked vectorized columnwise in sparse format)

yalmip('clear')
x = sdpvar(1);
y = sdpvar(1);
z = [1 2*x;3*y 4*x+5*y + 6*x^2];

full(getbase(z))

ans =

     1     0     0     0
     0     0     3     0
     0     2     0     0
     0     4     5     6

To extract a single basis associated with a variable index getbasematrix is used.