Beispiel #1
0
        private void phi()
        {
            var jacob = ShoNS.Array.DoubleArray.From(FriedChiken.getJacobian().rawData);
            var omega = ShoNS.Array.DoubleArray.From(FriedChiken.omega.rawData);

            jacob = jacob.T;
            omega = omega.T;
            var solver  = new ShoNS.Array.Solver(jacob);
            var _lambda = solver.Solve(omega);

            _lambda.CopyTo(lambda, 0);
            FriedChiken.omega.xminusyA(FriedChiken.omega, lambda, FriedChiken.getJacobian());
        }
Beispiel #2
0
        private void varphi()
        {
            double norm = FriedChiken.q.norm;

            matrix.y_equals_Ax(FriedChiken.getJacobian(), FriedChiken.q, qr);
            var jacob = ShoNS.Array.DoubleArray.From(FriedChiken.getJacobian().rawData);
            var _qr   = ShoNS.Array.DoubleArray.From(qr.rawData).T;
            var solve = new ShoNS.Array.Solver(jacob);
            var z     = solve.Solve(_qr);

            double[] _qo = qo.rawData;
            z.CopyTo(_qo, 0);
            FriedChiken.q.Subtract(qo);
            if (FriedChiken.q.norm != 0)
            {
                FriedChiken.q.dividedby(FriedChiken.q.norm);
                FriedChiken.q.times(norm);
            }
        }
Beispiel #3
0
        private int psi()
        {
            FriedChiken.Tick(t); //要素アップデート、勾配の計算
            FriedChiken.Tack(t); //マスク等後処理
            int itr = 0;

            for (int s = 0; s < 50; s++)
            {
                var ff     = ShoNS.Array.DoubleArray.From(FriedChiken.getJacobian().rawData);
                var g      = ShoNS.Array.DoubleArray.From(FriedChiken.getResidual().rawData).T;
                var solver = new ShoNS.Array.Solver(ff);
                var _dx    = solver.Solve(g);
                _dx.CopyTo(dx.rawData, 0);
                FriedChiken.x.Subtract(1.0, dx);
                FriedChiken.Tick(t); //要素アップデート、勾配の計算
                FriedChiken.Tack(t); //マスク等後処理
                itr++;
                if (FriedChiken.getResidual().norm < 0.0001)
                {
                    break;
                }
            }
            return(itr);
        }