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


C# ComplexFloatMatrix.GetColumn方法代码示例

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


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

示例1: GetColumn

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

示例2: GetColumnOutOfRange

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

示例3: Solve


//.........这里部分代码省略.........
				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++)
			{
				// calculate inner products
				Q = ComplexFloat.Zero;
				for (j = 0, l = 1; j < i; j++, l++)
				{
					Q += col[l] * A[j];
				}

				S = ComplexFloat.Zero;
				for (j = 0, l = 1; j < i; j++, l++)
				{
					S += row[l] * B[j];
				}

				// reflection coefficients
				Kr = -S * e;
				Ke = -Q * e;

				// update lower triangle (in temporary storage)
				Z[0] = ComplexFloat.Zero;
				Array.Copy(A, 0, Z, 1, i);
				for (j = 0, l = i - 1; j < i; j++, l--)
				{
					Z[j] += Ke * B[l];
				}

				// update upper triangle
				for (j = i; j > 0; j--)
				{
					B[j] = B[j - 1];
				}

				B[0] = ComplexFloat.Zero;
				for (j = 0, l = i - 1; j < i; j++, l--)
				{
					B[j] += Kr * A[l];
				}

				// copy from temporary storage to lower triangle
				Array.Copy(Z, 0, A, 0, i + 1);

				// check for singular sub-matrix)
				if (Ke * Kr == ComplexFloat.One)
				{
					throw new SingularMatrixException("One of the leading sub-matrices is singular.");
				}

				// update diagonal
				e = e / (ComplexFloat.One - Ke * Kr);

				for (l = 0; l < Y.Rows; l++)
				{
					ComplexFloatVector W = X.GetColumn(l);
					ComplexFloatVector M = ComplexFloatVector.GetColumn(Y, l);

					Inner = M[i];
					for (j = 0; j < i; j++)
					{
						Inner += A[j] * M[j];
					}
					Inner *= e;

					W[i] = Inner;
					for (j = 0; j < i; j++)
					{
						W[j] += Inner * B[j];
					}

					X.SetColumn(l, W);
				}
			}

			return X;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:101,代码来源:ComplexFloatLevinson.cs


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