• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# QRMethod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中QRMethod的典型用法代码示例。如果您正苦于以下问题:C# QRMethod类的具体用法?C# QRMethod怎么用?C# QRMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QRMethod类属于命名空间,在下文中一共展示了QRMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Create

        /// <summary>
        /// Initializes a new instance of the <see cref="UserQR"/> class. This object will compute the
        /// QR factorization when the constructor is called and cache it's factorization.
        /// </summary>
        /// <param name="matrix">The matrix to factor.</param>
        /// <param name="method">The QR factorization method to use.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="matrix"/> is <c>null</c>.</exception>
        public static UserQR Create(Matrix<Complex> matrix, QRMethod method = QRMethod.Full)
        {
            if (matrix.RowCount < matrix.ColumnCount)
            {
                throw Matrix.DimensionsDontMatch<ArgumentException>(matrix);
            }

            Matrix<Complex> q;
            Matrix<Complex> r;

            var minmn = Math.Min(matrix.RowCount, matrix.ColumnCount);
            var u = new Complex[minmn][];

            if (method == QRMethod.Full)
            {
                r = matrix.Clone();
                q = Matrix<Complex>.Build.SameAs(matrix, matrix.RowCount, matrix.RowCount);

                for (var i = 0; i < matrix.RowCount; i++)
                {
                    q.At(i, i, 1.0f);
                }

                for (var i = 0; i < minmn; i++)
                {
                    u[i] = GenerateColumn(r, i, i);
                    ComputeQR(u[i], r, i, matrix.RowCount, i + 1, matrix.ColumnCount, Control.MaxDegreeOfParallelism);
                }

                for (var i = minmn - 1; i >= 0; i--)
                {
                    ComputeQR(u[i], q, i, matrix.RowCount, i, matrix.RowCount, Control.MaxDegreeOfParallelism);
                }
            }
            else
            {
                q = matrix.Clone();

                for (var i = 0; i < minmn; i++)
                {
                    u[i] = GenerateColumn(q, i, i);
                    ComputeQR(u[i], q, i, matrix.RowCount, i + 1, matrix.ColumnCount, Control.MaxDegreeOfParallelism);
                }

                r = q.SubMatrix(0, matrix.ColumnCount, 0, matrix.ColumnCount);
                q.Clear();

                for (var i = 0; i < matrix.ColumnCount; i++)
                {
                    q.At(i, i, 1.0f);
                }

                for (var i = minmn - 1; i >= 0; i--)
                {
                    ComputeQR(u[i], q, i, matrix.RowCount, i, matrix.ColumnCount, Control.MaxDegreeOfParallelism);
                }
            }

            return new UserQR(q, r, method);
        }
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:67,代码来源:UserQR.cs


示例2: Create

        /// <summary>
        /// Initializes a new instance of the <see cref="UserQR"/> class. This object will compute the
        /// QR factorization when the constructor is called and cache it's factorization.
        /// </summary>
        /// <param name="matrix">The matrix to factor.</param>
        /// <param name="method">The QR factorization method to use.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="matrix"/> is <c>null</c>.</exception>
        public static UserQR Create(Matrix<double> matrix, QRMethod method = QRMethod.Full)
        {
            if (matrix.RowCount < matrix.ColumnCount)
            {
                throw Matrix.DimensionsDontMatch<ArgumentException>(matrix);
            }

            Matrix<double> q;
            Matrix<double> r;

            var minmn = Math.Min(matrix.RowCount, matrix.ColumnCount);
            var u = new double[minmn][];

            if (method == QRMethod.Full)
            {
                r = matrix.Clone();
                q = matrix.CreateMatrix(matrix.RowCount, matrix.RowCount);

                for (var i = 0; i < matrix.RowCount; i++)
                {
                    q.At(i, i, 1.0);
                }

                for (var i = 0; i < minmn; i++)
                {
                    u[i] = GenerateColumn(r, i, i);
                    ComputeQR(u[i], r, i, matrix.RowCount, i + 1, matrix.ColumnCount, Control.NumberOfParallelWorkerThreads);
                }

                for (var i = minmn - 1; i >= 0; i--)
                {
                    ComputeQR(u[i], q, i, matrix.RowCount, i, matrix.RowCount, Control.NumberOfParallelWorkerThreads);
                }
            }
            else
            {
                q = matrix.Clone();

                for (var i = 0; i < minmn; i++)
                {
                    u[i] = GenerateColumn(q, i, i);
                    ComputeQR(u[i], q, i, matrix.RowCount, i + 1, matrix.ColumnCount, Control.NumberOfParallelWorkerThreads);
                }

                r = q.SubMatrix(0, matrix.ColumnCount, 0, matrix.ColumnCount);
                q.Clear();

                for (var i = 0; i < matrix.ColumnCount; i++)
                {
                    q.At(i, i, 1.0);
                }

                for (var i = minmn - 1; i >= 0; i--)
                {
                    ComputeQR(u[i], q, i, matrix.RowCount, i, matrix.ColumnCount, Control.NumberOfParallelWorkerThreads);
                }
            }

            return new UserQR(q, r, method);
        }
开发者ID:nakamoton,项目名称:mathnet-numerics,代码行数:67,代码来源:UserQR.cs


示例3: Create

        /// <summary>
        /// Initializes a new instance of the <see cref="DenseQR"/> class. This object will compute the
        /// QR factorization when the constructor is called and cache it's factorization.
        /// </summary>
        /// <param name="matrix">The matrix to factor.</param>
        /// <param name="method">The QR factorization method to use.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="matrix"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="matrix"/> row count is less then column count</exception>
        public static DenseQR Create(DenseMatrix matrix, QRMethod method = QRMethod.Full)
        {
            if (matrix.RowCount < matrix.ColumnCount)
            {
                throw Matrix.DimensionsDontMatch<ArgumentException>(matrix);
            }

            var tau = new float[Math.Min(matrix.RowCount, matrix.ColumnCount)];
            Matrix<float> q;
            Matrix<float> r;

            if (method == QRMethod.Full)
            {
                r = matrix.Clone();
                q = new DenseMatrix(matrix.RowCount);
                Control.LinearAlgebraProvider.QRFactor(((DenseMatrix) r).Values, matrix.RowCount, matrix.ColumnCount, ((DenseMatrix) q).Values, tau);
            }
            else
            {
                q = matrix.Clone();
                r = new DenseMatrix(matrix.ColumnCount);
                Control.LinearAlgebraProvider.ThinQRFactor(((DenseMatrix) q).Values, matrix.RowCount, matrix.ColumnCount, ((DenseMatrix) r).Values, tau);
            }

            return new DenseQR(q, r, method, tau);
        }
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:34,代码来源:DenseQR.cs


示例4: DenseQR

        /// <summary>
        /// Initializes a new instance of the <see cref="DenseQR"/> class. This object will compute the
        /// QR factorization when the constructor is called and cache it's factorization.
        /// </summary>
        /// <param name="matrix">The matrix to factor.</param>
        /// <param name="method">The QR factorization method to use.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="matrix"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="matrix"/> row count is less then column count</exception>
        public DenseQR(DenseMatrix matrix, QRMethod method = QRMethod.Full)
        {
            if (matrix == null)
            {
                throw new ArgumentNullException("matrix");
            }

            if (matrix.RowCount < matrix.ColumnCount)
            {
                throw Matrix.DimensionsDontMatch<ArgumentException>(matrix);
            }

            Tau = new Complex32[Math.Min(matrix.RowCount, matrix.ColumnCount)];

            if (method == QRMethod.Full)
            {
                MatrixR = matrix.Clone();
                MatrixQ = new DenseMatrix(matrix.RowCount);
                Control.LinearAlgebraProvider.QRFactor(((DenseMatrix)MatrixR).Values, matrix.RowCount, matrix.ColumnCount,
                                                       ((DenseMatrix)MatrixQ).Values, Tau);
            }
            else
            {
                MatrixQ = matrix.Clone();
                MatrixR = new DenseMatrix(matrix.ColumnCount);
                Control.LinearAlgebraProvider.ThinQRFactor(((DenseMatrix)MatrixQ).Values, matrix.RowCount, matrix.ColumnCount,
                                                       ((DenseMatrix)MatrixR).Values, Tau);
            }
        }
开发者ID:the-vk,项目名称:mathnet-numerics,代码行数:37,代码来源:DenseQR.cs


示例5: QRSolveFactored

 public override void QRSolveFactored(double[] q, double[] r, int rowsR, int columnsR, double[] tau, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
 {
     var work = new double[columnsR*Control.BlockSize];
     QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work, method);
 }
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:5,代码来源:MklLinearAlgebraProvider.double.cs


示例6: QRSolve

 public override void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
 {
     var work = new double[columns*Control.BlockSize];
     QRSolve(a, rows, columns, b, columnsB, x, work, method);
 }
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:5,代码来源:MklLinearAlgebraProvider.double.cs


示例7: CanSolveForMatrixWithTallRandomMatrix

        public void CanSolveForMatrixWithTallRandomMatrix(QRMethod method)
        {
            var matrixA = Matrix<Complex>.Build.Random(20, 10, 1);
            var matrixACopy = matrixA.Clone();
            var factorQR = matrixA.QR(method);

            var matrixB = Matrix<Complex>.Build.Random(20, 5, 1);
            var matrixX = factorQR.Solve(matrixB);

            // The solution X row dimension is equal to the column dimension of A
            Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);

            // The solution X has the same number of columns as B
            Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);

            var test = (matrixA.ConjugateTranspose() * matrixA).Inverse() * matrixA.ConjugateTranspose() * matrixB;

            for (var i = 0; i < matrixX.RowCount; i++)
            {
                for (var j = 0; j < matrixX.ColumnCount; j++)
                {
                    AssertHelpers.AlmostEqual(test[i, j], matrixX[i, j], 12);
                }
            }

            // Make sure A didn't change.
            for (var i = 0; i < matrixA.RowCount; i++)
            {
                for (var j = 0; j < matrixA.ColumnCount; j++)
                {
                    Assert.AreEqual(matrixACopy[i, j], matrixA[i, j]);
                }
            }
        }
开发者ID:skair39,项目名称:mathnet-numerics,代码行数:34,代码来源:QRTests.cs


示例8: QRFactor

        public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau, QRMethod method = QRMethod.Full)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }

            if (q == null)
            {
                throw new ArgumentNullException("q");
            }

            if (r.Length != rowsR * columnsR)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
            }

            if (tau.Length < Math.Min(rowsR, columnsR))
            {
                throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
            }

            if (q.Length != rowsR * rowsR)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
            }

            var work = new float[columnsR * Control.BlockSize];
            SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
        }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:30,代码来源:GotoBlasLinearAlgebraProvider.float.cs


示例9: QRSolveFactored

        public override void QRSolveFactored(double[] q, double[] r, int rowsR, int columnsR, double[] tau, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }

            if (q == null)
            {
                throw new ArgumentNullException("q");
            }

            if (b == null)
            {
                throw new ArgumentNullException("q");
            }

            if (x == null)
            {
                throw new ArgumentNullException("q");
            }

            if (r.Length != rowsR*columnsR)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "r");
            }

            if (q.Length != rowsR*rowsR)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "q");
            }

            if (b.Length != rowsR*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
            }

            if (x.Length != columnsR*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
            }

            if (rowsR < columnsR)
            {
                throw new ArgumentException(Resources.RowsLessThanColumns);
            }

            var work = new double[columnsR*Control.BlockSize];
            QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work);
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:50,代码来源:AcmlLinearAlgebraProvider.Double.cs


示例10: QRSolve

        /// <summary>
        /// Solves A*X=B for X using QR factorization of A.
        /// </summary>
        /// <param name="a">The A matrix.</param>
        /// <param name="rows">The number of rows in the A matrix.</param>
        /// <param name="columns">The number of columns in the A matrix.</param>
        /// <param name="b">The B matrix.</param>
        /// <param name="columnsB">The number of columns of B.</param>
        /// <param name="x">On exit, the solution matrix.</param>
        /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
        /// <remarks>Rows must be greater or equal to columns.</remarks>
        public virtual void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }

            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (a.Length != rows*columns)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
            }

            if (b.Length != rows*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
            }

            if (x.Length != columns*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
            }

            if (rows < columns)
            {
                throw new ArgumentException(Resources.RowsLessThanColumns);
            }

            var work = new float[rows * columns];

            var clone = new float[a.Length];
            a.Copy(clone);

            if (method == QRMethod.Full)
            {
                var q = new float[rows*rows];
                QRFactor(clone, rows, columns, q, work);
                QRSolveFactored(q, clone, rows, columns, null, b, columnsB, x, method);
            }
            else
            {
                var r = new float[columns*columns];
                ThinQRFactor(clone, rows, columns, r, work);
                QRSolveFactored(clone, r, rows, columns, null, b, columnsB, x, method);
            }
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:66,代码来源:ManagedLinearAlgebraProvider.Single.cs


示例11: QRSolveFactored

 /// <summary>
 /// Solves A*X=B for X using a previously QR factored matrix.
 /// </summary>
 /// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be
 /// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
 /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>. </param>
 /// <param name="rowsA">The number of rows in the A matrix.</param>
 /// <param name="columnsA">The number of columns in the A matrix.</param>
 /// <param name="tau">Contains additional information on Q. Only used for the native solver
 /// and can be <c>null</c> for the managed provider.</param>
 /// <param name="b">On entry the B matrix; on exit the X matrix.</param>
 /// <param name="columnsB">The number of columns of B.</param>
 /// <param name="x">On exit, the solution matrix.</param>
 /// <param name="work">The work array - only used in the native provider. The array must have a length of at least N,
 /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
 /// work size value.</param>
 /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
 /// <remarks>Rows must be greater or equal to columns.</remarks>
 public virtual void QRSolveFactored(double[] q, double[] r, int rowsA, int columnsA, double[] tau, double[] b, int columnsB, double[] x, double[] work, QRMethod method = QRMethod.Full)
 {
     QRSolveFactored(q, r, rowsA, columnsA, tau, b, columnsB, x, method);
 }
开发者ID:ArtyomBaranovskiy,项目名称:mathnet-numerics,代码行数:22,代码来源:ManagedLinearAlgebraProvider.Double.cs


示例12: QRSolveFactored

        public override void QRSolveFactored(float[] q, float[] r, int rowsA, int columnsA, float[] tau, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }

            if (q == null)
            {
                throw new ArgumentNullException("q");
            }

            if (b == null)
            {
                throw new ArgumentNullException("q");
            }

            if (x == null)
            {
                throw new ArgumentNullException("q");
            }

            int rowsQ, columnsQ, rowsR, columnsR;
            if (method == QRMethod.Full)
            {
                rowsQ = columnsQ = rowsR = rowsA;
                columnsR = columnsA;
            }
            else
            {
                rowsQ = rowsA;
                columnsQ = rowsR = columnsR = columnsA;
            }

            if (r.Length != rowsR * columnsR)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR * columnsR), "r");
            }

            if (q.Length != rowsQ * columnsQ)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ * columnsQ), "q");
            }

            if (b.Length != rowsA * columnsB)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA * columnsB), "b");
            }

            if (x.Length != columnsA * columnsB)
            {
                throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA * columnsB), "x");
            }

            if (method == QRMethod.Full)
            {
                var info = SafeNativeMethods.s_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x);
                
                if (info == (int)NativeError.MemoryAllocation)
                {
                    throw new MemoryAllocationException();
                }

                if (info < 0)
                {
                    throw new InvalidParameterException(Math.Abs(info));
                }
            }
            else
            {
                // we don't have access to the raw Q matrix any more(it is stored in R in the full QR), need to think about this.
                // let just call the managed version in the meantime. The heavy lifting has already been done. -marcus
                base.QRSolveFactored(q, r, rowsA, columnsA, tau, b, columnsB, x, QRMethod.Thin);
            }
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:75,代码来源:OpenBlasLinearAlgebraProvider.Single.cs


示例13: QRSolve

 /// <summary>
 /// Solves A*X=B for X using QR factorization of A.
 /// </summary>
 /// <param name="a">The A matrix.</param>
 /// <param name="rows">The number of rows in the A matrix.</param>
 /// <param name="columns">The number of columns in the A matrix.</param>
 /// <param name="b">The B matrix.</param>
 /// <param name="columnsB">The number of columns of B.</param>
 /// <param name="x">On exit, the solution matrix.</param>
 /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
 /// <remarks>Rows must be greater or equal to columns.</remarks>
 public virtual void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
 {
     var work = new double[rows * columns];
     QRSolve(a, rows, columns, b, columnsB, x, work, method);
 }
开发者ID:ArtyomBaranovskiy,项目名称:mathnet-numerics,代码行数:16,代码来源:ManagedLinearAlgebraProvider.Double.cs


示例14: QRSolveFactored

 /// <summary>
 /// Solves A*X=B for X using a previously QR factored matrix.
 /// </summary>
 /// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be
 /// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
 /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>. </param>
 /// <param name="rowsR">The number of rows in the A matrix.</param>
 /// <param name="columnsR">The number of columns in the A matrix.</param>
 /// <param name="tau">Contains additional information on Q. Only used for the native solver
 /// and can be <c>null</c> for the managed provider.</param>
 /// <param name="b">On entry the B matrix; on exit the X matrix.</param>
 /// <param name="columnsB">The number of columns of B.</param>
 /// <param name="x">On exit, the solution matrix.</param>
 /// <param name="work">The work array - only used in the native provider. The array must have a length of at least N,
 /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
 /// work size value.</param>
 /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
 /// <remarks>Rows must be greater or equal to columns.</remarks>
 public virtual void QRSolveFactored(Complex[] q, Complex[] r, int rowsR, int columnsR, Complex[] tau, Complex[] b, int columnsB, Complex[] x, Complex[] work, QRMethod method = QRMethod.Full)
 {
     QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, method);
 }
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:22,代码来源:ManagedLinearAlgebraProvider.Complex.cs


示例15: QRSolve

 /// <summary>
 /// Solves A*X=B for X using QR factorization of A.
 /// </summary>
 /// <param name="a">The A matrix.</param>
 /// <param name="rows">The number of rows in the A matrix.</param>
 /// <param name="columns">The number of columns in the A matrix.</param>
 /// <param name="b">The B matrix.</param>
 /// <param name="columnsB">The number of columns of B.</param>
 /// <param name="x">On exit, the solution matrix.</param>
 /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
 /// <remarks>Rows must be greater or equal to columns.</remarks>
 public virtual void QRSolve(Complex[] a, int rows, int columns, Complex[] b, int columnsB, Complex[] x, QRMethod method = QRMethod.Full)
 {
     var work = new Complex[rows*columns];
     QRSolve(a, rows, columns, b, columnsB, x, work, method);
 }
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:16,代码来源:ManagedLinearAlgebraProvider.Complex.cs


示例16: QR

 public override QR<Complex32> QR(QRMethod method = QRMethod.Thin)
 {
     return DenseQR.Create(this, method);
 }
开发者ID:kapilash,项目名称:mathnet-numerics,代码行数:4,代码来源:DenseMatrix.cs


示例17: QRSolve

        public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }

            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (a.Length != rows * columns)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
            }

            if (b.Length != rows * columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
            }

            if (x.Length != columns * columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
            }

            if (rows < columns)
            {
                throw new ArgumentException(Resources.RowsLessThanColumns);
            }

            var info = SafeNativeMethods.s_qr_solve(rows, columns, columnsB, a, b, x);

            if (info == (int)NativeError.MemoryAllocation)
            {
                throw new MemoryAllocationException();
            }

            if (info < 0)
            {
                throw new InvalidParameterException(Math.Abs(info));
            }

            if (info > 0)
            {
                throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient, "a");
            }
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:54,代码来源:OpenBlasLinearAlgebraProvider.Single.cs


示例18: QRSolve

        /// <summary>
        /// Solves A*X=B for X using QR factorization of A.
        /// </summary>
        /// <param name="a">The A matrix.</param>
        /// <param name="rows">The number of rows in the A matrix.</param>
        /// <param name="columns">The number of columns in the A matrix.</param>
        /// <param name="b">The B matrix.</param>
        /// <param name="columnsB">The number of columns of B.</param>
        /// <param name="x">On exit, the solution matrix.</param>
        /// <remarks>Rows must be greater or equal to columns.</remarks>
        public override void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }

            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            if (a.Length != rows*columns)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
            }

            if (b.Length != rows*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
            }

            if (x.Length != columns*columnsB)
            {
                throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
            }

            if (rows < columns)
            {
                throw new ArgumentException(Resources.RowsLessThanColumns);
            }

            var work = new double[columns*Control.BlockSize];
            QRSolve(a, rows, columns, b, columnsB, x, work);
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:50,代码来源:AcmlLinearAlgebraProvider.Double.cs


示例19: DenseQR

 DenseQR(Matrix<float> q, Matrix<float> rFull, QRMethod method, float[] tau)
     : base(q, rFull, method)
 {
     Tau = tau;
 }
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:5,代码来源:DenseQR.cs


示例20: UserQR

 UserQR(Matrix<Complex> q, Matrix<Complex> rFull, QRMethod method)
     : base(q, rFull, method)
 {
 }
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:4,代码来源:UserQR.cs



注:本文中的QRMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# QilNode类代码示例发布时间:2022-05-24
下一篇:
C# QQControlState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap