コード例 #1
0
        public Mid_4_3(ref RawData r, ref Mid_4_1 md41, ref Mid_4_2 m42)
        {
            rd     = r;
            md42   = m42;
            mid4_3 = new int[rd.Cols];
            Array.Clear(mid4_3, 0, mid4_3.Length);
            sw = new StreamWriter(Common.debugpath + "\\" + "MID4_3.txt");

            // test ++++++++++++++++++++++++++++++++++++++++++++++++
            // md42.digit[0] = 1;
            // md42.digit[1] = 1;

            // make SPN Combination FROM Mid_4_2
            // make that each array in md41.rlist has multiple elements of digit[i].
            R1pnList rFrom, rTo;

            rFrom = md41.rlist.Clone();
            for (int i = 0; i < md42.digit.Length; i++)
            {
                if (md42.digit[i] <= 1)
                {
                    continue;
                }
                rFrom.rList[i].MakeMultiple(md42.digit[i]);
            }

            // make SPN Combination
            R1pnList rTarget = new R1pnList();

            rTo = new R1pnList();
            for (int i = 0; i < md42.digit.Length; i++)
            //for (int i = md42.digit.Length-1; i>=0 ; i--)
            {
                if (md42.digit[i] <= 0)
                {
                    continue;
                }
                rTarget = new R1pnList();
                for (int j = 0; j < rFrom.rList[i].cp / md42.digit[i]; j++)
                {
                    R1pnList rToTo = rTo.Clone();
                    rToTo.AddAllList(rFrom.rList[i].r1pn, j * md42.digit[i], md42.digit[i]);
                    rTarget.MergeList(rToTo);
                    rToTo = null;
                }
                rTo = rTarget;
                GC.Collect();
            }
            rTo = null;
            rTarget.print(ref sw);

            // count each pn how many times it comes in the SPN Combination table.
            rTarget.getCountEachPN(ref mid4_3);
            Common.printArray("MID4_3 :MID4_3", mid4_3, ref sw);
        }
コード例 #2
0
        public Mid_3_1(ref RawData r)
        {
            rd           = r;
            rlist        = new R1pnList();
            mid3_1       = new int[max_mid31_Count, rd.Cols];
            mid3_1_Count = 0;
            for (int i = 0; i < max_mid31_Count; i++)
            {
                for (int j = 0; j < rd.Cols; j++)
                {
                    mid3_1[i, j] = 0;
                }
            }

            sw = new StreamWriter(Common.debugpath + "\\" + "MID3_1.txt");
            int count = (int)(100 / Common.GpspInterval);

            for (int i = 0; i < count; i++)
            {
                R1pn r1 = new R1pn(5);
                rlist.Add(r1);
            }

            // make G%SP table
            int index;

            for (Int16 i = 0; i < r.Cols; i++)
            {
                index = (int)(r.PerSP[i] / Common.GpspInterval);
                rlist.rList[index].Add(i);
            }
            // test code
            // rlist.rList[3].Add(5);
            // rlist.rList[3].Add(9);
            // rlist.rList[3].Add(28);
            // rlist.rList[3].Add(45);
            // rlist.rList[3].Add(34);

            //Get Max index of a R1pn
            count = rlist.GetMaxCount();
            index = 0;
            for (int i = 0; i < rlist.rList.Count; i++)
            {
                if (rlist.rList[i].cp == count)
                {
                    for (int j = 0; j < rlist.rList[i].cp; j++)
                    {
                        mid3_1[index, rlist.rList[i].r1pn[j]] = 1;
                    }
                    index++;
                }
            }
            mid3_1_Count = index;

            rlist.print(ref sw, 10);

            int[] temp = new int[rd.Cols];
            if (mid3_1_Count == 1)
            {
                for (int i = 0; i < rd.Cols; i++)
                {
                    temp[i] = mid3_1[0, i];
                }
                Common.printArray("Mid-3-1: Result: ", temp, ref sw);
            }
            else
            {
                for (int k = 0; k < mid3_1_Count; k++)
                {
                    for (int i = 0; i < rd.Cols; i++)
                    {
                        temp[i] = mid3_1[k, i];
                    }
                    Common.printArray("Mid-3-1-" + (k + 1).ToString() + ": Result: ", temp, ref sw);
                }
            }

            rank = new int[rd.Cols];
            rlist.makeRankArray(ref rank);
        }
コード例 #3
0
ファイル: Mid_4_1.cs プロジェクト: akira-Hong/MyTestProject
        public Mid_4_1(ref RawData r)
        {
            rd     = r;
            mid4_1 = new int[rd.Cols];
            mx_mn  = new double[rd.Cols];
            rlist  = new R1pnList();
            Array.Clear(mid4_1, 0, mid4_1.Length);
            sw = new StreamWriter(Common.debugpath + "\\" + "MID4_1.txt");

            Common.printArray("MID4_1 :Rawdata %SP ", rd.PerSP, ref sw);
            sw.WriteLine("MID4_1: Average %SP : " + rd.APerSP.ToString("#####0.00"));

            // make mx_mn array
            for (int i = 0; i < rd.Cols; i++)
            {
                mx_mn[i] = rd.APerSP - rd.PerSP[i];
            }
            // get the most number out of + values.
            int    index = Common.MaxIndex(ref mx_mn);
            double val   = mx_mn[index];
            R1pn   r1    = new R1pn(10);

            for (Int16 i = 0; i < rd.Cols; i++)
            {
                if (mx_mn[i] == val)
                {
                    mid4_1[i] = 1; r1.Add(i);
                }
            }
            rlist.Add(r1);
            Common.printArray("MID4_1 :first", mid4_1, ref sw);
            // get the least number out of - values;
            index = Common.MinIndex(ref mx_mn);
            val   = mx_mn[index];
            r1    = new R1pn(10);
            for (Int16 i = 0; i < rd.Cols; i++)
            {
                if (mx_mn[i] == val)
                {
                    mid4_1[i] = 1; r1.Add(i);
                }
            }
            rlist.Add(r1);
            Common.printArray("MID4_1 :second", mid4_1, ref sw);
            // get the least number out of + values;
            index = Common.MinIndexOutofPlus(ref mx_mn);
            val   = mx_mn[index];
            r1    = new R1pn(10);
            for (Int16 i = 0; i < rd.Cols; i++)
            {
                if (mx_mn[i] == val)
                {
                    mid4_1[i] = 1; r1.Add(i);
                }
            }
            rlist.Add(r1);
            Common.printArray("MID4_1 :third", mid4_1, ref sw);

            // get the most number out of - values;
            index = Common.MaxIndexOutofMinus(ref mx_mn);
            val   = mx_mn[index];
            r1    = new R1pn(10);
            for (Int16 i = 0; i < rd.Cols; i++)
            {
                if (mx_mn[i] == val)
                {
                    mid4_1[i] = 1; r1.Add(i);
                }
            }
            rlist.Add(r1);
            Common.printArray("MID4_1 :MX/MN", mx_mn, ref sw);
            Common.printArray("MID4_1 :MID4_1", mid4_1, ref sw);

            rlist.print(ref sw);
        }