BoolCollection

class BoolCollection(*args)

Proxy of C++ OT::BoolCollection class.

Methods

add(self, \*args)

Append a component (in-place).

at(self, \*args)

Access to an element of the collection.

clear(self)

Reset the collection to zero dimension.

find(self, val)

Find the index of a given value.

getSize(self)

Get the collection’s dimension (or size).

isEmpty(self)

Tell if the collection is empty.

resize(self, newSize)

Change the size of the collection.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

add(self, \*args)

Append a component (in-place).

Parameters
valuetype depends on the type of the collection.

The component to append.

Examples

>>> import openturns as ot
>>> x = ot.Point(2)
>>> x.add(1.)
>>> print(x)
[0,0,1]
at(self, \*args)

Access to an element of the collection.

Parameters
indexpositive int

Position of the element to access.

Returns
elementtype depends on the type of the collection

Element of the collection at the position index.

clear(self)

Reset the collection to zero dimension.

Examples

>>> import openturns as ot
>>> x = ot.Point(2)
>>> x.clear()
>>> x
class=Point name=Unnamed dimension=0 values=[]
find(self, val)

Find the index of a given value.

Parameters
valcollection value type

The value to find

Returns
indexint

The index of the first occurence of the value, or the size of the container if not found. When several values match, only the first index is returned.

getSize(self)

Get the collection’s dimension (or size).

Returns
nint

The number of components in the collection.

isEmpty(self)

Tell if the collection is empty.

Returns
isEmptybool

True if there is no element in the collection.

Examples

>>> import openturns as ot
>>> x = ot.Point(2)
>>> x.isEmpty()
False
>>> x.clear()
>>> x.isEmpty()
True
resize(self, newSize)

Change the size of the collection.

Parameters
newSizepositive int

New size of the collection.

Notes

If the new size is smaller than the older one, the last elements are thrown away, else the new elements are set to the default value of the element type.

Examples

>>> import openturns as ot
>>> x = ot.Point(2, 4)
>>> print(x)
[4,4]
>>> x.resize(1)
>>> print(x)
[4]
>>> x.resize(4)
>>> print(x)
[4,0,0,0]