コード例 #1
0
        public static PolynomialData LsPolynomial(Vector <double> data, Vector <double> index, int order)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }

            if (order != 3 && order != 5)
            {
                throw new NotImplementedException("Uniquement le 3e et le 5e ordre sont implantés");
            }

            var dataOut = new PolynomialData(order);

            Matrix <double> V = MatrixOperation.VandermondeMatrix(index, order);

            Vector <double> p = V.QR(QRMethod.Full).Solve(data);
            Vector <double> r = data - (V * p);

            dataOut.PolynomialParams = Vector <double> .Build.DenseOfArray(p.ToArray());

            dataOut.VandermondeMatrix = V;
            dataOut.FreedomDegrees    = data.Count - (order + 1);
            dataOut.ResidualNorm      = r.L2Norm();
            dataOut.PolynomialOrder   = order;

            return(dataOut);
        }
コード例 #2
0
        public static Vector <double> GetCartesianPoint(PolynomialData polyDataLatitude, PolynomialData polyDataLongitude, PolynomialData polyDataAltitude, int nbStep)
        {
            if (polyDataLatitude == null)
            {
                throw new ArgumentNullException("polyDataLatitude");
            }
            if (polyDataLongitude == null)
            {
                throw new ArgumentNullException("polyDataLongitude");
            }
            if (polyDataAltitude == null)
            {
                throw new ArgumentNullException("polyDataAltitude");
            }

            return(Vector <double> .Build.Dense(new[] {
                GetPolynomialValue(nbStep, polyDataLatitude.PolynomialParams, polyDataLatitude.PolynomialOrder),
                GetPolynomialValue(nbStep, polyDataLongitude.PolynomialParams, polyDataLongitude.PolynomialOrder),
                GetPolynomialValue(nbStep, polyDataAltitude.PolynomialParams, polyDataAltitude.PolynomialOrder)
            }));
        }