예제 #1
0
        private static double[] GetH6ByMGK(Matrix R)
        {
            var l = LaverierFadeevaMethod.Solve(R, LaverierFadeevaSolvingOptions.FullSolving);

            LaverierFadeevaExtendedResult[] ext = LaverierFadeevaExtendedResult.ConvertToExtendedLaverierFadeevaResult(l);
            ext = ext.OrderByDescending(v => v.EigenValue.Abs()).ToArray();

            int w = ext.Count(v => v.EigenValue.Abs() > 1);

            var neededVectors = ext.Take(w).Select(el => el.eigenVector).ToList();

            double[] result = new double[ext.Length];

            for (int i = 0; i < ext.Length; i++)
            {
                double sum = 0;
                for (int j = 0; j < w; j++)
                {
                    sum += neededVectors[j][i];
                }

                result[i] = sum;
            }


            return(result);
        }
예제 #2
0
        //7семестр
        public LaverierFadeevaExtendedResult[] MGKGetinfo()
        {
            Matrix dc = new Matrix(DC);
            var    laverierFadeevaResult = LaverierFadeevaMethod.Solve(dc, LaverierFadeevaSolvingOptions.FullSolving);
            var    extended = MGKInfo = LaverierFadeevaExtendedResult.ConvertToExtendedLaverierFadeevaResult(laverierFadeevaResult);


            return(extended);
        }
예제 #3
0
        static int getW(Matrix R)
        {
            var l = LaverierFadeevaMethod.Solve(R, LaverierFadeevaSolvingOptions.FullSolving);

            LaverierFadeevaExtendedResult[] ext = LaverierFadeevaExtendedResult.ConvertToExtendedLaverierFadeevaResult(l);
            ext = ext.OrderByDescending(v => v.EigenValue.Abs()).ToArray();

            var eigenAverage = ext.Sum(v => v.EigenValue) / ext.Length;
            int w            = ext.Count(v => v.EigenValue > eigenAverage);

            return(w);
        }
예제 #4
0
        private static Matrix GetA(Matrix R, out int w, int wMin)
        {
            var l = LaverierFadeevaMethod.Solve(R, LaverierFadeevaSolvingOptions.FullSolving);

            LaverierFadeevaExtendedResult[] ext = LaverierFadeevaExtendedResult.ConvertToExtendedLaverierFadeevaResult(l);
            ext = ext.OrderByDescending(v => v.EigenValue.Abs()).ToArray();

            var eigenAverage = ext.Sum(v => v.EigenValue) / ext.Length;

            w = ext.Count(v => v.EigenValue > eigenAverage);

            w = Math.Max(w, wMin);

            var neededVectors = ext.Take(w).Select(el => el.eigenVector).ToList();

            Matrix A = Matrix.Create.JoinVectors(neededVectors);

            return(A);
        }