Esempio n. 1
0
        public static Doublearray operator /(Doublearray array, double val)
        {
            Doublearray res = array;

            for (int i = 0; i < array.Length1d(); i++)
            {
                res.UnsafePut1d(i, array.UnsafeAt1d(i) / val);
            }
            return(res);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }