IndicesCollection

class IndicesCollection(*args)

Fixed size collection of Indices.

This class is a container for a fixed size list of Indices. Lists cannot be shrunk or extended, but values can be modified.

Available constructors:

IndicesCollection(size, stride, indices)

IndicesCollection(sequence)

Parameters
sizeint

Collection size.

strideint

Size of each element Default creates an empty sample with dimension 1.

valuesIndices or flat (1d) array, list or tuple of int

The point that will be repeated along the sample. Default creates a sample filled with zeros (null vectors).

sequenceIndicesCollection

Copy values from a collection of Indices.

Examples

Create a IndicesCollection

>>> import openturns as ot
>>> indices = ot.Indices(12)
>>> indices.fill()
>>> listIndices = ot.IndicesCollection(3, 4, indices)
>>> print(listIndices)
[[0,1,2,3],[4,5,6,7],[8,9,10,11]]

Create a IndicesCollection from a (2d) array, list or tuple

>>> import numpy as np
>>> listIndices = ot.IndicesCollection(np.array([(1, 2), (3, 4), (5, 6)]))

and back

>>> indices = np.array(listIndices)

Get an Indices. Note that a copy is returned, modifying it does not alter original list.

>>> first = listIndices[0]
>>> first[0] = 0
>>> print(first)
[0,2]
>>> print(listIndices)
[[1,2],[3,4],[5,6]]

To mdify values, one has to change the whole element.

>>> listIndices[0] = [7, 8]
>>> print(listIndices)
[[7,8],[3,4],[5,6]]

Methods

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getImplementation(self)

Accessor to the underlying implementation.

getName(self)

Accessor to the object’s name.

setName(self, name)

Accessor to the object’s name.

getSize

__init__(self, \*args)

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

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getImplementation(self)

Accessor to the underlying implementation.

Returns
implImplementation

The implementation class.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.