Survival 0.2.0 nelsonaalencurve gethashcode - CyrilB1531/lodestar GitHub Wiki

Lodestar.Survival 0.2.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Home › Survival estimators

NelsonAalenCurve.GetHashCode

A hash consistent with the equality, in constant time.

public int GetHashCode()

Returns — a hash over the number of steps.

Example — equal curves hash alike.

using Lodestar.Survival;

NelsonAalenCurve left = new([new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)], [0.0, 0.25]);
NelsonAalenCurve right = new([new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)], [0.0, 0.25]);

bool alike = left.GetHashCode() == right.GetHashCode();  // => True

Remarks — both arrays share one index, so the step count stands for both. Equal curves agree on it; unequal ones are allowed to collide rather than pay for a walk.

Applies to — net10.0, netstandard2.0.

See also — NelsonAalenCurve.Equals, NelsonAalenCurve.