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

C# LinearAlgebra.ComplexFloatVector类代码示例

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

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



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

示例1: InternalCompute

    /// <summary>Performs the QR factorization.</summary>
    protected override void InternalCompute() 
    {
      int m = matrix.Rows;
      int n = matrix.Columns;
      
#if MANAGED
      int minmn = m < n ? m : n;
      r_ = new ComplexFloatMatrix(matrix); // create a copy
      ComplexFloatVector[] u = new ComplexFloatVector[minmn];
      for (int i = 0; i < minmn; i++) 
      {
        u[i] = Householder.GenerateColumn(r_, i, m - 1, i);
        Householder.UA(u[i], r_, i, m - 1, i + 1, n - 1);
      }
      q_ = ComplexFloatMatrix.CreateIdentity(m);
      for (int i = minmn - 1; i >= 0; i--) 
      {
        Householder.UA(u[i], q_, i, m - 1, i, m - 1);
      }
#else
      qr = ComplexFloatMatrix.ToLinearComplexArray(matrix);
      jpvt = new int[n];
      jpvt[0] = 1;
      Lapack.Geqp3.Compute(m, n, qr, m, jpvt, out tau);
      r_ = new ComplexFloatMatrix(m, n);
      // Populate R

      for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
          if (i <= j) {
            r_.data[j * m + i] = qr[(jpvt[j]-1) * m + i];
          }
          else {
            r_.data[j * m + i] = ComplexFloat.Zero;
          }
        }
      }

      q_ = new ComplexFloatMatrix(m, m);
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
          if (j < n)
            q_.data[j * m + i] = qr[j * m + i];
          else
            q_.data[j * m + i] = ComplexFloat.Zero;
        }
      }
      if( m < n ){
        Lapack.Ungqr.Compute(m, m, m, q_.data, m, tau);
      } else{
        Lapack.Ungqr.Compute(m, m, n, q_.data, m, tau);
      }
#endif
      for (int i = 0; i < m; i++) 
      {
        if (q_[i, i] == 0)
          isFullRank = false;
      }
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:60,代码来源:ComplexFloatQRDecomp.cs


示例2: CtorDimensions

		public void CtorDimensions()
		{
			ComplexFloatVector test = new ComplexFloatVector(2);

			Assert.AreEqual(test.Length, 2);
			Assert.AreEqual(test[0], (ComplexFloat)0);
			Assert.AreEqual(test[1], (ComplexFloat)0);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:ComplexFloatVectorTest.cs


示例3: CtorInitialValues

		public void CtorInitialValues()
		{
			ComplexFloatVector test = new ComplexFloatVector(2, (ComplexFloat)1);

			Assert.AreEqual(test.Length, 2);
			Assert.AreEqual(test[0], (ComplexFloat)1);
			Assert.AreEqual(test[1], (ComplexFloat)1);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:ComplexFloatVectorTest.cs


示例4: CurrentException2

 public void CurrentException2() 
 {
   ComplexFloatVector test = new ComplexFloatVector(new ComplexFloat[2]{1f,2f});
   IEnumerator enumerator = test.GetEnumerator();
   enumerator.MoveNext();
   enumerator.MoveNext();
   enumerator.MoveNext();
   object value=enumerator.Current;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:9,代码来源:ComplexFloatVectorEnumeratorTest.cs


示例5: CtorArray

		public void CtorArray()
		{
			float[] testvector = new float[2] { 0, 1 };

			ComplexFloatVector test = new ComplexFloatVector(testvector);
			Assert.AreEqual(test.Length, testvector.Length);
			Assert.AreEqual(test[0], (ComplexFloat)testvector[0]);
			Assert.AreEqual(test[1], (ComplexFloat)testvector[1]);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:ComplexFloatVectorTest.cs


示例6: Current

 public void Current()
 {
   ComplexFloatVector test = new ComplexFloatVector(new ComplexFloat[2]{1f,2f});
   IEnumerator enumerator = test.GetEnumerator();
   bool movenextresult;
   
   movenextresult=enumerator.MoveNext();
   Assert.IsTrue(movenextresult);
   Assert.AreEqual(enumerator.Current,test[0]);
   
   movenextresult=enumerator.MoveNext();
   Assert.IsTrue(movenextresult);
   Assert.AreEqual(enumerator.Current,test[1]);
   
   movenextresult=enumerator.MoveNext();
   Assert.IsFalse(movenextresult);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:17,代码来源:ComplexFloatVectorEnumeratorTest.cs


示例7: ZeroLengthVectorTestsforConstructor1

 public void ZeroLengthVectorTestsforConstructor1()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(1);
   cfv.RemoveAt(0);
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(cfv, cfv);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatLevinsonTest.cs


示例8: FirstElementTestforStaticInverse

 public void FirstElementTestforStaticInverse()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(3, 1.0f);
   ComplexFloatMatrix X = ComplexFloatLevinson.Inverse(cfv, TR3);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:5,代码来源:ComplexFloatLevinsonTest.cs


示例9: SingularTestforStaticSolveMatrix

 public void SingularTestforStaticSolveMatrix()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(3, 1.0f);
   ComplexFloatMatrix X = ComplexFloatLevinson.Solve(cfv, cfv, ComplexFloatMatrix.CreateIdentity(3));
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:5,代码来源:ComplexFloatLevinsonTest.cs


示例10: ZeroVectorLengthTestforStaticSolveMatrix

 public void ZeroVectorLengthTestforStaticSolveMatrix()
 {
   ComplexFloatVector LC = new ComplexFloatVector(1);
   LC.RemoveAt(0);
   ComplexFloatMatrix X = ComplexFloatLevinson.Solve(LC, TR10, ComplexFloatMatrix.CreateIdentity(10));
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatLevinsonTest.cs


示例11: FirstElementTestforStaticSolveVector

 public void FirstElementTestforStaticSolveVector()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(3, 1.0f);
   ComplexFloatVector X = ComplexFloatLevinson.Solve(cfv, TR3, Y3);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:5,代码来源:ComplexFloatLevinsonTest.cs


示例12: SetupTestCases

    public void SetupTestCases()
    {
      // unit testing values - order 1

      LC1 = new ComplexFloatVector(1);
      LC1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f);

      TR1 = new ComplexFloatVector(1);
      TR1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f);

      L1 = new ComplexFloatMatrix(1);
      L1[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      D1 = new ComplexFloatVector(1);
      D1[0] = new ComplexFloat(+5.0000000E-001f, -5.0000000E-001f);

      U1 = new ComplexFloatMatrix(1);
      U1[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      Det1 = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f);

      I1 = new ComplexFloatMatrix(1);
      I1[0, 0] = new ComplexFloat(+5.0000000E-001f, -5.0000000E-001f);

      X1 = new ComplexFloatVector(1);
      X1[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      Y1 = new ComplexFloatVector(1);
      Y1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f);

      // unit testing values - order 2

      LC2 = new ComplexFloatVector(2);
      LC2[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f);
      LC2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f);

      TR2 = new ComplexFloatVector(2);
      TR2[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f);
      TR2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f);

      L2 = new ComplexFloatMatrix(2);
      L2[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      L2[1, 0] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f);
      L2[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      D2 = new ComplexFloatVector(2);
      D2[0] = new ComplexFloat(+1.6666667E-001f, -1.6666667E-001f);
      D2[1] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f);

      U2 = new ComplexFloatMatrix(2);
      U2[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      U2[0, 1] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f);
      U2[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      Det2 = new ComplexFloat(-4.0000000E+000f, +1.8000000E+001f);

      I2 = new ComplexFloatMatrix(2);
      I2[0, 0] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f);
      I2[0, 1] = new ComplexFloat(+2.3529412E-002f, +1.0588235E-001f);
      I2[1, 0] = new ComplexFloat(+2.3529412E-002f, +1.0588235E-001f);
      I2[1, 1] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f);

      X2 = new ComplexFloatVector(2);
      X2[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      X2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f);

      Y2 = new ComplexFloatVector(2);
      Y2[0] = new ComplexFloat(+7.0000000E+000f, +3.0000000E+000f);
      Y2[1] = new ComplexFloat(+8.0000000E+000f, +6.0000000E+000f);

      // unit testing values - order 3

      LC3 = new ComplexFloatVector(3);
      LC3[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f);
      LC3[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f);
      LC3[2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      TR3 = new ComplexFloatVector(3);
      TR3[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f);
      TR3[1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      TR3[2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      L3 = new ComplexFloatMatrix(3);
      L3[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      L3[1, 0] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f);
      L3[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      L3[2, 0] = new ComplexFloat(-1.7073171E-001f, -3.6585366E-002f);
      L3[2, 1] = new ComplexFloat(-2.9878049E-001f, +3.1097561E-001f);
      L3[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);

      D3 = new ComplexFloatVector(3);
      D3[0] = new ComplexFloat(+1.6666667E-001f, -1.6666667E-001f);
      D3[1] = new ComplexFloat(+1.4634146E-001f, -1.8292683E-001f);
      D3[2] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f);

      U3 = new ComplexFloatMatrix(3);
      U3[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      U3[0, 1] = new ComplexFloat(-1.6666667E-001f, +1.6666667E-001f);
      U3[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f);
      U3[0, 2] = new ComplexFloat(-1.5243902E-001f, +1.2804878E-001f);
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:ComplexFloatLevinsonTest.cs


示例13: StaticMultiplyMatrixNonConformVector

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


示例14: StaticMultiplyMatrixVector

 public void StaticMultiplyMatrixVector()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(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 = new ComplexFloatVector(2, 2.0f);
   ComplexFloatVector c = ComplexFloatMatrix.Multiply(a,b);
   Assert.AreEqual(c[0],new ComplexFloat(6));
   Assert.AreEqual(c[1],new ComplexFloat(14));
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:ComplexFloatMatrixTest.cs


示例15: OperatorMultiplyNullMatrixVector

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


示例16: Solve

    /// <overloads>
    /// Solve a symmetric square Toeplitz system.
    /// </overloads>
    /// <summary>
    /// Solve a symmetric square Toeplitz system with a right-side vector.
    /// </summary>
    /// <param name="T">The left-most column of the Toeplitz matrix.</param>
    /// <param name="Y">The right-side vector of the system.</param>
    /// <returns>The solution vector.</returns>
    /// <exception cref="ArgumentNullException">
    /// <B>T</B> and/or <B>Y</B> are null references
    /// </exception>
    /// <exception cref="RankException">
    /// The length of <B>T</B> does not match the length of <B>Y</B>.
    /// </exception>
    /// <exception cref="SingularMatrixException">
    /// The Toeplitz matrix or one of the the leading sub-matrices is singular.
    /// </exception>
    /// <remarks>
    /// This method solves the linear system <B>AX</B> = <B>Y</B>. Where
    /// <B>T</B> is a symmetric square Toeplitz matrix, <B>X</B> is an unknown
    /// vector and <B>Y</B> is a known vector.
    /// <para>
    /// This static member combines the <b>UDL</b> decomposition and the calculation of the solution into a
    /// single algorithm. When compared to the non-static member it requires minimal data storage
    /// and suffers from no speed penalty.
    /// </para>
    /// </remarks>
    public static ComplexFloatVector Solve(IROComplexFloatVector T, IROComplexFloatVector Y)
    {

      ComplexFloatVector X;

      // check parameters
      if (T == null)
      {
        throw new System.ArgumentNullException("T");
      }
      else if (Y == null)
      {
        throw new System.ArgumentNullException("Y");
      }
      else if (T.Length != Y.Length)
      {
        throw new RankException("The length of T and Y are not equal.");
      }
      else
      {

        // allocate memory
        int N = T.Length;
        X = new ComplexFloatVector(N);                    // solution vector
        ComplexFloat e;                                   // prediction error

        // setup zero order solution
        e = T[0];
        if (e == ComplexFloat.Zero)
        {
          throw new SingularMatrixException("The Toeplitz matrix or one of the the leading sub-matrices is singular.");
        }
        X[0] = Y[0] / T[0];

        if (N > 1)
        {
          ComplexFloatVector a = new ComplexFloatVector(N - 1);   // prediction coefficients
          ComplexFloatVector Z = new ComplexFloatVector(N - 1);   // temporary storage vector
          ComplexFloat g;                                   // reflection coefficient
          ComplexFloat inner;                               // inner product
          ComplexFloat k;
          int i, j, l;

          // calculate solution for successive orders
          for (i = 1; i < N; i++)
          {

            // calculate first inner product
            inner = T[i];
            for (j = 0, l = i - 1; j < i - 1; j++, l--)
            {
              inner += a[j] * T[l];
            }

            // update predictor coefficients
            g = -(inner / e);
            for (j = 0, l = i - 2; j < i - 1; j++, l--)
            {
              Z[j] = a[j] + g * a[l];
            }

            // copy vector
            for (j = 0; j < i - 1; j++)
            {
              a[j] = Z[j];
            }

            a[i - 1] = g;

            e *= (ComplexFloat.One - g * g);
            if (e == ComplexFloat.Zero)
            {
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:ComplexFloatSymmetricLevinson.cs


示例17: SingularityPropertyTest2

    public void SingularityPropertyTest2()
    {
      ComplexFloatVector LC = new ComplexFloatVector(4);
      LC[0] = new ComplexFloat(4.0f);
      LC[1] = new ComplexFloat(2.0f);
      LC[2] = new ComplexFloat(1.0f);
      LC[3] = new ComplexFloat(0.0f);

      ComplexFloatVector TR = new ComplexFloatVector(4);
      TR[0] = new ComplexFloat(4.0f);
      TR[1] = new ComplexFloat(8.0f);
      TR[2] = new ComplexFloat(2.0f);
      TR[3] = new ComplexFloat(1.0f);

      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC,TR);
      Assert.IsTrue(cfl.IsSingular);
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:17,代码来源:ComplexFloatLevinsonTest.cs


示例18: StaticMultiplyNullMatrixVector

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


示例19: ZeroVectorLengthTestforStaticSolveVector

 public void ZeroVectorLengthTestforStaticSolveVector()
 {
   ComplexFloatVector LC = new ComplexFloatVector(1);
   LC.RemoveAt(0);
   ComplexFloatVector X = ComplexFloatLevinson.Solve(LC, TR10, Y10);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:ComplexFloatLevinsonTest.cs


示例20: MemberMultiplyVector

 public void MemberMultiplyVector()
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(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 = new ComplexFloatVector(2, 2.0f);
   a.Multiply(b);
   Assert.AreEqual(a[0,0],new ComplexFloat(6));
   Assert.AreEqual(a[1,0],new ComplexFloat(14));
   Assert.AreEqual(a.ColumnLength, 1);
   Assert.AreEqual(a.RowLength, 2);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:ComplexFloatMatrixTest.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# LinearAlgebra.DoubleSymmetricLevinson类代码示例发布时间:2022-05-24
下一篇:
C# LinearAlgebra.ComplexDoubleVector类代码示例发布时间: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