Initializing help system before first use

xpress.ndarray

Description

Subclass of numpy.ndarray which overrides the comparison operators to support implementations of these operators which return non-Boolean objects.

The purpose of this class is to allow expressions like a <= b, where a and/or b are arrays of xpress.expression objects, to produce an array of xpress.constraint objects. This is in contrast to the behaviour of numpy.ndarray, where comparisons with <=, == or >= always produce Boolean arrays.

xpress.ndarray provides the same API as numpy.ndarray. For more information, see the NumPy documentation.

Instances of xpress.ndarray can be created using the xpress.array function, by calling myarray.view(xpress.ndarray) on an existing NumPy array, or by using the xpress.ndarray constructor, which has the same signature as numpy.ndarray, as described in the NumPy documentation. In addition, all functions in the Xpress Python interface which return NumPy arrays, such as problem.addVariables, xpress.Dot and xpress.Sum, return instances of xpress.ndarray.

The <=, == or >= operators provided by xpress.ndarray apply these operators element-wise, delegating to the implementations of these operators provided by each element. This means that an expression like a <= b, where a and/or b contain a mixture of xpress.expression objects and numbers, will produce a result array containing a mixture of xpress.constraint objects (where one or both elements were expressions) and Boolean objects (where both elements were numbers).




© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.