feat: write complex numbers, incl. HDF5 2.0 native complex (class 11)

- Datatype::Complex serializes class 11 version 5 byte-identically to
  libhdf5 2.2.0; containers holding it are written as version 5.
- DatasetBuilder::with_complex_f32/f64_data (h5py's {r, i} compound,
  default) and with_native_complex_f32/f64_data (class 11, opt-in);
  make_(native_)complex_f32/f64_type for attributes.
- Dataset::read_complex_f64/f32 read either form.
- Python create_dataset accepts complex64/complex128 (compound form).
- Parsing unchanged: class 11 still surfaces as {r, i}.
- Tests vs h5py 3.16 / libhdf5 2.0.0 and h5dump 2.2.0; docs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-28 21:25:03 -05:00
co-authored by Claude Opus 5.5
parent bce07e9cb9
commit d0d5347cd9
21 changed files with 790 additions and 24 deletions
+2 -1
View File
@@ -218,7 +218,8 @@ with clawhdf5.File("data.h5", "r+") as f:
`'r+'` cannot create or delete datasets and groups, or delete attributes
(`NotImplementedError`, nothing written). New files (`'w'`) take numeric
arrays (`float64`, `float32`, `int64`, `int32`, `uint8`):
arrays (`float64`, `float32`, `int64`, `int32`, `uint8`, and `complex64`/
`complex128`, stored as h5py's compound `{r, i}`):
```python
with clawhdf5.File("new.h5", "w") as f: