Loading...
Searching...
No Matches

GAMS Special Values. More...

GAMS Special Values.

GAMS GDX offers five special values: NA (not available), UNDEF (undefined), EPS (explicit zero, a standard zero is usually not stored in the sparse GDX format), PINF or POSINF (positive infinity) and MINF or NEGINF (negative infinity). All special values can be queried and checked for by using this class. While UNDEF, POSINF and NEGINF have natural counterparts in Matlab (NaN, Inf and -Inf, respectively), NA and EPS do not. The latter two are therefore mapped to a special NaN and -0, respectively.

Example:
>> a = [0, NaN, SpecialValues.NA, SpecialValues.UNDEF, SpecialValues.EPS, SpecialValues.POSINF, SpecialValues.NEGINF]
a =
0 NaN NaN NaN 0 Inf -Inf
>> SpecialValues.isNA(a)
ans =
1×7 logical array
0 0 1 0 0 0 0
>> SpecialValues.isUndef(a)
ans =
1×7 logical array
0 1 0 1 0 0 0
>> SpecialValues.isEps(a)
ans =
1×7 logical array
0 0 0 0 1 0 0

Static Public Member Functions

static function isUndef (in value)
 Checks if values are GAMS UNDEF.
 
static function isNA (in value)
 Checks if values are GAMS NA.
 
static function isEps (in value)
 Checks if values are GAMS EPS.
 
static function isPosInf (in value)
 Checks if values are GAMS PINF.
 
static function isNegInf (in value)
 Checks if values are GAMS MINF.
 

Public Attributes

Constant Property UNDEF = nan
 Undefined value.
 
Constant Property NA = gams.transfer.gdx.gt_get_sv
 Value not available (in Matlab: special nan value)
 
Constant Property EPS = gams.transfer.gdx.gt_get_sv
 Explicit zero (in Matlab: negative zero)
 
Constant Property POSINF = inf
 positive infinity
 
Constant Property NEGINF = -inf
 negative infinity
 

Member Function Documentation

◆ isEps()

static function isEps ( in  value)
static

Checks if values are GAMS EPS.

  • b = isEps(v) checks if the values v are GAMS EPS values

Example:

GAMS Special Values.
Definition: SpecialValues.m:87
static function isEps(in value)
Checks if values are GAMS EPS.
Constant Property EPS
Explicit zero (in Matlab: negative zero)
Definition: SpecialValues.m:110
Constant Property UNDEF
Undefined value.
Definition: SpecialValues.m:95

b equals [0, 0, 1, 0]

◆ isNA()

static function isNA ( in  value)
static

Checks if values are GAMS NA.

  • b = isNA(v) checks if the values v are GAMS NA values

Example:

static function isNA(in value)
Checks if values are GAMS NA.
Constant Property NA
Value not available (in Matlab: special nan value)
Definition: SpecialValues.m:103

b equals [0, 0, 1, 0]

◆ isNegInf()

static function isNegInf ( in  value)
static

Checks if values are GAMS MINF.

  • b = isNegInf(v) checks if the values v are GAMS MINF values

Example:

Constant Property POSINF
positive infinity
Definition: SpecialValues.m:117
Constant Property NEGINF
negative infinity
Definition: SpecialValues.m:125
static function isNegInf(in value)
Checks if values are GAMS MINF.

b equals [0, 0, 0, 1]

◆ isPosInf()

static function isPosInf ( in  value)
static

Checks if values are GAMS PINF.

  • b = isPosInf(v) checks if the values v are GAMS POSINF values

Example:

static function isPosInf(in value)
Checks if values are GAMS PINF.

b equals [0, 0, 1, 0]

◆ isUndef()

static function isUndef ( in  value)
static

Checks if values are GAMS UNDEF.

  • b = isUndef(v) checks if the values v are GAMS UNDEF values

Example:

static function isUndef(in value)
Checks if values are GAMS UNDEF.

b equals [0, 0, 0, 1]