public void OnSearchOneAxisPoint(ref List <double> pointValue, double threValue, cyEnumPointSmooth smooth, cyEnumPointSel method, out List <int> searchIndex) { Trace.Assert(_gauss != null); searchIndex = new List <int>(); if (pointValue.Count == 0) { return; } OnValueTranslateSingle(ref pointValue, smooth); switch (method) { case cyEnumPointSel.First: { int tIndex = OnSearchFirstPoint(pointValue, threValue); searchIndex.Add(tIndex); break; } case cyEnumPointSel.Last: { int tIndex = OnSearchLastPoint(pointValue, threValue); searchIndex.Add(tIndex); break; } case cyEnumPointSel.Best: { int tIndex = OnSearchBestPoint(pointValue, threValue); searchIndex.Add(tIndex); break; } case cyEnumPointSel.All: { int tIndex = OnSearchAllPoint(pointValue, threValue, out searchIndex); break; } default: { int tIndex = OnSearchBestPoint(pointValue, threValue); searchIndex.Add(tIndex); break; } } }
/// <summary> /// 搜索绝对的最大的梯度下降区域 /// </summary> /// <param name="pointValue"></param> /// <param name="searchIndex"></param> private void OnSearchAbsGrandient(List <double> pointValue, List <double> xlocal, List <double> ylocal, double LimitValue, cyEnumPointSel pointSel, int lenth1, out List <double> findX, out List <double> findY) { findX = new List <double>(); findY = new List <double>(); // 用于计算拥有多少个数据 int rowCount = pointValue.Count() / lenth1; int startIndex = 0; for (int i = 0; i < rowCount; i++) { List <double> tmpLocal = pointValue.GetRange(startIndex, lenth1); switch (pointSel) { case cyEnumPointSel.First: { int tmpIndex = OnSearchFirstPoint(tmpLocal, LimitValue); if (tmpIndex >= 0) { tmpIndex += startIndex; findX.Add(xlocal[tmpIndex]); findY.Add(ylocal[tmpIndex]); } break; } case cyEnumPointSel.Last: { int tmpIndex = OnSearchLastPoint(tmpLocal, LimitValue); if (tmpIndex >= 0) { tmpIndex += startIndex; findX.Add(xlocal[tmpIndex]); findY.Add(ylocal[tmpIndex]); } break; } case cyEnumPointSel.Best: { int tmpIndex = OnSearchBestPoint(tmpLocal, LimitValue); if (tmpIndex >= 0) { tmpIndex += startIndex; findX.Add(xlocal[tmpIndex]); findY.Add(ylocal[tmpIndex]); } break; } case cyEnumPointSel.Mid: { int tmpIndex = OnSearchMidPoint(tmpLocal, LimitValue); if (tmpIndex >= 0) { tmpIndex += startIndex; findX.Add(xlocal[tmpIndex]); findY.Add(ylocal[tmpIndex]); } break; } case cyEnumPointSel.All: { List <int> searchIndex; int tmpIndex = OnSearchAllPoint(tmpLocal, LimitValue, out searchIndex); if (tmpIndex > 0) { for (int t = 0; t < tmpIndex; t++) { int index = searchIndex[t] + startIndex; findX.Add(xlocal[index]); findY.Add(ylocal[index]); } } break; } default: break; } startIndex += lenth1; } }