private void CalculateB()
        {
            if (!CanCalculateArbitrage())
            {
                return;
            }

            Eigen aE = new Eigen(m_a);

            CMatrix aECVec = aE.Eigenvectors;
            CVector aECVal = aE.Eigenvalues;

            double aLambdaMax = aECVal[0].Real;

            Vector aEVec = new Vector(aECVal.Length);

            for (int i = 0; i < aECVal.Length; i++)
            {
                aEVec[i] = aECVec[i, 0].Real;
            }

            for (int i = 0; i < m_a.Rows; i++)
            {
                for (int j = 0; j < m_a.Cols; j++)
                {
                    m_b[i, j] = aEVec[i] / aEVec[j];
                    //m_b[i, j] = (m_eigenValuesTest[i] / m_eigenValuesTest[j]);
                }
            }

            Eigen bE = new Eigen(m_b);

            CMatrix bECVec = bE.Eigenvectors;
            CVector bECVal = bE.Eigenvalues;

            double bLambdaMax = bECVal[0].Real;

            Dispatcher.Invoke(() =>
            {
                ALambdaMax = Math.Round(aLambdaMax, 5);
                BLambdaMax = Math.Round(bLambdaMax, 5);
            });
        }
示例#2
0
        private void CalculateB()
        {
            if (!CanCalculateArbitrage()) return;

            Eigen aE = new Eigen(m_a);

            CMatrix aECVec = aE.Eigenvectors;
            CVector aECVal = aE.Eigenvalues;

            double aLambdaMax = aECVal[0].Real;

            Vector aEVec = new Vector(aECVal.Length);

            for (int i = 0; i < aECVal.Length; i++)
            {
                aEVec[i] = aECVec[i, 0].Real;
            }

            for (int i = 0; i < m_a.Rows; i++)
            {
                for (int j = 0; j < m_a.Cols; j++)
                {
                    m_b[i, j] = aEVec[i] / aEVec[j];
                    //m_b[i, j] = (m_eigenValuesTest[i] / m_eigenValuesTest[j]);
                }
            }

            Eigen bE = new Eigen(m_b);

            CMatrix bECVec = bE.Eigenvectors;
            CVector bECVal = bE.Eigenvalues;

            double bLambdaMax = bECVal[0].Real;

            Dispatcher.Invoke(() =>
            {
                ALambdaMax = Math.Round(aLambdaMax, 5);
                BLambdaMax = Math.Round(bLambdaMax, 5);
            });
        }