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

C# Calc.ComplexFloat类代码示例

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

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



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

示例1: EqualsTest

		public void EqualsTest()
		{
			ComplexFloat cf1 = new ComplexFloat(-1.1f, 2.2f);
			ComplexFloat cf2 = new ComplexFloat(-1.1f, 2.2f);
			Assert.IsTrue(cf1 == cf2);
			Assert.IsTrue(cf1.Equals(cf2));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:ComplexFloatTest.cs


示例2: OperatorsTest

    public void OperatorsTest()
    {
      ComplexFloat cf1 = new ComplexFloat(1.1f, -2.2f);
      ComplexFloat cf2 = new ComplexFloat(-3.3f, 4.4f);
      ComplexFloat test = cf1 * cf2;
      Assert.AreEqual(test.Real,6.05);
      Assert.AreEqual(test.Imag,12.1);
      
      test = cf1 / cf2;
      Assert.AreEqual(test.Real,-0.44);
      Assert.AreEqual(test.Imag,0.08,TOLERENCE);

      test = cf1 + cf2;
      Assert.AreEqual(test.Real,-2.2);
      Assert.AreEqual(test.Imag,2.2);
    
      test = cf1 - cf2;
      Assert.AreEqual(test.Real,4.4);
      Assert.AreEqual(test.Imag,-6.6);

      //test = cf1 ^ cf2;
      //Assert.AreEqual(test.Real,1.593,TOLERENCE);
      //Assert.AreEqual(test.Imag,6.503,TOLERENCE);

    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:25,代码来源:ComplexFloatTest.cs


示例3: NaNTest

		public void NaNTest()
		{
			ComplexFloat cf = new ComplexFloat(Single.NaN, 1.1f);
			Assert.IsTrue(cf.IsNaN());
			cf = new ComplexFloat(1.1f, Single.NaN);
			Assert.IsTrue(cf.IsNaN());
			cf = new ComplexFloat(1.1f, 2.2f);
			Assert.IsFalse(cf.IsNaN());
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:ComplexFloatTest.cs


示例4: ConversionTest

		public void ConversionTest()
		{
			Complex cd1 = 2.2;
			ComplexFloat cf = new ComplexFloat(-1.1f, 2.2f);
			Complex cd2 = cf;
			Assert.AreEqual(cd1.Real, 2.2);
			Assert.AreEqual(cd1.Imag, 0);
			Assert.AreEqual(cd2.Real, -1.1, TOLERENCE);
			Assert.AreEqual(cd2.Imag, 2.2, TOLERENCE);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:10,代码来源:ComplexDoubleTest.cs


示例5: EqualsTest

		public void EqualsTest()
		{
			Complex cd1 = new Complex(-1.1, 2.2);
			Complex cd2 = new Complex(-1.1, 2.2);
			Complex cd3 = new Complex(-1, 2);
			ComplexFloat cf = new ComplexFloat(-1, 2);
			Assert.IsTrue(cd1 == cd2);
			Assert.IsTrue(cd1.Equals(cd2));
			Assert.IsTrue(cd3 == cf);
			Assert.IsTrue(cd3.Equals(cf));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:11,代码来源:ComplexDoubleTest.cs


示例6: CtorInitialValues

 public void CtorInitialValues()
 {
   ComplexFloatMatrix test = new ComplexFloatMatrix(2,2,new ComplexFloat(1,1));
   
   Assert.AreEqual(test.RowLength, 2);
   Assert.AreEqual(test.ColumnLength, 2);
   ComplexFloat value = new ComplexFloat(1,1);
   Assert.AreEqual(test[0,0], value);
   Assert.AreEqual(test[0,1], value);
   Assert.AreEqual(test[1,0], value);
   Assert.AreEqual(test[1,1], value);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:ComplexFloatMatrixTest.cs


示例7: ComplexFloatLUDecompTest

 static ComplexFloatLUDecompTest() 
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(3);
   a[0,0] = new ComplexFloat(-1,1);
   a[0,1] = 5;
   a[0,2] = 6;
   a[1,0] = 3;
   a[1,1] = -6;
   a[1,2] = 1;
   a[2,0] = 6;
   a[2,1] = 8;
   a[2,2] = 9;
   lu = new ComplexFloatLUDecomp(a);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:ComplexFloatLUDecompTest.cs


示例8: ComplexFloatCholeskyDecompTest

 static ComplexFloatCholeskyDecompTest() 
 {
   ComplexFloatMatrix a = new ComplexFloatMatrix(3);
   a[0,0] = 2;
   a[0,1] = new ComplexFloat(1,-1);
   a[0,2] = 0;
   a[1,0] = new ComplexFloat(1,-1);
   a[1,1] = 2;
   a[1,2] = 0;
   a[2,0] = 0;
   a[2,1] = 0;
   a[2,2] = 3;
   cd = new ComplexFloatCholeskyDecomp(a);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:ComplexFloatCholeskyDecompTest.cs


示例9: SquareDecomp

    public void SquareDecomp()
    {
      ComplexFloatMatrix a = new ComplexFloatMatrix(3);
      a[0,0] = new ComplexFloat(1.1f, 1.1f);
      a[0,1] = new ComplexFloat(2.2f, -2.2f);
      a[0,2] = new ComplexFloat(3.3f, 3.3f);
      a[1,0] = new ComplexFloat(4.4f, -4.4f);
      a[1,1] = new ComplexFloat(5.5f, 5.5f);
      a[1,2] = new ComplexFloat(6.6f, -6.6f);
      a[2,0] = new ComplexFloat(7.7f, 7.7f);
      a[2,1] = new ComplexFloat(8.8f, -8.8f);
      a[2,2] = new ComplexFloat(9.9f, 9.9f);
      
      ComplexFloatQRDecomp qrd = new ComplexFloatQRDecomp(a);
      ComplexFloatMatrix qq = qrd.Q.GetConjugateTranspose()*qrd.Q;
      ComplexFloatMatrix qr = qrd.Q*qrd.R;
      ComplexFloatMatrix I = ComplexFloatMatrix.CreateIdentity(3);
      
      // determine the maximum relative error
      double MaxError = 0.0;
      for (int i = 0; i < 3; i++) 
      {
        for (int j = 0; i < 3; i++) 
        {
          double E = ComplexMath.Absolute((qq[i, j] - I[i, j]));
          if (E > MaxError) 
          {
            MaxError = E;
          }
        }
      }
      
      Assert.IsTrue(MaxError < 1.0E-6);
      
      MaxError = 0.0;
      for (int i = 0; i < 3; i++) 
      {
        for (int j = 0; i < 3; i++) 
        {
          double E = ComplexMath.Absolute((qr[i, j] - a[i, j]) / a[i, j]);
          if (E > MaxError) 
          {
            MaxError = E;
          }
        }
      }

      Assert.IsTrue(MaxError < 2.4E-6);
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:49,代码来源:ComplexFloatQRDecompTest.cs


示例10: CtorCopy

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


示例11: Absolute

 public void Absolute()
 {
   Complex cd1 = new Complex(1.1, -2.2);
   Complex cd2 = new Complex(0, -2.2);
   Complex cd3 = new Complex(1.1, 0);
   Complex cd4 = new Complex(-1.1, 2.2);
   ComplexFloat cf1 = new ComplexFloat(1.1f, -2.2f);
   ComplexFloat cf2 = new ComplexFloat(0, -2.2f);
   ComplexFloat cf3 = new ComplexFloat(1.1f, 0);
   ComplexFloat cf4 = new ComplexFloat(-1.1f, 2.2f);
   Assert.AreEqual(ComplexMath.Absolute(cd1),2.460,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cd2),2.2,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cd3),1.1,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cd4),2.460,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cf1),2.460,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cf2),2.2,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cf3),1.1,TOLERENCE);
   Assert.AreEqual(ComplexMath.Absolute(cf4),2.460,TOLERENCE);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:ComplexMathTest.cs


示例12: Argument2

 public void Argument2()
 {
   Complex cd1 = new Complex(1.1, -2.2);
   Complex cd2 = new Complex(0, -2.2);
   Complex cd3 = new Complex(1.1, 0);
   Complex cd4 = new Complex(-1.1, 2.2);
   ComplexFloat cf1 = new ComplexFloat(1.1f, -2.2f);
   ComplexFloat cf2 = new ComplexFloat(0, -2.2f);
   ComplexFloat cf3 = new ComplexFloat(1.1f, 0);
   ComplexFloat cf4 = new ComplexFloat(-1.1f, 2.2f);
   Assert.AreEqual(ComplexMath.Argument2(cd1),-1.107,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cd2),-1.571,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cd3),0,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cd4),2.034,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cf1),-1.107,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cf2),-1.571,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cf3),0,TOLERENCE);
   Assert.AreEqual(ComplexMath.Argument2(cf4),2.034,TOLERENCE);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:ComplexMathTest.cs


示例13: OperatorsTest

		public void OperatorsTest()
		{
			ComplexFloat cf1 = new ComplexFloat(1.1f, -2.2f);
			ComplexFloat cf2 = new ComplexFloat(-3.3f, 4.4f);
			ComplexFloat test = cf1 * cf2;
			Assert.AreEqual(test.Real, 6.05f);
			Assert.AreEqual(test.Imag, 12.1f);

			test = cf1 / cf2;
			Assert.AreEqual(test.Real, -0.44f);
			Assert.AreEqual(test.Imag, 0.08f, TOLERANCE);

			test = cf1 + cf2;
			Assert.AreEqual(test.Real, (1.1f - 3.3f));
			Assert.AreEqual(test.Imag, (-2.2f + 4.4f));

			test = cf1 - cf2;
			Assert.AreEqual(test.Real, (1.1f + 3.3f));
			Assert.AreEqual(test.Imag, (-2.2f - 4.4f));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:20,代码来源:ComplexFloatTest.cs


示例14: SumRecursion

 static private ComplexFloat   SumRecursion( ComplexFloat[] data, int start, int end ) 
 {
   Debug.Assert( 0 <= start, "start = " + start );
   Debug.Assert( start < end, "start = " + start + " and end = " + end );
   Debug.Assert( end <= data.Length, "end = " + end + " and data.Length = " + data.Length );
   if( ( end - start ) <= 1000 ) 
   {
     ComplexFloat sum = ComplexFloat.Zero;
     for( int i = start; i < end; i ++ ) 
     {
       sum += data[ i ];
     
     }
     return  sum;
   }
   else 
   {
     int middle = ( start + end ) >> 1;
     return  SumRecursion( data, start, middle ) + SumRecursion( data, middle, end );
   }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:21,代码来源:ComplexStats.cs


示例15: SetupTestCases

 public void SetupTestCases() 
 {
   a = new ComplexFloatMatrix(3);
   a[0,0] = new ComplexFloat(1.1f, 1.1f);
   a[0,1] = new ComplexFloat(2.2f, -2.2f);
   a[0,2] = new ComplexFloat(3.3f, 3.3f);
   a[1,0] = new ComplexFloat(4.4f, -4.4f);
   a[1,1] = new ComplexFloat(5.5f, 5.5f);
   a[1,2] = new ComplexFloat(6.6f, -6.6f);
   a[2,0] = new ComplexFloat(7.7f, 7.7f);
   a[2,1] = new ComplexFloat(8.8f, -8.8f);
   a[2,2] = new ComplexFloat(9.9f, 9.9f);
   svd = new ComplexFloatSVDDecomp(a, true);
   
   wa = new ComplexFloatMatrix(2,4);
   wa[0,0] = new ComplexFloat(1.1f, 1.1f);
   wa[0,1] = new ComplexFloat(2.2f, -2.2f);
   wa[0,2] = new ComplexFloat(3.3f, 3.3f);
   wa[0,3] = new ComplexFloat(4.4f, -4.4f);
   wa[1,0] = new ComplexFloat(5.5f, 5.5f);
   wa[1,1] = new ComplexFloat(6.6f, -6.6f);
   wa[1,2] = new ComplexFloat(7.7f, 7.7f);
   wa[1,3] = new ComplexFloat(8.8f, -8.8f);
   wsvd = new ComplexFloatSVDDecomp(wa, true);
     
   la = new ComplexFloatMatrix(4,2);
   la[0,0] = new ComplexFloat(1.1f, 1.1f);
   la[0,1] = new ComplexFloat(2.2f, -2.2f);
   la[1,0] = new ComplexFloat(3.3f, 3.3f);
   la[1,1] = new ComplexFloat(4.4f, -4.4f);
   la[2,0] = new ComplexFloat(5.5f, 5.5f);
   la[2,1] = new ComplexFloat(6.6f, -6.6f);
   la[3,0] = new ComplexFloat(7.7f, 7.7f);
   la[3,1] = new ComplexFloat(8.8f, -8.8f);
   lsvd = new ComplexFloatSVDDecomp(la, true);
 } 
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:36,代码来源:ComplexFloatSVDDecompTest.cs


示例16: Cosh

 /// <summary>
 /// This function returns the complex hyperbolic cosine of the complex number
 /// a, cosh(a) = (exp(a) + exp(-z))/2.
 /// </summary>
 /// <param name="a">Function argument.</param>
 /// <returns>The hyperbolic cosine of the specified complex function argument z.</returns>
 public static ComplexFloat Cosh(ComplexFloat a)
 {
   double R = a.Re, I = a.Im;
   return new ComplexFloat((float) (Math.Cosh(R) * Math.Cos(I)), (float)(Math.Sinh(R) * Math.Sin(I)));
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:ComplexMath.cs


示例17: Cos

 /// <summary>
 /// Returns the cosine of the specified complex function argument z.
 /// </summary>
 /// <param name="z">Function argument.</param>
 /// <returns>The cosine of the specified complex function argument z.</returns>
 public static ComplexFloat Cos(ComplexFloat z)
 {
   double ezi = Math.Exp(z.Im);
   double inv = 1.0 / ezi;
   return ComplexFloat.FromRealImaginary((float)(0.5 * Math.Cos(z.Re) * (inv + ezi)), (float)( 0.5 * Math.Sin(z.Re) * (inv - ezi)));
 } 
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:ComplexMath.cs


示例18: Conjugate

 ///<summary>Return the complex conjugate of a complex type</summary>
 public static ComplexFloat Conjugate(ComplexFloat a)
 {
   return new ComplexFloat(a.Re, -a.Im);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:5,代码来源:ComplexMath.cs


示例19: Atanh

 /// <summary>
 /// This function returns the complex hyperbolic arctangent of the complex
 /// number a,  arctanh(a).  The branch cuts are on the real
 /// axis, less than -1 and greater than 1.
 /// </summary>
 /// <param name="a">Function argument.</param>
 /// <returns>The complex hyperbolic arctangent of the complex
 /// number a.</returns>
 public static ComplexFloat Atanh(ComplexFloat a)
 {
   return (ComplexFloat)Atanh((Complex)a);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:ComplexMath.cs


示例20: Asin

 /// <summary>
 /// This function returns the complex arcsine of the complex number a,
 /// arcsin(a)}. The branch cuts are on the real axis, less than -1
 /// and greater than 1.
 /// </summary>
 /// <param name="a">The function argument.</param>
 /// <returns>the complex arcsine of the complex number a.</returns>
 public static ComplexFloat Asin(ComplexFloat a)
 {
   return (ComplexFloat)Asin((Complex)a);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:ComplexMath.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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