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


C# ComplexFloatMatrix.SetRow方法代码示例

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


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

示例1: GetMatrix

    /// <summary>
    /// Get a copy of the Toeplitz matrix.
    /// </summary>
    public ComplexFloatMatrix GetMatrix()
    {
      int i, j;

      // allocate memory for the matrix
      ComplexFloatMatrix tm = new ComplexFloatMatrix(m_Order);

#if MANAGED
      // fill top row
      ComplexFloat[] top = tm.data[0];
      Array.Copy(m_LeftColumn.data, 0, top, 0, m_Order);

      if (m_Order > 1)
      {
        // fill bottom row (reverse order)
        ComplexFloat[] bottom = tm.data[m_Order - 1];

        for (i = 0, j = m_Order - 1; i < m_Order; i++, j--)
        {
          bottom[i] = m_LeftColumn[j];
        }

        // fill rows in-between
        for (i = 1, j = m_Order - 1 ; j > 1; i++)
        {
          Array.Copy(top, 0, tm.data[i], i, j--);
          Array.Copy(bottom, j, tm.data[i], 0, i);
        }
      }
#else
      if (m_Order > 1)
      {
        ComplexFloat[] top = new ComplexFloat[m_Order];
        Array.Copy(m_LeftColumn.data, 0, top, 0, m_Order);
        tm.SetRow(0, top);

        // fill bottom row (reverse order)
        ComplexFloat[] bottom = new ComplexFloat[m_Order];

        for (i = 0, j = m_Order - 1; i < m_Order; i++, j--)
        {
          bottom[i] = m_LeftColumn[j];
        }

        // fill rows in-between
        for (i = 1, j = m_Order - 1 ; j > 0; i++)
        {
          ComplexFloat[] temp = new ComplexFloat[m_Order];
          Array.Copy(top, 0, temp, i, j--);
          Array.Copy(bottom, j, temp, 0, i);
          tm.SetRow(i, temp);
        }
      }
      else
      {
        Array.Copy(m_LeftColumn.data, 0, tm.data, 0, m_Order);
      }
#endif

      return tm;
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:64,代码来源:ComplexFloatSymmetricLevinson.cs

示例2: SetRowArrayOutOfRange

 public void SetRowArrayOutOfRange()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
   ComplexFloat[] b = new ComplexFloat[2];
   a.SetRow(2,b);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatMatrixTest.cs

示例3: SetRowArrayWrongRank

 public void SetRowArrayWrongRank()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
   ComplexFloat[] b = new ComplexFloat[3];
   a.SetRow(1,b);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatMatrixTest.cs

示例4: SetRowArray

    public void SetRowArray()
    {
      ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
      ComplexFloat[] b = new ComplexFloat[2];
      b[0] = new ComplexFloat(1,1);
      b[1] = new ComplexFloat(2,2);

      a.SetRow(0,b);
      Assert.AreEqual(b[0], a[0,0]);
      Assert.AreEqual(b[1], a[0,1]);
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:ComplexFloatMatrixTest.cs

示例5: SetRowWrongRank

 public void SetRowWrongRank()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
   ComplexFloatVector b = new ComplexFloatVector(3);
   a.SetRow(1,b);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatMatrixTest.cs

示例6: SetRowOutOfRange

 public void SetRowOutOfRange()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
   ComplexFloatVector b = new ComplexFloatVector(2);
   a.SetRow(2,b);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatMatrixTest.cs

示例7: SetRow

 public void SetRow()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
   ComplexFloatVector b = new ComplexFloatVector(2);
   b[0] = new ComplexFloat(1,1);
   b[1] = new ComplexFloat(2,2);
   a.SetRow(0,b);
   Assert.AreEqual(b[0], a[0,0]);
   Assert.AreEqual(b[1], a[0,1]);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:ComplexFloatMatrixTest.cs

示例8: Solve

		/// <summary>
		/// Solve a square Toeplitz system with a right-side matrix.
		/// </summary>
		/// <param name="col">The left-most column of the Toeplitz matrix.</param>
		/// <param name="row">The top-most row of the Toeplitz matrix.</param>
		/// <param name="Y">The right-side matrix of the system.</param>
		/// <returns>The solution matrix.</returns>
		/// <exception cref="ArgumentNullException">
		/// <EM>col</EM> is a null reference,
		/// <para>or</para>
		/// <para><EM>row</EM> is a null reference,</para>
		/// <para>or</para>
		/// <para><EM>Y</EM> is a null reference.</para>
		/// </exception>
		/// <exception cref="RankException">
		/// The length of <EM>col</EM> is 0,
		/// <para>or</para>
		/// <para>the lengths of <EM>col</EM> and <EM>row</EM> are not equal,</para>
		/// <para>or</para>
		/// <para>the number of rows in <EM>Y</EM> does not the length of <EM>col</EM> and <EM>row</EM>.</para>
		/// </exception>
		/// <exception cref="SingularMatrixException">
		/// The Toeplitz matrix or one of the the leading sub-matrices is singular.
		/// </exception>
		/// <exception cref="ArithmeticException">
		/// The values of the first element of <EM>col</EM> and <EM>row</EM> are not equal.
		/// </exception>
		/// <remarks>
		/// This method solves the linear system <B>AX</B> = <B>Y</B>. Where
		/// <B>T</B> is a square Toeplitz matrix, <B>X</B> is an unknown
		/// matrix and <B>Y</B> is a known matrix.
		/// <para>
		/// The classic Levinson algorithm is used to solve the system. The algorithm
		/// assumes that all the leading sub-matrices of the Toeplitz matrix are
		/// non-singular. When a sub-matrix is near singular, accuracy will
		/// be degraded. This member requires approximately <B>N</B> squared
		/// FLOPS to calculate a solution, where <B>N</B> is the matrix order.
		/// </para>
		/// <para>
		/// This static method has minimal storage requirements as it combines
		/// the <b>UDL</b> decomposition with the calculation of the solution vector
		/// in a single algorithm.
		/// </para>
		/// </remarks>
		public static ComplexFloatMatrix Solve(IROComplexFloatVector col, IROComplexFloatVector row, IROComplexFloatMatrix Y)
		{
			// check parameters
			if (col == null)
			{
				throw new System.ArgumentNullException("col");
			}
			else if (col.Length == 0)
			{
				throw new RankException("The length of col is zero.");
			}
			else if (row == null)
			{
				throw new System.ArgumentNullException("row");
			}
			else if (col.Length != row.Length)
			{
				throw new RankException("The lengths of col and row are not equal.");
			}
			else if (col[0] != row[0])
			{
				throw new ArithmeticException("The values of the first element of col and row are not equal.");
			}
			else if (Y == null)
			{
				throw new System.ArgumentNullException("Y");
			}
			else if (col.Length != Y.Columns)
			{
				throw new RankException("The numer of rows in Y does not match the length of col and row.");
			}

			// check if leading diagonal is zero
			if (col[0] == ComplexFloat.Zero)
			{
				throw new SingularMatrixException("One of the leading sub-matrices is singular.");
			}

			// decompose matrix
			int order = col.Length;
			ComplexFloat[] A = new ComplexFloat[order];
			ComplexFloat[] B = new ComplexFloat[order];
			ComplexFloat[] Z = new ComplexFloat[order];
			ComplexFloatMatrix X = new ComplexFloatMatrix(order);
			ComplexFloat Q, S, Ke, Kr, e;
			ComplexFloat Inner;
			int i, j, l;

			// setup the zero order solution
			A[0] = ComplexFloat.One;
			B[0] = ComplexFloat.One;
			e = ComplexFloat.One / col[0];
			X.SetRow(0, e * ComplexFloatVector.GetRow(Y, 0));

			for (i = 1; i < order; i++)
			{
//.........这里部分代码省略.........
开发者ID:Altaxo,项目名称:Altaxo,代码行数:101,代码来源:ComplexFloatLevinson.cs


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