/// <summary>Initializes a new instance of the <see cref="LeastSquaresRegression"/> class.
        /// </summary>
        /// <param name="order">The order of the regression.</param>
        /// <param name="basisFunctions">The basis functions to take into account for the regression.</param>
        /// <param name="absoluteSingularValueThreshold">The absolute threshold for singular values, i.e. singular values less than the threshold are assumed to be <c>0.0</c>.</param>
        /// <param name="relativeSingularValueThreshold">The relative threshold for singular values, i.e. singular values less than the product of the relative threshold and the greatest singular value are assumed to be <c>0.0</c>.</param>
        public LeastSquaresRegression(int order, ILeastSquaresRegressionBasisFunctions basisFunctions, double absoluteSingularValueThreshold = MachineConsts.Epsilon, double relativeSingularValueThreshold = MachineConsts.Epsilon)
            : base(CurveResource.AnnotationParametrizationLeastSquares, order + 1)
        {
            BasisFunctions = basisFunctions ?? throw new ArgumentNullException(nameof(basisFunctions));

            if (order < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(order));
            }
            Order = order;

            AbsoluteSingularValueThreshold = absoluteSingularValueThreshold;
            RelativeSingularValueThreshold = relativeSingularValueThreshold;

            m_Name     = new IdentifierString(String.Format("LeastSquareRegression {0}", order));
            m_LongName = new IdentifierString(String.Format(CurveResource.LongNameParametrizationLeastSquares, order));
        }
Example #2
0
        /// <summary>Initializes a new instance of the <see cref="WeightedLeastSquaresRegression"/> class.
        /// </summary>
        /// <param name="order">The order of the regression.</param>
        /// <param name="basisFunction">The basis function to take into account for the regression.</param>
        /// <param name="absoluteSingularValueThreshold">The absolute threshold for singular values, i.e. singular values less than the threshold are assumed to be <c>0.0</c>.</param>
        /// <param name="relativeSingularValueThreshold">The relative threshold for singular values, i.e. singular values less than the product of the relative threshold and the greatest singular value are assumed to be <c>0.0</c>.</param>
        public WeightedLeastSquaresRegression(int order, ILeastSquaresRegressionBasisFunctions basisFunction, double absoluteSingularValueThreshold = MachineConsts.Epsilon, double relativeSingularValueThreshold = MachineConsts.Epsilon)
            : base(order + 1)
        {
            if (basisFunction == null)
            {
                throw new ArgumentNullException("baisFunction");
            }
            m_BasisFunction = basisFunction;

            if (order < 1)
            {
                throw new ArgumentOutOfRangeException("order");
            }
            m_Order = order;

            m_AbsoluteSingularValueThreshold = absoluteSingularValueThreshold;
            m_RelativeSingularValueThreshold = relativeSingularValueThreshold;

            m_Name = new IdentifierString("WeightedLeastSquareRegression");
        }