// using System; // using Unity.Mathematics; // using static Unity.Mathematics.math; // [Serializable] // public class Selector : Neuron { // public Selector(Cluster parent, string name) : base(parent, name) { } // public Selector(ClusterPrefab parent, string name) : base(parent, name) {} // public override Nucleus ShallowCloneTo(Cluster newParent) { // Selector clone = new(newParent, this.name) { // // array = this.array, // curve = this.curve, // curvePreset = this.curvePreset, // curveMax = this.curveMax, // }; // return clone; // } // public override void UpdateStateIsolated() { //float3 bias) { // float3 max = this.bias; // float maxSqrLength = lengthsq(max); // //Applying the weight factors // foreach (Synapse synapse in this.synapses) { // float3 input = synapse.weight * synapse.nucleus.outputValue; // float inputSqrlength = lengthsq(input); // if (inputSqrlength > maxSqrLength) { // max = input; // maxSqrLength = inputSqrlength; // } // } // // Activation function // float3 result; // switch (this.curvePreset) { // case CurvePresets.Linear: // result = max; // break; // case CurvePresets.Sqrt: // result = normalize(max) * System.MathF.Sqrt(length(max)); // break; // case CurvePresets.Power: // result = normalize(max) * System.MathF.Pow(length(max), 2); // break; // case CurvePresets.Reciprocal: { // float magnitude = length(max); // if (magnitude > 0) // result = normalize(max) * (1 / magnitude); // else // result = float3(0, 0, 0); // break; // } // default: // float activatedValue = this.curve.Evaluate(length(max)); // result = normalize(max) * activatedValue; // break; // } // this.outputValue = result; // } // }