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


C# Calc.ComplexFloat类代码示例

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


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


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