Ejemplo n.º 1
0
        public Matrix <double> Calculate(Matrix <double> a, Matrix <double> n)
        {
            int             order = 28;
            Matrix <double> U     = new MatrixDouble(a.Col, a.Row);
            Matrix <double> S     = new MatrixDouble(a.Col, a.Row);

            U = U.Unity();
            S = S.Unity();
            U = U * 20.98637;
            var Inv = (a - U).Inverse();
            var At  = (a + U) * Inv;
            var N   = n * Globals.MMPA_a28[0];
            var dx  = 100.0 / (order + 1.0);

            ExpStatusChangedEvent?.Invoke((int)(dx));
            for (int i = 1; i <= order; i++)
            {
                S = At * S;
                N = N + S * n * Globals.MMPA_a28[i];
                ExpStatusChangedEvent?.Invoke((int)((i + 1) * dx));
            }
            N.RemoveMinuses();

            return(N);
        }
Ejemplo n.º 2
0
        public Matrix <double> Calculate(Matrix <double> a, Matrix <double> n)
        {
            Matrix <double> _exp = a.Clone();

            int counter = 0;

            do
            {
                _exp = _exp / 2.0;
                counter++;
            } while (_exp.MaxValueAbs() >= 0.5);

            _exp = exp(_exp);
            var dx = 100.0 / counter;

            for (int i = 0; i < counter; i++)
            {
                if (double.IsInfinity(_exp.Arr[9, 9]) || double.IsInfinity(_exp.Arr[8, 8]) || double.IsInfinity(_exp.Arr[7, 7]))
                {
                    Console.WriteLine("");
                }
                _exp = _exp.Pow(2);
                ExpStatusChangedEvent?.Invoke((int)(dx * i));
            }
            n = _exp * n;
            return(n);
        }
Ejemplo n.º 3
0
        public Matrix <double> Calculate(Matrix <double> a, Matrix <double> n)
        {
            Matrix <Complex> U = new MatrixComplex(a.Col, a.Row);
            Matrix <Complex> N = new MatrixComplex(n.Col, n.Row);
            //Matrix<Complex> N = n * Globals.Alpha[0].Real;
            var aa = a.Cast <Complex>();
            var nn = n.Cast <Complex>();

            U = U.Unity();
            var dx = 100.0 / 7.0;

            for (int i = 1; i <= 7; i++)
            {
                var temp  = aa - (U * Globals.Theta[i]);
                var temp1 = temp.Inverse();
                var _n    = temp1 * nn * Globals.Alpha[i];
                var str   = "";
                N = N + _n;
                ExpStatusChangedEvent?.Invoke((int)(i * dx));
                //if (i == 1)
                //{
                //    for (int k = 0; k < temp1.Col; k++)
                //    {
                //        for (int j = 0; j < temp1.Row; j++)
                //        {
                //            str += temp1.Arr[k, j].Real + "  " + temp1.Arr[k, j].Imaginary + "\t";
                //        }
                //        str += "\n";
                //    }
                //    str += "\n";
                //    File.AppendAllText("F://testmatrix.txt", str);
                //}
            }
            Matrix <double> result = N.Cast <double>();

            result *= 2;
            result += n * Globals.Alpha[0].Real;
            result.RemoveMinuses();
            return(result);
        }