Skip to main content
FRAMES NO FRAMES

Class IlcFloatArray

Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Map of IlcFloatArrayIlcFloatArrayIlcFloatArray
The array class for the basic floating-point class.

IlcFloatArray is the array class for the basic floating-point class. It is a handle class. The implementation class for IlcFloatArray is the undocumented class IlcFloatArrayI.

See Also:

Method Summary
public IlcIntgetSize() const
public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat * values)
public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat prototype=0)
public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat exp0, IlcFloat exp1, ...)
public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcInt exp0, IlcInt exp1, ...)
public IlcFloatExpoperator[](const IlcIntExp rank) const
public IlcFloat &operator[](IlcInt i) const
Method Detail

IlcFloatArray

public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat * values)

This constructor creates an array of floating-point numbers containing the values in the array values. The argument size must be the length of the array values. It must also be strictly greater than 0 (zero). CP Optimizer does not keep a pointer to the array values. When you create an array of floating-point values, the elements of the array must be of the same type (for example, all floating-point, or all integer, but not a mixture of the two) because those types are not necessarily the same size in C++. You can write this:

 IlcFloatArray arrayok (solver, 3, 1., 3., 2.);

or this:

 IlcFloatArray arrayOK(solver, 3, 1, 3, 2);

but not this:

 IlcFloatArray notok(solver, 3, 1., 3, 2.); // bad idea

in which some values are floating-point, some are integer, and consequently can be of different sizes in C++.


IlcFloatArray

public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat prototype=0)

This constructor creates an array of size elements. The argument size must be strictly greater than 0 (zero). The elements of this array are not initialized.


IlcFloatArray

public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcFloat exp0, IlcFloat exp1, ...)

This constructor accepts a variable number of arguments. Its second argument, size, indicates the length of the array that this constructor will create; size must be the number of arguments minus one (that is, the number of arguments of type IlcFloat); it must also be strictly greater than 0 (zero). The constructor creates an array of the values indicated by the other arguments. The arguments, exp0, exp1, etc. are all of the same type. Do not mix types within an array.


IlcFloatArray

public IlcFloatArray(IlcCPEngine solver, IlcInt size, IlcInt exp0, IlcInt exp1, ...)

This constructor accepts a variable number of arguments. Its second argument, size, indicates the length of the array that this constructor will create; size must be the number of arguments minus one (that is, the number of arguments of type IlcInt); it must also be strictly greater than 0 (zero). The constructor creates an array of the values indicated by the other arguments. The arguments, exp0, exp1, etc. are all of the same type. Do not mix types within an array.


getSize

public IlcInt getSize() const

This member function returns the number of elements in the invoking array.


operator[]

public IlcFloatExp operator[](const IlcIntExp rank) const

This subscripting operator returns a constrained floating-point expression. For clarity, let's call A the invoking array. When rank is fixed to the value i, the value of the expression is A[i]. More generally, the domain of the expression is the set of values A[i] where the i are in the domain of rank.


operator[]

public IlcFloat & operator[](IlcInt i) const

This operator returns a reference to the element at rank i. This operator can be used for accessing (that is, simply reading) the element or for modifying (that is, writing) it.