本文整理汇总了C#中Complex.Conjugate方法的典型用法代码示例。如果您正苦于以下问题:C# Complex.Conjugate方法的具体用法?C# Complex.Conjugate怎么用?C# Complex.Conjugate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex
的用法示例。
在下文中一共展示了Complex.Conjugate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculatGivensRotation
public static Matrix CalculatGivensRotation(Complex a, Complex b)
{
Complex c, s, r;
r = ComplexMath.Sqrt(a.Conjugate() * a + b.Conjugate() * b);
if (b == 0) {
c = 1;
s = 0;
} else if (a == 0) {
c = 0;
s = ComplexMath.Sign(b.Conjugate());
} else {
c = a.Abs() / r;
s = ComplexMath.Sign(a) * b.Conjugate() / r;
}
Matrix givensRot = new Matrix(2);
givensRot[0, 0] = c;
givensRot[0, 1] = s;
givensRot[1, 0] = -s.Conjugate();
givensRot[1, 1] = c;
return givensRot;
}
示例2: ComplexNumTests
/// <summary>
/// Test complex number type.
/// </summary>
/// <remarks>
/// PASSING 10/17/2015
/// </remarks>
private static void ComplexNumTests()
{
Complex c1 = 1, c2 = 0, c3 = Complex.Unit;
Complex c4 = new Complex(2, 2);
Complex c5 = new Complex(2, -4);
Complex c6 = new Complex(5, 5);
Complex c7 = new Complex(3, 9);
Debug.Print("Float 1 becomes: " + c1);
Debug.Print("Float 0 becomes: " + c2);
Debug.Print("Unit Complex is: " + c3);
Debug.Print("The conjugate of " + c4 + " is " + c4.Conjugate());
Debug.Print("Magnitude and Phase of " + c4 + " are " + c4.Magnitude + " and " + c4.Phase + " radians");
Debug.Print(c4 + " + " + c5 + " is " + (c4 + c5));
Debug.Print(c6 + " * 2 is " + (c6 * 2));
Debug.Print(c6 + " / 5 is " + (c6 / 5));
Debug.Print(c6 + " * " + c4 + " is " + (c6 * c4) + " with phase " + ((c6 * c4).Phase * (180 / System.Math.PI)) + " degrees");
Debug.Print(c7 + " + 3 is " + (c7 + 3));
}
示例3: Run
public void Run()
{
var a = new Complex(5.0, 6.0);
var b = new Complex(-3.0, 4.0);
Console.WriteLine("a = " + a);
Console.WriteLine("b = " + b);
Console.WriteLine("Re(a) = " + a.Re());
Console.WriteLine("Im(a) = " + a.Im());
Console.WriteLine("b + a = " + b.Plus(a));
Console.WriteLine("a - b = " + a.Minus(b));
Console.WriteLine("a * b = " + a.Times(b));
Console.WriteLine("b * a = " + b.Times(a));
Console.WriteLine("a / b = " + a.Divides(b));
Console.WriteLine("(a / b) * b = " + a.Divides(b).Times(b));
Console.WriteLine("conj(a) = " + a.Conjugate());
Console.WriteLine("|a| = " + a.Abs());
Console.WriteLine("tan(a) = " + a.Tan());
Console.ReadLine();
}
示例4: test
// sample client for testing
public static void test()
{
Complex a = new Complex(5.0, 6.0);
Complex b = new Complex(-3.0, 4.0);
System.Diagnostics.Debug.WriteLine("a = " + a);
System.Diagnostics.Debug.WriteLine("b = " + b);
System.Diagnostics.Debug.WriteLine("Re(a) = " + a.Re);
System.Diagnostics.Debug.WriteLine("Im(a) = " + a.Im);
System.Diagnostics.Debug.WriteLine("b + a = " + b.Plus(a));
System.Diagnostics.Debug.WriteLine("a - b = " + a.Minus(b));
System.Diagnostics.Debug.WriteLine("a * b = " + a.Times(b));
System.Diagnostics.Debug.WriteLine("b * a = " + b.Times(a));
System.Diagnostics.Debug.WriteLine("a / b = " + a.Divides(b));
System.Diagnostics.Debug.WriteLine("(a / b) * b = " + a.Divides(b).Times(b));
System.Diagnostics.Debug.WriteLine("conj(a) = " + a.Conjugate());
System.Diagnostics.Debug.WriteLine("|a| = " + a.Abs());
System.Diagnostics.Debug.WriteLine("tan(a) = " + a.Tan());
}