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


C# VectorType类代码示例

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


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

示例1: ArrayExpression

 internal ArrayExpression(
   VectorType vectorType,
   EnumerableArrayWrapper<ExpressionBase, IMetadataExpression> elements
 ) {
   this.VectorType = vectorType;
   this.Elements = elements;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:7,代码来源:Attributes.cs

示例2: Indices

 public static IEnumerable<int> Indices(this Matrix source, Func<Vector, bool> f, VectorType t)
 {
     int max = t == VectorType.Row ? source.Rows : source.Cols;
     for (int i = 0; i < max; i++)
         if (f(source[i, t]))
             yield return i;
 }
开发者ID:al-main,项目名称:CloudyBank,代码行数:7,代码来源:MatrixExtensions.cs

示例3: CovarianceDiag

 public static Vector CovarianceDiag(Matrix source, VectorType t = VectorType.Col)
 {
     int length = t == VectorType.Row ? source.Rows : source.Cols;
     Vector vector = new Vector(length);
     for (int i = 0; i < length; i++)
         vector[i] = source[i, t].Variance();
     return vector;
 }
开发者ID:nagarwl1,项目名称:numl,代码行数:8,代码来源:MatrixStatics.cs

示例4: Correlation

 public static Matrix Correlation(Matrix source, VectorType t = VectorType.Col)
 {
     int length = t == VectorType.Row ? source.Rows : source.Cols;
     Matrix m = new Matrix(length);
     for (int i = 0; i < length; i++)
         for (int j = i; j < length; j++) // symmetric matrix
             m[i, j] = m[j, i] = source[i, t].Correlation(source[j, t]);
     return m;
 }
开发者ID:nagarwl1,项目名称:numl,代码行数:9,代码来源:MatrixStatics.cs

示例5: MatrixHelper

 public MatrixHelper(string vector, VectorType type, int columns, int rows, bool isLinearMatrix)
 {
     this.type = type;
     vectorString = vector;
     this.columns = columns;
     this.rows = rows;
     matrix = !isLinearMatrix ? SplitVector() : SplitLinerMatrix();
     this.isLinearMatrix = isLinearMatrix;
 }
开发者ID:JFFby,项目名称:KSKR,代码行数:9,代码来源:MatrixHelper.cs

示例6: Mean

 public static Vector Mean(this Matrix source, VectorType t)
 {
     int count = t == VectorType.Row ? source.Cols : source.Rows;
     VectorType type = t == VectorType.Row ? VectorType.Column : VectorType.Row;
     Vector v = new Vector(count);
     for (int i = 0; i < count; i++)
         v[i] = source[i, type].Mean();
     return v;
 }
开发者ID:al-main,项目名称:CloudyBank,代码行数:9,代码来源:MatrixExtensions.cs

示例7: Summarize

 /// <summary>
 /// Summarizes a given Matrix.
 /// </summary>
 /// <param name="matrix">Matrix to summarize.</param>
 /// <param name="byVector">Indicates which direction to summarize, default is <see cref="VectorType.Row"/> indicating top-down.</param>
 /// <returns></returns>
 public static Summary Summarize(Matrix matrix, VectorType byVector = VectorType.Row)
 {
     return new Summary()
     {
         Average = matrix.Mean(byVector),
         StandardDeviation = matrix.StdDev(byVector),
         Minimum = matrix.Min(byVector),
         Maximum = matrix.Max(byVector),
         Median = matrix.Median(byVector)
     };
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:17,代码来源:Summary.cs

示例8: Covariance

 public static Matrix Covariance(Matrix source, VectorType t = VectorType.Col)
 {
     int length = t == VectorType.Row ? source.Rows : source.Cols;
     Matrix m = new Matrix(length);
     //for (int i = 0; i < length; i++)
     Parallel.For(0, length, i =>
         //for (int j = i; j < length; j++) // symmetric matrix
         Parallel.For(i, length, j =>
             m[i, j] = m[j, i] = source[i, t].Covariance(source[j, t])));
     return m;
 }
开发者ID:nagarwl1,项目名称:numl,代码行数:11,代码来源:MatrixStatics.cs

示例9: Vector

 //Spezielle Vektoren erzeugen.
 public Vector(int _n, VectorType type)
     : base(_n, 1)
 {
     switch (type)
     {
         case VectorType.ONES:
             for (int i = 0; i < base.NoRows; i++)
             {
                 this[i] = 1.0;
             }
             break;
     }
 }
开发者ID:it-demircan,项目名称:NSharp,代码行数:14,代码来源:Vector.cs

示例10: Vector

        /// <summary>
        /// Initializes a new instance of the Vector class that contains elements
        /// copied from the specified array.
        /// </summary>
        /// <param name="type">The vector type</param>
        /// <param name="data">The array whose elements are copied to the vector.</param>
        public Vector(VectorType type, double[] data)
        {
            if (data.Length < 1) throw new System.ArgumentException("data.Length < 1");
            this._Type = type;
            this._Data = new double[data.Length];

            data.CopyTo(this._Data, 0);

            //for (int i = 0; i < data.Length; i++)
            //{
            //    this.MeData[i] = data[i];
            //}
        }
开发者ID:davidsiaw,项目名称:neuron,代码行数:19,代码来源:Vector.cs

示例11: Covariance

 /// <summary>Covariances.</summary>
 /// <param name="source">Source for the.</param>
 /// <param name="t">(Optional) Row or Column sum.</param>
 /// <returns>A Matrix.</returns>
 public static Matrix Covariance(Matrix source, VectorType t = VectorType.Col)
 {
     int length = t == VectorType.Row ? source.Rows : source.Cols;
     Matrix m = new Matrix(length);
     //for (int i = 0; i < length; i++)
     for (int i = 0; i < length; i++)
     {
         //for (int j = i; j < length; j++) // symmetric matrix
         for (int j = i; j < length; j++)
             m[i, j] = m[j, i] = source[i, t].Covariance(source[j, t]);
     }
     return m;
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:17,代码来源:MatrixStatics.cs

示例12: Estimate

        /// <summary>Estimates.</summary>
        /// <param name="X">The Matrix to process.</param>
        /// <param name="type">(Optional) the type.</param>
        public void Estimate(Matrix X, VectorType type = VectorType.Row)
        {
            var n = type == VectorType.Row ? X.Rows : X.Cols;
            var s = type == VectorType.Row ? X.Cols : X.Rows;
            this.Mu = X.Sum(type) / n;
            this.Sigma = Matrix.Zeros(s);

            for (var i = 0; i < n; i++)
            {
                var x = X[i, type] - this.Mu;
                this.Sigma += x.Outer(x);
            }

            this.Sigma *= 1d / (n - 1d);
        }
开发者ID:ChewyMoon,项目名称:Cupcake,代码行数:18,代码来源:NormalDistribution.cs

示例13: Estimate

        /// <summary>Estimates.</summary>
        /// <param name="X">The Matrix to process.</param>
        /// <param name="type">(Optional) the type.</param>
        public void Estimate(Matrix X, VectorType type = VectorType.Row)
        {
            int n = type == VectorType.Row ? X.Rows : X.Cols;
            int s = type == VectorType.Row ? X.Cols : X.Rows;
            Mu = X.Sum(type) / n;
            Sigma = Matrix.Zeros(s);
            
            for (int i = 0; i < n; i++)
            {
                var x = X[i, type] - Mu;
                Sigma += x.Outer(x);
            }

            Sigma *= (1d / (n - 1d));
        }
开发者ID:m-abubakar,项目名称:numl,代码行数:18,代码来源:NormalDistribution.cs

示例14: Sum

        /// <summary>
        /// Computes the sum of either the rows or columns of a matrix and returns a vector.
        /// </summary>
        /// <param name="m">Input Matrix.</param>
        /// <param name="t">Row or Column sum.</param>
        /// <returns>Vector Sum.</returns>
		public static Vector Sum(Matrix m, VectorType t)
		{
			if (t == VectorType.Row)
			{
				Vector result = new Vector(m.Cols);
				for (int i = 0; i < m.Cols; i++)
					for (int j = 0; j < m.Rows; j++)
						result[i] += m[j, i];
				return result;
			}
			else
			{
				Vector result = new Vector(m.Rows);
				for (int i = 0; i < m.Rows; i++)
					for (int j = 0; j < m.Cols; j++)
						result[i] += m[i, j];
				return result;
			}
		}
开发者ID:m-abubakar,项目名称:numl,代码行数:25,代码来源:MatrixStatics.cs

示例15: VectorData

        public VectorData(string name, uint offset, uint address, VectorType type, float x, float y, float z, float a, string labels, bool degrees, uint pluginLine)
            : base(name, offset, address, pluginLine)
        {
            // Vector Components
            _x = x;
            _y = y;
            _z = z;
            _a = a;

            // Visibility for last 2 Components
            _zVis = _aVis = false;

            _labels = labels;
            _degrees = degrees;

            // Optional custom label letters for components
            if (_labels.Length < (int)type)
            {
                _xLabel = "x";
                _yLabel = "y";
                _zLabel = "z";
                _aLabel = "a";
            }
            else
            {
                switch (type)
                {
                    case VectorType.Vector4:
                        _aLabel = _labels[3].ToString();
                        goto case VectorType.Vector3;
                    case VectorType.Vector3:
                        _zLabel = _labels[2].ToString();
                        goto case VectorType.Vector2;
                    case VectorType.Vector2:
                        _yLabel = _labels[1].ToString();
                        goto default;
                    default:
                        _xLabel = _labels[0].ToString();
                        break;
                }
            }

            // Make last 2 Components visible if we need either
            switch (type)
            {
                case VectorType.Vector4:
                    _aVis = true;
                    goto case VectorType.Vector3;
                case VectorType.Vector3:
                    _zVis = true;
                    break;
            }

            // Create our Vector type name
            _typeLabel = "vector";
            switch (type)
            {
                case VectorType.Vector4:
                    _typeLabel += "4";
                    break;
                case VectorType.Vector3:
                    _typeLabel += "3";
                    break;
                case VectorType.Vector2:
                    _typeLabel += "2";
                    break;
            }

            if (_degrees)
                _typeLabel += "D";
            else
                _typeLabel += "F";
        }
开发者ID:Nibre,项目名称:Assembly,代码行数:73,代码来源:VectorData.cs


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