コード例 #1
0
        internal static DF AddRow(DF df, AR ts)
        {
            List <double> row   = ts.ToList();
            DF            dfRes = AddRow(df, row);

            return(dfRes);
        }
コード例 #2
0
        internal Norm(AR X, double factor, double minFactor, double maxFactor)
        {
            this.factor = factor;
            double min = double.MaxValue;
            double max = double.MinValue;

            for (int i = 1; i < X.Length; i++)
            {
                if (X[i] < min)
                {
                    min = X[i];
                }
                if (X[i] > max)
                {
                    max = X[i];
                }
            }
            this.xMin   = min * (1 - minFactor);
            this.xMax   = max * (1 + maxFactor);
            this.xRange = this.xMax - this.xMin;
            if (this.xRange == 0)
            {
                this.xRange = this.xMax;
            }
        }
コード例 #3
0
        internal AR Clone()
        {
            AR arClone = new AR(this.Length);

            AR.Copy(this, arClone, 1, this.Length, 1, this.Length);
            return(arClone);
        }
コード例 #4
0
        internal AR Normalize(AR X)
        {
            AR nX  = (X - this.xMin) / this.xRange;
            AR fnX = nX * this.factor;

            return(fnX);
        }
コード例 #5
0
        internal static AR C(AR ar1, AR ar2)
        {
            AR conc = new AR(ar1.Length + ar2.Length);

            Copy(ar1, conc, 1, ar1.Length, 1, ar1.Length);
            Copy(ar2, conc, 1, ar2.Length, ar1.Length + 1, conc.Length);
            return(conc);
        }
コード例 #6
0
        internal static AR C(AR ar, double x)
        {
            AR conc = new AR(ar.Length + 1);

            Copy(ar, conc, 1, ar.Length, 1, ar.Length);
            conc[conc.Length] = x;
            return(conc);
        }
コード例 #7
0
        internal static DF AddColumn(DF df, AR ts)
        {
            List <double> col   = ts.ToList();
            DF            dfRes = df.Clone();

            dfRes.AddColumn(col);
            return(dfRes);
        }
コード例 #8
0
        public static AR operator -(AR ar, double val)
        {
            AR arSub = new AR(ar.Length);

            for (int i = 1; i <= ar.Length; i++)
            {
                arSub[i] = ar[i] - val;
            }
            return(arSub);
        }
コード例 #9
0
        public static AR operator +(AR ar, double val)
        {
            AR arSum = new AR(ar.Length);

            for (int i = 1; i <= ar.Length; i++)
            {
                arSum[i] = ar[i] + val;
            }
            return(arSum);
        }
コード例 #10
0
        internal static AR Abs(AR ar)
        {
            AR arAbs = ar.Clone();

            for (int i = 1; i <= ar.Length; i++)
            {
                arAbs[i] = Math.Abs(ar[i]);
            }
            return(arAbs);
        }
コード例 #11
0
        internal static AR Rep(double val, int n)
        {
            AR rep = new AR(n);

            for (int i = 1; i <= rep.Length; i++)
            {
                rep[i] = val;
            }
            return(rep);
        }
コード例 #12
0
        public static AR operator *(AR ar, double val)
        {
            AR arPro = new AR(ar.Length);

            for (int i = 1; i <= ar.Length; i++)
            {
                arPro[i] = ar[i] * val;
            }
            return(arPro);
        }
コード例 #13
0
        internal AR SubAr(int ini, int end)
        {
            int diff  = end - ini;
            AR  subar = new AR(diff + 1);

            for (int i = ini; i <= end; i++)
            {
                subar[i - ini + 1] = this[i];
            }
            return(subar);
        }
コード例 #14
0
        public static AR operator /(AR ar1, AR ar2)
        {
            if (ar1.Length != ar2.Length)
            {
                throw new Exception("Error. Different size");
            }
            AR arDiv = new AR(ar1.Length);

            for (int i = 1; i <= ar1.Length; i++)
            {
                arDiv[i] = ar1[i] / ar2[i];
            }
            return(arDiv);
        }
コード例 #15
0
        internal static double Sum(AR ar1, AR ar2)
        {
            if (ar1.Length != ar2.Length)
            {
                throw new Exception("Error. Different size");
            }
            double sum = 0;

            for (int i = 1; i <= ar1.Length; i++)
            {
                sum = sum + ar1[i] + ar2[i];
            }
            return(sum);
        }
コード例 #16
0
        public static AR operator /(AR ar, double val)
        {
            if (val == 0)
            {
                throw new Exception("Error. Division by zero");
            }
            AR arDiv = new AR(ar.Length);

            for (int i = 1; i <= ar.Length; i++)
            {
                arDiv[i] = ar[i] / val;
            }
            return(arDiv);
        }
コード例 #17
0
        internal static void Copy(AR arFrom, AR arTo, int iniFrom, int endFrom, int iniTo, int endTo)
        {
            if (endFrom < iniFrom || endTo < iniTo)
            {
                throw new Exception("Error. end cannot be less than ini");
            }
            if (endFrom - iniFrom != endTo - iniTo)
            {
                throw new Exception("Error. intervals from and to are different");
            }
            int diff = iniTo - iniFrom;

            for (int i = iniTo; i <= endTo; i++)
            {
                arTo[i] = arFrom[i - diff];
            }
        }
コード例 #18
0
        internal void AddColumn(AR ts)
        {
            List <double> col = ts.ToList();

            this.AddColumn(col);
        }
コード例 #19
0
 internal static double Sum(AR ar)
 {
     return(ar.Sum());
 }
コード例 #20
0
        internal void AddRow(AR ts)
        {
            List <double> row = ts.ToList();

            this.AddRow(row);
        }
コード例 #21
0
 internal DF(AR ts, bool isRow) : this(ts.ToArray(), isRow)
 {
 }
コード例 #22
0
 internal Norm(AR X) : this(X, 1, 0, 1)
 {
 }
コード例 #23
0
        internal AR UnNormalize(AR nX)
        {
            AR X = (nX / this.factor) * this.xRange + this.xMin;

            return(X);
        }