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


C# MatrixF.SetRow方法代码示例

本文整理汇总了C#中MatrixF.SetRow方法的典型用法代码示例。如果您正苦于以下问题:C# MatrixF.SetRow方法的具体用法?C# MatrixF.SetRow怎么用?C# MatrixF.SetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MatrixF的用法示例。


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

示例1: SetRowException2

 public void SetRowException2()
 {
     MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
       m.SetRow(3, new VectorF(4));
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:5,代码来源:MatrixFTest.cs

示例2: OnSetup

        //--------------------------------------------------------------
        /// <summary>
        /// Called when <see cref="ScatteredInterpolationF.Setup"/> is called.
        /// </summary>
        /// <remarks>
        /// Here internal values can be computed from the registered reference pairs if required. It is
        /// assured that the reference data pairs have valid dimensions: All x values have the same
        /// number of elements and all y values have the same number of elements. All reference data
        /// values are not <see langword="null"/>.
        /// </remarks>
        /// <exception cref="MathematicsException">
        /// Cannot compute regression - try to choose different reference data pairs or another basis 
        /// function.
        /// </exception>
        protected override void OnSetup()
        {
            // Compute weights:
              // Make matrix Φ (also known as G).
              int numberOfPairs = Count;
              MatrixF G = new MatrixF(numberOfPairs, numberOfPairs);
              for (int r = 0; r < numberOfPairs; r++)  // rows
              {
            for (int c = 0; c < numberOfPairs; c++)  // columns
            {
              float radialArgument = DistanceFunction(GetX(r), GetX(c), c);
              G[r, c] = BasisFunction(radialArgument, c);
            }
              }

              // We look for the matrix W that contains the weights.
              // Each row resembles an n-dimensional weight.
              MatrixF W;

              // Make the matrix Y with the reference values, such that ideally Y = G * W.
              MatrixF Y = new MatrixF(numberOfPairs, GetY(0).NumberOfElements);
              for (int r = 0; r < numberOfPairs; r++)
            Y.SetRow(r, GetY(r));

              // Compute W as the least squares solution.
              try
              {
            W = MatrixF.SolveLinearEquations(G, Y);
              }
              catch (MathematicsException exception)
              {
            throw new MathematicsException("Cannot compute regression - try to choose different reference data pairs or another basis function.", exception);
              }

              // The rows of W are the weights.
              _weights = new VectorF[numberOfPairs];
              for (int r = 0; r < numberOfPairs; r++)
            _weights[r] = W.GetRow(r);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:53,代码来源:RadialBasisRegressionF.cs

示例3: SetRow

        public void SetRow()
        {
            MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
              m.SetRow(0, new VectorF(new float[]{ 0.1f, 0.2f, 0.3f, 0.4f }));
              Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
              Assert.AreEqual(new VectorF(new float[] { 5.0f, 6.0f, 7.0f, 8.0f }), m.GetRow(1));
              Assert.AreEqual(new VectorF(new float[] { 9.0f, 10.0f, 11.0f, 12.0f }), m.GetRow(2));

              m.SetRow(1, new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }));
              Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
              Assert.AreEqual(new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }), m.GetRow(1));
              Assert.AreEqual(new VectorF(new float[] { 9.0f, 10.0f, 11.0f, 12.0f }), m.GetRow(2));

              m.SetRow(2, new VectorF(new float[] { 0.7f, 0.8f, 0.9f, 1.0f }));
              Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
              Assert.AreEqual(new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }), m.GetRow(1));
              Assert.AreEqual(new VectorF(new float[] { 0.7f, 0.8f, 0.9f, 1.0f }), m.GetRow(2));
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:18,代码来源:MatrixFTest.cs


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