当前位置: 首页>>代码示例>>C#>>正文


C# IROVector类代码示例

本文整理汇总了C#中IROVector的典型用法代码示例。如果您正苦于以下问题:C# IROVector类的具体用法?C# IROVector怎么用?C# IROVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IROVector类属于命名空间,在下文中一共展示了IROVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VectorSpacingEvaluator

		/// <summary>
		/// Constructor. Takes an read only vector and evaluates the spaces between
		/// the vector elements.
		/// </summary>
		/// <param name="vec">The vector.</param>
		public VectorSpacingEvaluator(IROVector vec)
		{
			_numtotalsteps = vec.Length - 1;
			for (int i = 0; i < _numtotalsteps; i++)
			{
				double step = vec[i + 1] - vec[i];

				if (!double.IsNaN(step))
				{
					_numvalidsteps++;

					if (step > _stepmax)
						_stepmax = step;
					if (step < _stepmin)
						_stepmin = step;

					_sumsteps += step;
				}
			}

			// if all steps are valid, we calculate sumsteps from the boundaries
			// to enhance the accuracy.
			if (_numvalidsteps > 0 && _numtotalsteps == _numvalidsteps)
				_sumsteps = vec[_numtotalsteps] - vec[0];
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:30,代码来源:VectorSpacingEvaluator.cs

示例2: BivariateLinearSpline

		/// <summary>
		/// Constructor of a bivariate linear spline. The vectors and the data matrix are not cloned, so make sure that they don't change during usage of this instance.
		/// </summary>
		/// <param name="x">Vector of x values corresponding to the rows of the data matrix. Must be strongly increasing or decreasing.</param>
		/// <param name="y">Vector of y values corresponding to the columns of the data matrix. Must be strongly increasing or decreasing.</param>
		/// <param name="datamatrix"></param>
		public BivariateLinearSpline(IROVector x, IROVector y, IROMatrix datamatrix)
		{
			_x = x;
			_y = y;
			_vmatrix = datamatrix;

			// check the arguments
			if (_x.Length < 2)
				throw new ArgumentException("x.Length is less or equal 1 (you can use univariate interpolation instead)");
			if (_y.Length < 2)
				throw new ArgumentException("y.Length is less or equal 1 (you can use univariate interpolation instead)");
			if (_x.Length != _vmatrix.Rows)
				throw new ArgumentException("Length of vector x is not equal to datamatrix.Rows");
			if (_y.Length != _vmatrix.Columns)
				throw new ArgumentException("Length of vector y is not equal to datamatrix.Columns");

			if (!VectorMath.IsStrictlyIncreasingOrDecreasing(_x, out _isXDecreasing))
				throw new ArgumentException("Vector x is not strictly increasing or decreasing");

			if (!VectorMath.IsStrictlyIncreasingOrDecreasing(_y, out _isYDecreasing))
				throw new ArgumentException("Vector y is not strictly increasing or decreasing");

			_lastIX = 0;
			_lastIY = 0;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:31,代码来源:BivariateLinearSpline.cs

示例3: VectorSpacingEvaluator

    /// <summary>
    /// Constructor. Takes an read only vector and evaluates the spaces between
    /// the vector elements.
    /// </summary>
    /// <param name="vec">The vector.</param>
    public VectorSpacingEvaluator(IROVector vec)
    {
      int lower = vec.LowerBound;
      int upper = vec.UpperBound;

      _numtotalsteps = upper-lower;
      for(int i=lower;i<upper;i++)
      {
        double step = vec[i+1]-vec[i];
        
        if(!double.IsNaN(step))
        {
          _numvalidsteps++;

          if(step>_stepmax)
            _stepmax = step;
          if(step<_stepmin)
            _stepmin = step;

          _sumsteps += step;
        }
      }

      // if all steps are valid, we calculate sumsteps from the boundaries
      // to enhance the accuracy.
      if(_numvalidsteps>0 && _numtotalsteps == _numvalidsteps)
        _sumsteps = vec[upper] - vec[lower];
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:33,代码来源:VectorSpacingEvaluator.cs

示例4: SetContentFromMatrix

		public static void SetContentFromMatrix(DataTable destinationTable, IROMatrix matrix, string columnBaseName, IROVector rowHeaderColumn, string rowHeaderColumnName, IROVector colHeaderColumn, string colHeaderColumnName)
		{
			var c = new MatrixToDataTableConverter(matrix, destinationTable);
			c.ColumnBaseName = columnBaseName;
			c.AddMatrixColumnHeaderData(rowHeaderColumn, rowHeaderColumnName);
			c.AddMatrixColumnHeaderData(colHeaderColumn, colHeaderColumnName);
			c.Execute();
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:MatrixToDataTableConverter.cs

示例5: FindIndex

		private static int FindIndex(IROVector v, bool isDecreasing, int lastIdx, double x)
		{
			if (isDecreasing) // strictly decreasing
			{
				if (x > v[lastIdx])
				{
					if (lastIdx == 0)
						return -1;
					if (x <= v[lastIdx - 1])
						return lastIdx - 1;
					return BinarySearchForIndex(v, isDecreasing, x);
				}
				else if (x < v[lastIdx + 1])
				{
					if (lastIdx + 2 <= v.Length)
						return -1;
					if (x >= v[lastIdx + 2])
						return lastIdx + 1;
					return BinarySearchForIndex(v, isDecreasing, x);
				}
				else
				{
					return lastIdx;
				}
			}
			else // strictly increasing
			{
				if (x < v[lastIdx])
				{
					if (lastIdx == 0)
						return -1;
					if (x >= v[lastIdx - 1])
						return lastIdx - 1;
					return BinarySearchForIndex(v, isDecreasing, x);
				}
				else if (x > v[lastIdx + 1])
				{
					if (lastIdx + 2 >= v.Length)
						return -1;
					if (x <= v[lastIdx + 2])
						return lastIdx + 1;
					return BinarySearchForIndex(v, isDecreasing, x);
				}
				else
				{
					return lastIdx;
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:49,代码来源:BivariateLinearSpline.cs

示例6: Nrd0

		public static double Nrd0(IROVector x)
		{
			if (x.Length < 2) throw new ArgumentException("need at least 2 data points");

			double hi = Statistics.StandardDeviation(x);
			double lo = Math.Min(hi, Statistics.InterQuartileRange(x) / 1.34);  // qnorm(.75) - qnorm(.25) = 1.34898
			if (lo.IsNaN())
			{
				lo = hi;
				if (lo.IsNaN())
				{
					lo = Math.Abs(x[0]);
					if (lo.IsNaN())
						lo = 1;
				}
			}

			return 0.9 * lo * Math.Pow(x.Length, (-0.2));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:19,代码来源:Bandwidths.cs

示例7: BivariateAkimaSpline

		/// <summary>
		/// Constructs an Akima bivariate spline.
		/// </summary>
		/// <param name="x">ARRAY OF DIMENSION LX STORING THE X COORDINATES OF INPUT GRID POINTS (IN ASCENDING ORDER)</param>
		/// <param name="y">ARRAY OF DIMENSION LY STORING THE Y COORDINATES OF INPUT GRID POINTS (IN ASCENDING ORDER)</param>
		/// <param name="z">DOUBLY-DIMENSIONED ARRAY OF DIMENSION (LX,LY) STORING THE VALUES OF THE FUNCTION (Z VALUES) AT INPUT GRID POINTS</param>
		/// <param name="copyDataLocally">If true, the data where cloned before stored here in this instance. If false, the data
		/// are stored directly. Make sure then, that the data are not changed outside.</param>
		public BivariateAkimaSpline(IROVector x, IROVector y, IROMatrix z, bool copyDataLocally)
		{
			if (copyDataLocally)
			{
				_myX = VectorMath.ToVector(new double[x.Length]);
				VectorMath.Copy(x, (IVector)_myX);

				_myY = VectorMath.ToVector(new double[y.Length]);
				VectorMath.Copy(y, (IVector)_myY);

				_myZ = new MatrixMath.BEMatrix(_myZ.Rows, _myZ.Columns);
				MatrixMath.Copy(z, (IMatrix)_myZ);
			}
			else
			{
				_myX = x;
				_myY = y;
				_myZ = z;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:28,代码来源:BivariateAkimaSpline.cs

示例8: Append

      public void Append(IROVector a)
      {
        if(_length+a.Length>=_arr.Length)
          Redim((int)(32+1.3*(_length+a.Length)));


        for(int i=0;i<a.Length;i++)
          _arr[i+_length] = a[i+a.LowerBound];
        _length += a.Length;
      }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:VectorMath.cs

示例9: ToROVector

 /// <summary>
 /// Wraps a section of a original vector <c>x</c> into a new vector.
 /// </summary>
 /// <param name="x">Original vector.</param>
 /// <param name="start">Index of the start of the section to wrap.</param>
 /// <param name="len">Length (=number of elements) of the section to wrap.</param>
 /// <returns>A IROVector that contains the section from <c>start</c> to <c>start+len-1</c> of the original vector.</returns>
 public static IROVector ToROVector(IROVector x, int start, int len)
 {
   return new ROVectorSectionWrapper(x, start, len);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:VectorMath.cs

示例10: ProcessForPrediction

 /// <summary>
 /// Processes the spectra in matrix xMatrix.
 /// </summary>
 /// <param name="xMatrix">The matrix of spectra. Each spectrum is a row of the matrix.</param>
 /// <param name="xMean">Output: On return, contains the ensemble mean of the spectra.</param>
 /// <param name="xScale">Not used.</param>
 /// <param name="regions">Vector of spectal regions. Each element is the index of the start of a new region.</param>
 public virtual void ProcessForPrediction(IMatrix xMatrix, IROVector xMean, IROVector xScale, int[] regions)
 {
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:SpectralPreprocessing.cs

示例11: ROVectorSectionWrapper

 /// <summary>
 /// Constructor, takes a double array for wrapping.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="start">Start index of the section to wrap.</param>
 /// <param name="len">Length of the section to wrap.</param>
 public ROVectorSectionWrapper(IROVector x, int start, int len)
 {
   if(start>=x.Length)
     throw new ArgumentException("Start of the section is beyond length of the vector");
  if (start+len>=x.Length)
     throw new ArgumentException("End of the section is beyond length of the vector");
  
   _x = x;
   _start = start;
   _length = len;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:17,代码来源:VectorMath.cs

示例12: SumOfSquaredDifferences

    /// <summary>
    /// Returns the sum of squared differences of the elements of xarray and yarray.
    /// </summary>
    /// <param name="xarray">The first array.</param>
    /// <param name="yarray">The other array.</param>
    /// <returns>The sum of squared differences all elements of xarray and yarray.</returns>
    public static double SumOfSquaredDifferences(IROVector xarray, IROVector yarray)
    {
      if(xarray.Length!=yarray.Length)
        throw new ArgumentException("Length of xarray is unequal length of yarray");

      double sum = 0;
      for(int i=0;i<xarray.Length;i++)
        sum += Square(xarray[i]-yarray[i]);

      return sum;
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:17,代码来源:VectorMath.cs

示例13: StoreXOfX

		public virtual void StoreXOfX(IROVector xOfX, DataTable table)
		{
			DoubleColumn xColOfX = new DoubleColumn();
			VectorMath.Copy(xOfX, DataColumnWrapper.ToVector(xColOfX, xOfX.Length));
			table.DataColumns.Add(xColOfX, _XOfX_ColumnName, Altaxo.Data.ColumnKind.X, 0);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:6,代码来源:WorksheetAnalysis.cs

示例14: SetErrorVariance

		public void SetErrorVariance(IROVector dyy, double errvar)
		{
			dy.CopyFrom(dyy);
			var = errvar;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:5,代码来源:CrossValidatedCubicSpline.cs

示例15: Add

    /// <summary>
    /// Adds (elementwise) two vectors a and b and stores the result in c. All vectors must have the same length.
    /// </summary>
    /// <param name="a">First summand.</param>
    /// <param name="b">Second summand.</param>
    /// <param name="c">The resulting vector.</param>
    public static void Add(IROVector a, IROVector b, IVector c)
    {
      if(a.Length != b.Length)
        throw new ArgumentException("Length of vectors a and b unequal");
      if(c.Length != b.Length)
        throw new ArgumentException("Length of vectors a and c unequal");
      if(a.LowerBound != b.LowerBound || a.LowerBound != c.LowerBound)
        throw new ArgumentException("Vectors a, b, and c have not the same LowerBound property");

      int end = c.UpperBound;
      for(int i=c.LowerBound;i<=end;i++)
        c[i]=a[i]+b[i];
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:VectorMath.cs


注:本文中的IROVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。