sign-methods {CVXR}R Documentation

Sign Properties

Description

Determine if an expression is positive, negative, or zero.

Usage

is_zero(object)

is_nonneg(object)

is_nonpos(object)

Arguments

object

An Expression object.

Value

A logical value.

Examples

pos <- Constant(1)
neg <- Constant(-1)
zero <- Constant(0)
unknown <- Variable()

is_zero(pos)
is_zero(-zero)
is_zero(unknown)
is_zero(pos + neg)

is_nonneg(pos + zero)
is_nonneg(pos * neg)
is_nonneg(pos - neg)
is_nonneg(unknown)

is_nonpos(-pos)
is_nonpos(pos + neg)
is_nonpos(neg * zero)
is_nonpos(neg - pos)

[Package CVXR version 1.0-14 Index]