Jagged Array¶
JaggedArray ¶
Bases: _placeholders.Placeholder
Jagged array: A data structure in which each element in a two-dimensional.
array has a different length in a one-dimensional array. The internal length of the data is different, so shape is not defined. Only shape[0] can be accessed directly in .shape.
A jagged array is an array with the following data structure, for example
[[1, 2, 3],
[3, 2, 4, 5],
[0, 1]]
The Placeholder class can handle multi-dimensional arrays that can be defined with shape, but it cannot handle a jagged arrays. Therefore, we need to use this class instead.
shape: Tuple[_type_annotations.ShapeElementType] property ¶
Shape cannot be defined in the jagged array.
Only the length can be defined, so only the .shape[0] corresponding to the length is returned.
Returns:
| Type | Description |
|---|---|
Tuple[_type_annotations.ShapeElementType] | Tuple[Expression]: (length, ) |
__init__(label, dim, uuid=None) ¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label | str | label of variable | required |
dim | int | dimension of jagged array. Because of the jagged array data structure, | required |
uuid | Optional[str] | uuid. Defaults to None. | None |
Raises:
| Type | Description |
|---|---|
ModelingError | The jagged array can currently only handle up to two dimensions. This limitation will be resolved in an update. |