示例#1
0
        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);
        }
示例#2
0
        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);
        }