HDF5 2.0 native complex as a first-class type on read; Python libver=
- Datatype::parse returns Datatype::Complex for class 11 (also inside
compounds, arrays and VL types) instead of the {r, i} compound view.
- Facade: DType::Complex(Box<DType>); read_complex_f32/f64 accept it.
- h5rs dump/ls/diff print native complex as h5dump/h5ls/h5diff 2.2.0 do
(checked against a fixture written by h5py 3.16 / libhdf5 2.0.0);
dump --json keeps the {r, i} compound (hdf5-json has no complex class).
- clawhdf5-wasm reads native complex datasets as [re, im] pairs.
- Python: clawhdf5.File(path, 'w', libver=...) with h5py's values,
mapped to FileBuilder::libver_bounds; 'v108' output opens in HDF5 1.8.23.
- Docs: known-issues entry moved to Fixed (history), CHANGELOG, READMEs.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -603,7 +603,22 @@ impl Diff {
|
||||
let dif = match (int_of(&va), int_of(&vb), number(&va), number(&vb)) {
|
||||
(Some(x), Some(y), ..) => x.abs_diff(y).to_string(),
|
||||
(_, _, Some(x), Some(y)) => value::fmt_float((x - y).abs(), 64),
|
||||
_ => String::new(),
|
||||
// Each part's absolute difference, as h5diff 2.x prints
|
||||
// it (`1+0i`).
|
||||
_ => match (&va, &vb) {
|
||||
(
|
||||
Value::Complex { re: ar, im: ai, .. },
|
||||
Value::Complex { re: br, im: bi, .. },
|
||||
) => match (number(ar), number(ai), number(br), number(bi)) {
|
||||
(Some(ar), Some(ai), Some(br), Some(bi)) => format!(
|
||||
"{}+{}i",
|
||||
value::fmt_float((ar - br).abs(), 64),
|
||||
value::fmt_float((ai - bi).abs(), 64)
|
||||
),
|
||||
_ => String::new(),
|
||||
},
|
||||
_ => String::new(),
|
||||
},
|
||||
};
|
||||
rows.push(format!("{pos:<24}{ta:<24}{tb:<24}{dif}"));
|
||||
}
|
||||
@@ -713,6 +728,9 @@ impl Diff {
|
||||
(Value::Array(p), Value::Array(q)) | (Value::Seq(p), Value::Seq(q)) => {
|
||||
p.len() == q.len() && p.iter().zip(q).all(|(u, v)| self.equal(a, b, u, v))
|
||||
}
|
||||
(Value::Complex { re: pr, im: pi, .. }, Value::Complex { re: qr, im: qi, .. }) => {
|
||||
self.equal(a, b, pr, qr) && self.equal(a, b, pi, qi)
|
||||
}
|
||||
(Value::Ref(None), Value::Ref(None)) => true,
|
||||
(Value::Ref(Some(p)), Value::Ref(Some(q))) => {
|
||||
// Addresses mean nothing across files: compare the paths the
|
||||
@@ -846,7 +864,10 @@ fn types_comparable(a: &Datatype, b: &Datatype) -> bool {
|
||||
(
|
||||
Datatype::Enumeration { base_type: x, .. },
|
||||
Datatype::Enumeration { base_type: y, .. },
|
||||
) => types_comparable(x, y),
|
||||
)
|
||||
| (Datatype::Complex { base_type: x, .. }, Datatype::Complex { base_type: y, .. }) => {
|
||||
types_comparable(x, y)
|
||||
}
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user