Setup

Once you have downloaded POGS, open R and type

1
> setwd("<pogs>/interface_r/")

in the R console. The string

1
<pogs>
must be replaced with the directory to which POGS was downloaded. To compile wrapper type

1
> install.packages("pogs_1.0.tar.gz", repos = NULL, type="source")

Make sure to replace

1
1.0
by the latest version number.

To load the POGS library type

1
> library(pogs)

R-specific usage

The R interface is a single R function, with signature

1
solution = pogs(A, f, g, params)

Inputs:

  • 1
    A
    
    is the data matrix of dimension \( m n \).
  • 1
    f
    
    and
    1
    g
    
    are lists with fields
    1
    h
    
    ,
    1
    a
    
    ,
    1
    b
    
    ,
    1
    c
    
    ,
    1
    d
    
    and
    1
    e
    
    , each of which must either be a vector of dimension \( m \) (resp. \( n \)) or a scalar. If a scalar is specified, then it is assumed that the scalar should be repeated \( m \) (resp. \( n \)) times. Multiple problems can be solved with the same matrix \( A \), if
    1
    f
    
    and
    1
    g
    
    are specified as nested lists.

Optional Inputs:

  • 1
    params
    
    is a list with fields
    1
    rel_tol
    
    ,
    1
    abs_tol
    
    ,
    1
    rho
    
    ,
    1
    max_iter
    
    ,
    1
    quiet
    
    ,
    1
    adaptive_rho
    
    .

Outputs:

  • 1
    solution$x
    
    and
    1
    solution$y
    
    are the solution vectors \(x^\star_\text{pogs}\) resp. \(y^\star_\text{pogs}\), and have dimension \( m \) resp. \( n \). If multiple objectives were specified, then
    1
    solution$x
    
    and
    1
    solution$y
    
    will be matrices of the appropriate dimension.
  • 1
    solution$l
    
    is the dual variable \(\lambda^\star_\text{pogs}\) corresponding to the constraint \(Ax = y\) and has dimension \( m \).
  • 1
    solution$optval
    
    is the value of the objective \(p^\star_\text{pogs}\) at the solution (\(p^\star_\text{pogs} = f(y^\star_\text{pogs}) + g(x^\star_\text{pogs})\)).

For more information type

1
> ?pogs

\(h\)-Functions

The values

1
f$h
and
1
g$h
can be specified using one of 16 functions. These are

1
2
kAbs,      kExp,     kHuber,   kIdentity, kIndBox01, kIndEq0,  kIndGe0,  kIndLe0,
kLogistic, kMaxNeg0, kMaxPos0, kNegEntr,  kNegLog,   kRecipr,  kSquare,  kZero

For example to specify that \(g_j(x_j) = |x_j|\) for \(j = 1\ldots 4\) and \(g_5(x_5) = I(x_5 = 0)\), use the syntax

1
> g$h = c(kAbs(4), kIndEq0())

Example Usage

See the examples listed on the left-hand side under Examples.