Пример #1
0
        /// <summary>
        /// Solves the system of equations for right hand side vector B.
        /// </summary>
        /// <param name="B"></param>
        /// <param name="X"></param>
        public void SolveLU(Vector B, Vector X)
        {
            if (_LU != null)
            {
                // Make a copy of B on X:

                for (int i = 0; i < B.Length; i++)
                {
                    X[i] = B[i];
                }

                // Solve the system A*X = B, overwriting B with X:

                if (UseIntelMathKernel)
                {
                    double[] _X    = X.Data;
                    char[]   trans = "No transponse".ToCharArray();
                    int      one   = 1;
                    IntelMathKernel.dgetrs(trans, ref _N, ref one, _LU, ref _N, _IPIV, _X, ref _N, ref _Info);
                }
                else
                {
                    DGETRS _dgetrs = new DGETRS();

                    double[] _X = X.Data;

                    _dgetrs.Run("No transpose", _N, 1, _LU, 0, _N, _IPIV, 0, ref _X, 0, _N, ref _Info);
                }
            }
        }
Пример #2
0
        public void SolveLU(Vector B, Vector X)
        {
            if (_LU != null)
            {
                // Make a copy of B on X:

                for (int i = 0; i < B.Length; i++)
                {
                    X[i] = B[i];
                }

                // Solve the system A*X = B, overwriting B with X:

                DGETRS _dgetrs = new DGETRS();

                double[] _X = X.Data;

                _dgetrs.Run("No transpose", _N, 1, _LU, 0, _N, _IPIV, 0, ref _X, 0, _N, ref _Info);
            }
        }
 /// <summary>
 /// See http://www.dotnumerics.com/NumericalLibraries/LinearAlgebra/CSharpCodeFiles/dgetrs.aspx
 /// </summary>
 public void Dgetrs(string transA, int n, int nRhs, double[] a, int offsetA, int ldA, int[] ipiv, int offsetIpiv,
                    double[] b, int offsetB, int ldB, ref int info)
 => dgetrs.Run(transA, n, nRhs, a, offsetA, ldA, ipiv, offsetIpiv, ref b, offsetB, ldB, ref info);