Cluster kmeansoptions equals - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Cluster is 0.1.0 — read its documentation.

HomeClusterPartitioning

KMeansOptions.Equals

Compares every option, the centres element by element.

public bool Equals(KMeansOptions other)

Parametersother is the options to compare against, or null.

Returnstrue when every option matches and both centre blocks hold the same values.

Example — two option sets built from separate arrays.

using Lodestar.Cluster;

KMeansOptions left = new() { InitialCentres = [1.0, 2.0], Seed = 3 };
KMeansOptions right = new() { InitialCentres = [1.0, 2.0], Seed = 3 };

bool same = left == right;  // => True

Remarks — a record's generated equality compares InitialCentres by reference, so the two above would be unequal without this, in the one place a caller has reason to compare: asserting that a configuration built twice is the same configuration. Tolerance compares by bits, which makes NaN equal NaN and keeps equality reflexive. the equality rule has the rule.

Applies to — net10.0, netstandard2.0.

See alsoKMeansOptions.GetHashCode, KMeansOptions.