Ejemplo n.º 1
0
        private static Double[] CalculateNormalizeVector(Double[,] matrix)
        {
            Int32 n = matrix.GetLength(0);

            Double[] notNormalizeVector = new Double[n];

            for (Int32 i = 0; i < n; i++)
            {
                Double tmp = 1;
                for (Int32 j = 0; j < n; j++)
                {
                    tmp *= matrix[i, j];
                }

                notNormalizeVector[i] = Math.Pow(tmp, (Double)1/n);
            }

            Double sumOfVector = notNormalizeVector.Sum();

            Double[] normalizeVector = notNormalizeVector.Select(v => v / sumOfVector).ToArray();

            return normalizeVector;
        }