Multi Valued Array
Variable-length array for multivalued mappings — CSR-like storage with domain-codomain operations, reverse, cascade, and filtering.
Installation
pip install vcti-multi-valued-array>=1.6.0
In pyproject.toml dependencies
dependencies = [
"vcti-multi-valued-array>=1.6.0",
]
Quick Start
import numpy as np
from vcti.multivalued import MultiValuedArray, reverse, cascade
# Create: element 0 has values [10, 20], element 1 has [30], element 2 has [40, 50, 60]
mva = MultiValuedArray(counts=np.array([2, 1, 3]), values=np.array([10, 20, 30, 40, 50, 60]))
mva.counts() # array([2, 1, 3])
mva.offsets() # array([0, 2, 3, 6])
mva.values() # array([10, 20, 30, 40, 50, 60])
mva.value_indices() # array([0, 0, 1, 2, 2, 2]) — which element each value belongs to
# With domain and codomain metadata
faces = np.array([(1, 1), (2, 2)], dtype=[('id', 'u4'), ('type', 'u4')])
vertices = np.array([(1, 0., 0.), (2, 2., 0.), (3, 3., 1.), (4, 2., 2.), (5, 0., 2.)],
dtype=[('id', 'u4'), ('x', 'f4'), ('y', 'f4')])
connectivity = MultiValuedArray(
counts=np.array([4, 3], dtype=np.uint32),
values=np.array([0, 1, 3, 4, 1, 2, 3], dtype=np.uint32),
domain=faces,
codomain=vertices,
)
# Reverse: for each vertex, which faces contain it
node_faces = reverse(connectivity)
Core API
MultiValuedArray
| Method | Description |
|---|---|
counts() |
Number of values per element (lazy from offsets) |
offsets() |
Cumulative positions into values (lazy from counts) |
values() |
Flat array of all values |
value_indices() |
Maps each value to its element index |
domain() |
Domain element identifiers |
codomain() |
Codomain element identifiers |
set_values(values) |
Set/replace values array |
len(mva) |
Number of elements (domain size) |
mva[i] |
Values for element at index i |
for v in mva |
Iterate over element value slices |
mva == other |
Structural equality check |
Operations
| Function | Description |
|---|---|
reverse(mva) |
Invert mapping (A->B becomes B->A) |
cascade(ab, bc) |
Compose mappings (A->B + B->C = A->C) |
concatenate(a, b) |
Vertically stack two arrays |
sort_and_unique(mva) |
Sort and deduplicate values per element |
non_negative_array(src) |
Extract non-negative values from 2D array |
from_joint_counts_and_values_array(arr) |
Parse interleaved format |
get_counts_values_array(mva) |
Convert to interleaved format |
get_chunk(mva, a, b) |
Extract elements [a:b] |
Dependencies
- numpy (>=1.24)
- numba (>=0.59) — JIT compilation for performance-critical loops
- vcti-nputils (>=1.0.0) — position_array, as_ndarray
Metadata
Release files for vcti-multi-valued-array 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vcti_multi_valued_array-1.6.0.tar.gz | 17.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vcti_multi_valued_array-1.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / vcti_multi_valued_array-1.6.0.tar.gz
| Download URL | vcti_multi_valued_array-1.6.0.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58840928e8222522bb3ca54e4233a2f41eec65587c4fb26ae19c03571b86db30
|
|
BLAKE2b-256 checksum How to use checksums |
29acbdbd9ac42d060c0e87e8605182fb7731353bc35690997b42b37e80398432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logRelease files / vcti_multi_valued_array-1.6.0-py3-none-any.whl
| Download URL | vcti_multi_valued_array-1.6.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34a59f5bc19f12d3c3038fb12dd0b0c1c2a03c52062a831b11efcadeb5f1249b
|
|
BLAKE2b-256 checksum How to use checksums |
e514acc984a7717c6def82a269061a84d136dbf9dad8f575f2f66bf781405aa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency log