コード例 #1
0
        /// <summary>
        /// Solve least squares problem M x = b.
        /// The right-hand-side std::vector x may be b,
        /// which will give a fractional increase in speed.
        /// </summary>
        /// <param name="b"></param>
        /// <param name="x"></param>
        public unsafe void Solve(Vector b, Vector x)
        {
            //assert(b.size() == A_.Columns());

            x = b;
            int n = A_.Columns;

            fixed(float *data = A_.Datablock())
            {
                fixed(float *data2 = x.Datablock())
                {
                    Netlib.dposl_(data, &n, &n, data2);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Solve least squares problem M x = b.
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public unsafe Vector Solve(Vector b)
        {
            //assert(b.size() == A_.Columns());

            int    n   = A_.Columns;
            Vector ret = new Vector(b);

            fixed(float *data = A_.Datablock())
            {
                fixed(float *data2 = ret.Datablock())
                {
                    Netlib.dposl_(data, &n, &n, data2);
                }
            }

            return(ret);
        }