• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# VectorType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: IndexOutOfRangeException

        /// <summary>
        /// returns col/row vector at index j
        /// </summary>
        /// <param name="i">Col/Row</param>
        /// <param name="t">Row or Column</param>
        /// <returns>Vector</returns>
        public virtual Vector this[int i, VectorType t]
        {
            get
            {
                // switch it up if using a transposed version
                if (_asTransposeRef)
                    t = t == VectorType.Row ? VectorType.Col : VectorType.Row;

                if (t == VectorType.Row)
                {
                    if (i >= Rows)
                        throw new IndexOutOfRangeException();

                    return new Vector(_matrix, i, true);
                }
                else
                {
                    if (i >= Cols)
                        throw new IndexOutOfRangeException();

                    return new Vector(_matrix, i);
                }
            }
            set
            {
                if (_asTransposeRef)
                    throw new InvalidOperationException("Cannot modify matrix in read-only transpose mode!");

                if (t == VectorType.Row)
                {
                    if (i >= Rows)
                        throw new IndexOutOfRangeException();

                    if (value.Length > Cols)
                        throw new InvalidOperationException(string.Format("Vector has lenght larger then {0}", Cols));

                    for (int k = 0; k < Cols; k++)
                        _matrix[i][k] = value[k];
                }
                else
                {
                    if (i >= Cols)
                        throw new IndexOutOfRangeException();

                    if (value.Length > Rows)
                        throw new InvalidOperationException(string.Format("Vector has lenght larger then {0}", Cols));

                    for (int k = 0; k < Rows; k++)
                        _matrix[k][i] = value[k];
                }
            }
        }
开发者ID:vladtepes1473,项目名称:numl,代码行数:58,代码来源:Matrix.cs


示例17: __CopyValue

 private static void* __CopyValue(VectorType.__Internal native)
 {
     var ret = Marshal.AllocHGlobal(20);
     global::CppSharp.Parser.AST.VectorType.__Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return ret.ToPointer();
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:6,代码来源:CppSharp.CppParser.cs


示例18: VectorType

 private VectorType(VectorType.__Internal native, bool skipVTables = false)
     : this(__CopyValue(native), skipVTables)
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:6,代码来源:CppSharp.CppParser.cs


示例19: __CreateInstance

 public static VectorType __CreateInstance(VectorType.__Internal native, bool skipVTables = false)
 {
     return new VectorType(native, skipVTables);
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:4,代码来源:CppSharp.CppParser.cs


示例20: Matrix_Insert_Test

        public void Matrix_Insert_Test(int index, bool insertAfter, VectorType vectorType, bool isTransposed)
        {
            Vector v = (vectorType == VectorType.Row) ^ isTransposed ?
                            new double[] { 1, 3, 2, 0 } :
                            new double[] { 2, 1, 0 };

            Matrix A = new[,]
            {
                { 4, 1, 3, 2 },
                { 1, 2, 3, 4 },
                { 7, 9, 8, 6 }
            };

            if (isTransposed)
                A = A.T;

            var rows = A.Rows;
            var columns = A.Cols;

            var B = A.Insert(v, index, vectorType, insertAfter);

            Assert.Equal(A.Rows, rows);
            Assert.Equal(A.Cols, columns);

            if (vectorType == VectorType.Row)
            {
                Assert.Equal(B.Rows, rows + 1);
                Assert.Equal(B.Cols, columns);
            }
            else
            {
                Assert.Equal(B.Rows, rows);
                Assert.Equal(B.Cols, columns + 1);
            }

            var dimension = vectorType == VectorType.Row ? rows : columns;

            for (var i = 0; i < dimension + 1; i++)
            {
                if (index == dimension - 1 && insertAfter)
                    Assert.Equal(v, B[dimension, vectorType]);
                else if (i == index)
                    Assert.Equal(v, B[i, vectorType]);
                else if(i < index)
                    Assert.Equal(A[i, vectorType], B[i, vectorType]);
                else
                    Assert.Equal(A[i - 1, vectorType], B[i, vectorType]);
            }
        }
开发者ID:sethjuarez,项目名称:numl,代码行数:49,代码来源:MatrixTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Vegetable类代码示例发布时间:2022-05-24
下一篇:
C# VectorStorage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap