示例#1
0
        public FitElement()
        {
            _independentVariables = new NumericColumnProxy[0];

            _dependentVariables = new NumericColumnProxy[0];

            _errorEvaluation = new IVarianceScaling[0];

            _rangeOfRows = PositiveIntegerRange.NewFromFirstAndCount(0, int.MaxValue);
        }
示例#2
0
        public FitElement(INumericColumn xColumn, INumericColumn yColumn, int start, int count)
        {
            _independentVariables    = new NumericColumnProxy[1];
            _independentVariables[0] = new NumericColumnProxy(xColumn);

            _dependentVariables    = new NumericColumnProxy[1];
            _dependentVariables[0] = new NumericColumnProxy(yColumn);

            _errorEvaluation    = new IVarianceScaling[1];
            _errorEvaluation[0] = new ConstantVarianceScaling();

            _rangeOfRows = PositiveIntegerRange.NewFromFirstAndCount(start, count);
        }
示例#3
0
            public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                FitElement s = o != null ? (FitElement)o : new FitElement();

                s.FitFunction = (IFitFunction)info.GetValue("FitFunction", s);

                int numRows  = info.GetInt32("NumberOfRows");
                int firstRow = info.GetInt32("FirstRow");

                s._rangeOfRows = PositiveIntegerRange.NewFromFirstAndCount(firstRow, numRows);

                int arraycount = info.OpenArray();

                s._independentVariables = new NumericColumnProxy[arraycount];
                for (int i = 0; i < arraycount; ++i)
                {
                    s._independentVariables[i] = (NumericColumnProxy)info.GetValue(s);
                }
                info.CloseArray(arraycount);

                arraycount            = info.OpenArray();
                s._dependentVariables = new NumericColumnProxy[arraycount];
                for (int i = 0; i < arraycount; ++i)
                {
                    s._dependentVariables[i] = (NumericColumnProxy)info.GetValue(s);
                }
                info.CloseArray(arraycount);


                arraycount         = info.OpenArray();
                s._errorEvaluation = new IVarianceScaling[arraycount];
                for (int i = 0; i < arraycount; ++i)
                {
                    s._errorEvaluation[i] = (IVarianceScaling)info.GetValue(s);
                }
                info.CloseArray(arraycount);

                info.GetArray("ParameterNames", out s._parameterNames);
                for (int i = 0; i < s._parameterNames.Length; ++i)
                {
                    if (s._parameterNames[i] == string.Empty)
                    {
                        s._parameterNames[i] = null; // serialization can not distinguish between an empty string and a null string
                    }
                }
                s._parameterNameStart = info.GetString("ParameterNameStart");
                return(s);
            }
示例#4
0
        public FitElement(FitElement from)
        {
            this._fitFunction = from._fitFunction;
            if (_fitFunction is ICloneable)
            {
                this._fitFunction = (IFitFunction)((ICloneable)from.FitFunction).Clone();
            }

            _rangeOfRows          = PositiveIntegerRange.NewFromFirstAndCount(from._rangeOfRows.First, from._rangeOfRows.Count);
            _independentVariables = new NumericColumnProxy[from._independentVariables.Length];
            for (int i = 0; i < _independentVariables.Length; ++i)
            {
                if (from._independentVariables[i] != null)
                {
                    _independentVariables[i] = (NumericColumnProxy)from._independentVariables[i].Clone();
                }
            }

            _dependentVariables = new NumericColumnProxy[from._dependentVariables.Length];
            for (int i = 0; i < _dependentVariables.Length; ++i)
            {
                if (from._dependentVariables[i] != null)
                {
                    _dependentVariables[i] = (NumericColumnProxy)from._dependentVariables[i].Clone();
                }
            }
            _errorEvaluation = new IVarianceScaling[from._errorEvaluation.Length];
            for (int i = 0; i < _errorEvaluation.Length; ++i)
            {
                if (from._errorEvaluation[i] != null)
                {
                    _errorEvaluation[i] = (IVarianceScaling)from._errorEvaluation[i].Clone();
                }
            }

            _parameterNames     = (string[])from._parameterNames.Clone();
            _parameterNameStart = from._parameterNameStart;
        }
示例#5
0
 /// <summary>
 /// Sets the range of rows that are used for the regression.
 /// </summary>
 /// <param name="firstIndex">First row to be used.</param>
 /// <param name="count">Number of rows to be used [from firstIndex to (firstIndex+count-1)].</param>
 public void SetRowRange(int firstIndex, int count)
 {
     this._rangeOfRows = PositiveIntegerRange.NewFromFirstAndCount(firstIndex, count);
     OnChanged();
 }