예제 #1
0
 public SubSuperBase(EquationRow parent, Position position)
     : base(parent)
 {
     ApplySymbolGap = false;
     SubLevel++;
     Position = position;
 }
예제 #2
0
 public RowContainerAction(ISupportsUndo executor, int index, int childIndexInRow, int caretIndex, EquationRow equation)
     : base(executor)
 {
     Index           = index;
     ChildIndexInRow = childIndexInRow;
     CaretIndex      = caretIndex;
     Equation        = equation;
 }
예제 #3
0
 public Sub(EquationRow parent, Position position)
     : base(parent, position)
 {
     ActiveChild = rowContainer = new RowContainer(this);
     childEquations.Add(rowContainer);
     if (SubLevel == 1)
     {
         rowContainer.FontFactor = SubFontFactor;
     }
     else if (SubLevel == 2)
     {
         rowContainer.FontFactor = SubSubFontFactor;
     }
 }
예제 #4
0
 public SubAndSuper(EquationRow parent, Position position)
     : base(parent, position)
 {
     ActiveChild = superEquation = new RowContainer(this);
     subEquation = new RowContainer(this);
     childEquations.Add(superEquation);
     childEquations.Add(subEquation);
     if (SubLevel == 1)
     {
         superEquation.FontFactor = SubFontFactor;
         subEquation.FontFactor   = SubFontFactor;
     }
     else if (SubLevel >= 2)
     {
         superEquation.FontFactor = SubSubFontFactor;
         subEquation.FontFactor   = SubSubFontFactor;
     }
 }
        private void getMainMatrix(ISpectrum spectrum, bool includedInts, out EquationRow[] equationRows, out double[] equationsResult, out int size)
        {
            int agiSize = setAgi(spectrum, includedInts);

            int leftRange = (int)spectrum.Parameters[4].Components[0][1].Value;
            int rightRange = (int)spectrum.Parameters[4].Components[0][2].Value;
            int row, col, k;

            //EquationRow[] result = new EquationRow[agiSize];
            if (_equationRows == null || _equationRows.Length < agiSize)
            {
                _equationRows = new EquationRow[agiSize];
            }
            if (_equationsResult == null || _equationsResult.Length < agiSize)
            {
                _equationsResult = new double[agiSize];
            }
            //if (this._weights == null)
            //    this._weights = new double[spectrum.ExperimentalSpectrum.Length];
            //else {
            //    if (this._weights.Length<spectrum.ExperimentalSpectrum.Length)
            //        this._weights = new double[spectrum.ExperimentalSpectrum.Length];
            //}

            //for (int i = 0; i < spectrum.ExperimentalSpectrum.Length; i++)
            //    _weights[i] = 1 / Math.Sqrt(spectrum.ExperimentalSpectrum[i]);
            double backgroundSub = 0;
            double e;

            if (isFixed(spectrum.Parameters[4].Components[0][3]) || isIntInSearch(spectrum.Parameters[4].Components[0][3]))
            {
                backgroundSub = spectrum.Parameters[4].Components[0][3].Value;
            }
            ////performance --- begin ---
            //long start = 0;
            //long stop = 0;
            //long freq = 0;
            //Performancer.QueryPerformanceFrequency(ref freq);
            //Performancer.QueryPerformanceCounter(ref start);
            ////performance --- begin ---
            for (row = 0; row < agiSize; row++)
            {
                if (_equationRows[row] == null)
                {
                    _equationRows[row] = new EquationRow(new double[agiSize], 0);
                }

                for (col = 0; col < agiSize; col++)
                {
                    _equationRows[row].coeff[col] = 0;
                    for (k = leftRange; k <= rightRange; k++) //{
                    //_equationRows[row].coeff[col] += agi[row][k] * agi[col][k] / spectrum.ExperimentalSpectrum[k]; // *spectrum.Weights[k]; // _weights[k];
                    {
                        _equationRows[row].coeff[col] += agi[row][k] * agi[col][k] / _data[k + spectrum.BufferStartPos - 1];
                    }
                    //}
                }


                //right side
                _equationRows[row].b = 0;

                for (k = leftRange; k <= rightRange; k++)
                {
                    e = _data[k + spectrum.BufferStartPos - 1] - backgroundSub;
                    _equationRows[row].b += e * agi[row][k] / _data[k + spectrum.BufferStartPos - 1]; // spectrum.Weights[k]; // _weights[k];
                }
            }
            ////performance --- end ---
            //Performancer.QueryPerformanceCounter(ref stop);
            //this._TEST_sum += (stop - start) * 1.0 / freq;
            //this._TEST_counts++;
            ////Console.WriteLine("{0}. Shapes calculation time: {1:F6} s", _TEST_counts++, (stop - start) * 1.0 / freq);
            ////performance --- end ---
            //return _equationRows;
            equationRows    = _equationRows;
            equationsResult = _equationsResult;
            size            = agiSize;
        }