public static double Min(Doublearray a) { double value = a.At1d(0); for (int i = 1; i < a.Length1d(); i++) { double nvalue = a.At1d(i); if (nvalue >= value) { continue; } value = nvalue; } return(value); }
public static int ArgMin(Doublearray a) { if (!(/*a.Rank() == 1 && **/ a.Dim(0) > 0)) { throw new Exception("CHECK_ARG: a.Rank()==1 && a.Dim(0)>0"); } double value = a.At1d(0); int index = 0; for (int i = 1; i < a.Length1d(); i++) { double nvalue = a.At1d(i); if (nvalue >= value) { continue; } value = nvalue; index = i; } return(index); }