public override int GetHashCode() { const int hash_base = 0x18d; var hash = Consts.BigPrime_int; unchecked { hash ^= LayerIndex; hash ^= OffsetWeights.GetComplexHashCode() * hash_base; hash ^= Offsets.GetComplexHashCode() * hash_base; } var outputs_count = OutputsCount; var inputs_count = InputsCount; var weights = Weights; var double_equality = EqualityComparer <Complex> .Default; for (var neuron = 0; neuron < outputs_count; neuron++) { for (var input = 0; input < inputs_count; input++) { unchecked { hash ^= double_equality.GetHashCode(weights[neuron, input]) * hash_base; } } } return(hash); }