public static StepProgress FromPercent(float[] percents) { var res = new StepProgress() { m_Steps = new float[percents.Length] }; Array.Copy(percents, res.m_Steps, res.m_Steps.Length); return(res); }
public static StepProgress FromCount(int count) { var res = new StepProgress() { m_Steps = new float[count] }; for (int i = 0; i < count; i++) { res.m_Steps[i] = 1f / count; } return(res); }
public static StepProgress FromWeight(float[] weights) { var res = new StepProgress() { m_Steps = new float[weights.Length] }; float summ = 0; foreach (var weight in weights) { summ += weight; } for (int i = 0; i < weights.Length; i++) { res.m_Steps[i] = weights[i] / summ; } return(res); }