Exemplo n.º 1
0
        public static List <List <double> > GetNormalizedandWeightedLists(
            string subIndNormType, double startValue, bool scaleUp4Digits,
            List <double> weights, List <List <double> > trends)
        {
            List <List <double> > normTrends = new List <List <double> >();
            int i = 0;

            for (i = 0; i < trends[0].Count; i++)
            {
                //the columns are being normalized
                double[]        colArray  = GetDoubleArrayColumn(i, trends);
                Vector <double> normTrend = Shared.GetNormalizedVector(subIndNormType,
                                                                       weights.Sum(), scaleUp4Digits, colArray);
                normTrends.Add(normTrend.ToList());
            }
            //but the normalized columns have to be returned back to the original rows in trends
            //and weighted
            List <List <double> > normTrends2 = new List <List <double> >();

            i = 0;
            for (i = 0; i < normTrends[0].Count; i++)
            {
                double[]      colArray = GetDoubleArrayColumn(i, normTrends);
                List <double> normRow  = new List <double>();
                //weighting is transitive math, shouldn't matter if before or after normaliz
                for (int j = 0; j < colArray.Count(); j++)
                {
                    if (weights.Count > i)
                    {
                        normRow.Add(colArray[j] * weights[i]);
                    }
                }
                normTrends2.Add(normRow);
            }
            return(normTrends2);
        }