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); }
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)); }
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()); }
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); }
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)); }
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); }
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); }
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); }
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); }
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]); }
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); }
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); }
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)); }
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 ); } }
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); }
///<summary>Created a <c>ComplexFloat</c> from the given string. The string can be in the ///following formats: <c>n</c>, <c>ni</c>, <c>n +/- ni</c>, <c>n,n</c>, <c>n,ni</c>, ///<c>(n,n)</c>, or <c>(n,ni)</c>, where n is a real number.</summary> ///<param name="s">The string to create the <c>ComplexFloat</c> from.</param> ///<exception cref="FormatException">if the n, is not a number.</exception> ///<exception cref="ArgumentNullException">if s, is <c>null</c>.</exception> public ComplexFloat(string s) { this = ComplexFloat.Parse(s); }
/// <summary> /// Returns the exponential function of the complex function argument. /// </summary> /// <param name="z">The complex function argument.</param> /// <returns>The exponential function of the spezified complex function argument.</returns> public static ComplexFloat Exp(ComplexFloat z) { return(ComplexFloat.FromModulusArgument((float)Math.Exp(z.Re), (float)z.Im)); }
///<summary>Calculate the 2-argument of a complex type.</summary> public static float Argument2(ComplexFloat value) { return (float)System.Math.Atan2(value.Imag, value.Real); }
/// <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); }
/// <summary> /// This function returns the complex hyperbolic tangent of the complex number /// a, tanh(a) = sinh(a)/cosh(a). /// </summary> /// <param name="a">Function argument.</param> /// <returns>The hyperbolic tangent of the specified complex function argument z.</returns> public static ComplexFloat Tanh(ComplexFloat a) { double R = a.Re, I = a.Im; ComplexFloat z; if (Math.Abs(R) < 1.0) { double D = square(Math.Cos(I)) + square(Math.Sinh(R)); z = new ComplexFloat((float)(Math.Sinh(R) * Math.Cosh(R) / D),(float)( 0.5 * Math.Sin(2 * I) / D)); } else { double D = square(Math.Cos(I)) + square(Math.Sinh(R)); double F = 1 + square(Math.Cos(I) / Math.Sinh(R)); z = new ComplexFloat((float)(1.0 / (Math.Tanh(R) * F)), (float)(0.5 * Math.Sin(2 * I) / D)); } return z; }
/// <summary> /// This function returns the complex hyperbolic arccosine of the complex /// number a, arccosh(a). The branch cut is on the real axis, /// less than 1. /// </summary> /// <param name="a">Function argument.</param> /// <returns>The complex hyperbolic arccosine of the complex number a.</returns> public static ComplexFloat Acosh(ComplexFloat a) { return (ComplexFloat)Acosh((Complex)a); }
/// <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)); }
///<summary>Return the polar representation of a complex type</summary> public static ComplexFloat Polar(ComplexFloat value) { return(new ComplexFloat(ComplexMath.Absolute(value), (float)(System.Math.Atan2(value.Imag, value.Real)))); }
/// <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)))); }
///<summary>Return the complex conjugate of a complex type</summary> public static ComplexFloat Conjugate(ComplexFloat a) { return(new ComplexFloat(a.Re, -a.Im)); }
//----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- /// <summary> /// Determine whether two complex numbers are almost (i.e. within the tolerance) equivalent. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="tolerance"></param> /// <returns></returns> public static bool IsEqual(ComplexFloat a, ComplexFloat b, float tolerance) { return ((Math.Abs(a.Re - b.Re) < tolerance) && (Math.Abs(a.Im - b.Im) < tolerance)); }
/// <summary>Creates a <c>ComplexFloat</c> based on a string. The string can be in the ///following formats: <c>n</c>, <c>ni</c>, <c>n +/- ni</c>, <c>n,n</c>, <c>n,ni</c>, ///<c>(n,n)</c>, or <c>(n,ni)</c>, where n is a real number.</summary> /// <param name="s">the string to parse.</param> /// <returns></returns> public static ComplexFloat Parse(string s) { if (s == null) { throw new ArgumentNullException(s, "s cannot be null."); } s = s.Trim(); if (s.Length == 0) { throw new FormatException(); } //check if one character strings are valid if (s.Length == 1) { if (string.Compare(s, "i") == 0) { return(new ComplexFloat(0, 1)); } else { return(new ComplexFloat(float.Parse(s))); } } //strip out parens if (s.StartsWith("(")) { if (!s.EndsWith(")")) { throw new FormatException(); } else { s = s.Substring(1, s.Length - 2); } } string real = s; string imag = "0"; //comma separated int index = s.IndexOf(','); if (index > -1) { real = s.Substring(0, index); imag = s.Substring(index + 1, s.Length - index - 1); } else { index = s.IndexOf('+', 1); if (index > -1) { real = s.Substring(0, index); imag = s.Substring(index + 1, s.Length - index - 1); } else { index = s.IndexOf('-', 1); if (index > -1) { real = s.Substring(0, index); imag = s.Substring(index, s.Length - index); } } } //see if we have numbers in the format xxxi if (real.EndsWith("i")) { if (!imag.Equals("0")) { throw new FormatException(); } else { imag = real.Substring(0, real.Length - 1); real = "0"; } } if (imag.EndsWith("i")) { imag = imag.Substring(0, imag.Length - 1); } //handle cases of - n, + n if (real.StartsWith("-")) { real = "-" + real.Substring(1, real.Length - 1).Trim(); } if (imag.StartsWith("-")) { imag = "-" + imag.Substring(1, imag.Length - 1).Trim(); } ComplexFloat ret; try { ret = new ComplexFloat(float.Parse(real.Trim()), float.Parse(imag.Trim())); } catch (Exception) { throw new FormatException(); } return(ret); }
///<summary>Check if <c>ComplexFloat</c> variable is the same as another object</summary> ///<param name="obj"><c>obj</c> to compare present <c>ComplexFloat</c> to.</param> ///<returns>Returns true if the variable is the same as the <c>ComplexFloat</c> variable</returns> ///<remarks>The <c>obj</c> parameter is converted into a <c>ComplexFloat</c> variable before comparing with the current <c>ComplexFloat</c>.</remarks> public bool Equals(ComplexFloat obj) { return(Re == obj.Re && Im == obj.Im); }
/// <summary> /// This function returns the complex hyperbolic arccosine of the complex /// number a, arccosh(a). The branch cut is on the real axis, /// less than 1. /// </summary> /// <param name="a">Function argument.</param> /// <returns>The complex hyperbolic arccosine of the complex number a.</returns> public static ComplexFloat Acosh(ComplexFloat a) { return((ComplexFloat)Acosh((Complex)a)); }
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); }
///<summary>Return the absolute value of a complex type calculated as the euclidean norm</summary> ///<remarks>Same as <see cref="Abs" /> and provided here for compatibility with some libraries.</remarks> public static float Absolute(ComplexFloat c) { return(c.GetModulus()); }
///<summary>Return the euclidean norm of a complex type</summary> public static float Norm(ComplexFloat value) { return(ComplexMath.Absolute(value)); }
/// <summary> /// Returns the tangent of the specified complex function argument z. /// </summary> /// <param name="z">Function argument.</param> /// <returns>The tangent of the specified complex function argument z.</returns> public static ComplexFloat Tan(ComplexFloat z) { double sinzr = Math.Sin(z.Re); double coszr = Math.Cos(z.Re); double ezi = Math.Exp(z.Im); double inv = 1.0 / ezi; double ediff = inv - ezi; double esum = inv + ezi; return ComplexFloat.FromRealImaginary((float)(4 * sinzr * coszr),(float)( -ediff * esum)) / (float)(square(coszr * esum) + square(sinzr * ediff)); }
/// <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)); }
///<summary>Return the absolute value of a complex type calculated as the euclidean norm</summary> ///<remarks>Same as <see cref="Abs" /> and provided here for compatibility with some libraries.</remarks> public static float Absolute(ComplexFloat c) { return c.GetModulus(); }
///<summary>Calculate the 2-argument of a complex type.</summary> public static float Argument2(ComplexFloat value) { return((float)System.Math.Atan2(value.Imag, value.Real)); }
/// <summary> /// The argument value (also called phase) of a complex number. /// </summary> /// <param name="c">The complex number.</param> /// <returns>The argument (also called phase) of the complex number.</returns> /// <remarks>Only for completeness, you can also use <code>c.GetArgument()</code></remarks> public static double Arg(ComplexFloat c) { return c.GetArgument(); }
/// <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))); }
/// <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); }
/// <summary> /// Returns the exponential function of the complex function argument. /// </summary> /// <param name="z">The complex function argument.</param> /// <returns>The exponential function of the spezified complex function argument.</returns> public static ComplexFloat Exp(ComplexFloat z) { return ComplexFloat.FromModulusArgument((float)Math.Exp(z.Re), (float)z.Im); }
///<summary>Return the complex conjugate of a complex type</summary> public static ComplexFloat Conjugate(ComplexFloat a) { return new ComplexFloat(a.Re, -a.Im); }
/// <summary> /// Create a complex number based on an existing complex number /// </summary> /// <param name="c"></param> public ComplexFloat(ComplexFloat c) { Re = c.Re; Im = c.Im; }
/// <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))); }
/// <summary> /// The argument value (also called phase) of a complex number. /// </summary> /// <param name="c">The complex number.</param> /// <returns>The argument (also called phase) of the complex number.</returns> /// <remarks>Only for completeness, you can also use <code>c.GetArgument()</code></remarks> public static double Arg(ComplexFloat c) { return(c.GetArgument()); }
/// <summary> /// Returns the natural (base e) logarithm of the complex function argument. /// </summary> /// <param name="z">The complex function argument.</param> /// <returns>The natural (base e) logarithm of the complex function argument.</returns> public static ComplexFloat Log(ComplexFloat z) { return new ComplexFloat((float)LogAbs(z), (float)Arg(z)); }
/// <summary> /// Returns the natural (base e) logarithm of the complex function argument. /// </summary> /// <param name="z">The complex function argument.</param> /// <returns>The natural (base e) logarithm of the complex function argument.</returns> public static ComplexFloat Log(ComplexFloat z) { return(new ComplexFloat((float)LogAbs(z), (float)Arg(z))); }
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); U3[1, 2] = new ComplexFloat(-1.5853659E-001f, +7.3170732E-002f); U3[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det3 = new ComplexFloat(-6.4000000E+001f, +3.9000000E+001f); I3 = new ComplexFloatMatrix(3); I3[0, 0] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f); I3[0, 1] = new ComplexFloat(-9.4356418E-003f, +4.1125156E-002f); I3[0, 2] = new ComplexFloat(+1.9583408E-003f, +4.8068364E-002f); I3[1, 0] = new ComplexFloat(+1.5310664E-002f, +1.0307994E-001f); I3[1, 1] = new ComplexFloat(+1.3637173E-001f, -1.9814848E-001f); I3[1, 2] = new ComplexFloat(-9.4356418E-003f, +4.1125156E-002f); I3[2, 0] = new ComplexFloat(-3.2223607E-002f, +2.7238740E-002f); I3[2, 1] = new ComplexFloat(+1.5310664E-002f, +1.0307994E-001f); I3[2, 2] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f); X3 = new ComplexFloatVector(3); X3[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X3[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X3[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); Y3 = new ComplexFloatVector(3); Y3[0] = new ComplexFloat(+8.0000000E+000f, +3.0000000E+000f); Y3[1] = new ComplexFloat(+1.1000000E+001f, +6.0000000E+000f); Y3[2] = new ComplexFloat(+1.4000000E+001f, +9.0000000E+000f); // unit testing values - order 4 LC4 = new ComplexFloatVector(4); LC4[0] = new ComplexFloat(+4.0000000E+000f, +4.0000000E+000f); LC4[1] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); LC4[2] = new ComplexFloat(+2.0000000E+000f, +2.0000000E+000f); LC4[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR4 = new ComplexFloatVector(4); TR4[0] = new ComplexFloat(+4.0000000E+000f, +4.0000000E+000f); TR4[1] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR4[2] = new ComplexFloat(+2.0000000E+000f, +2.0000000E+000f); TR4[3] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); L4 = new ComplexFloatMatrix(4); L4[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[1, 0] = new ComplexFloat(-7.5000000E-001f, +0.0000000E+000f); L4[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[2, 0] = new ComplexFloat(+7.6923077E-002f, +0.0000000E+000f); L4[2, 1] = new ComplexFloat(-7.6923077E-001f, +0.0000000E+000f); L4[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[3, 0] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); L4[3, 1] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); L4[3, 2] = new ComplexFloat(-8.1818182E-001f, +0.0000000E+000f); L4[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D4 = new ComplexFloatVector(4); D4[0] = new ComplexFloat(+1.2500000E-001f, -1.2500000E-001f); D4[1] = new ComplexFloat(+1.5384615E-001f, -1.5384615E-001f); D4[2] = new ComplexFloat(+1.4772727E-001f, -1.4772727E-001f); D4[3] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); U4 = new ComplexFloatMatrix(4); U4[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 1] = new ComplexFloat(-2.5000000E-001f, +0.0000000E+000f); U4[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 2] = new ComplexFloat(-5.3846154E-001f, +0.0000000E+000f); U4[1, 2] = new ComplexFloat(+1.5384615E-001f, +0.0000000E+000f); U4[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 3] = new ComplexFloat(-8.1818182E-001f, +0.0000000E+000f); U4[1, 3] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); U4[2, 3] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); U4[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det4 = new ComplexFloat(-6.4000000E+002f, +0.0000000E+000f); I4 = new ComplexFloatMatrix(4); I4[0, 0] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[0, 1] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[0, 2] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[0, 3] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[1, 0] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[1, 1] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[1, 2] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[1, 3] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[2, 0] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[2, 1] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[2, 2] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[2, 3] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 0] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 1] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 2] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[3, 3] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); X4 = new ComplexFloatVector(4); X4[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X4[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X4[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X4[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); Y4 = new ComplexFloatVector(4); Y4[0] = new ComplexFloat(+2.4000000E+001f, +2.4000000E+001f); Y4[1] = new ComplexFloat(+2.2000000E+001f, +2.2000000E+001f); Y4[2] = new ComplexFloat(+2.4000000E+001f, +2.4000000E+001f); Y4[3] = new ComplexFloat(+3.0000000E+001f, +3.0000000E+001f); // unit testing values - order 5 LC5 = new ComplexFloatVector(5); LC5[0] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); LC5[1] = new ComplexFloat(+4.0000000E+000f, +1.0000000E+000f); LC5[2] = new ComplexFloat(+3.0000000E+000f, +1.0000000E+000f); LC5[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); LC5[4] = new ComplexFloat(+0.0000000E+000f, +0.0000000E+000f); TR5 = new ComplexFloatVector(5); TR5[0] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); TR5[1] = new ComplexFloat(+1.0000000E+000f, +4.0000000E+000f); TR5[2] = new ComplexFloat(+1.0000000E+000f, +3.0000000E+000f); TR5[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR5[4] = new ComplexFloat(+0.0000000E+000f, +0.0000000E+000f); L5 = new ComplexFloatMatrix(5); L5[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[1, 0] = new ComplexFloat(-8.0769231E-001f, -3.8461538E-002f); L5[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[2, 0] = new ComplexFloat(+3.8400000E-002f, +1.1200000E-002f); L5[2, 1] = new ComplexFloat(-8.1280000E-001f, -7.0400000E-002f); L5[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[3, 0] = new ComplexFloat(+2.2603093E-001f, +9.7680412E-002f); L5[3, 1] = new ComplexFloat(+8.8659794E-002f, -4.9484536E-002f); L5[3, 2] = new ComplexFloat(-8.9149485E-001f, -2.3788660E-001f); L5[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[4, 0] = new ComplexFloat(-1.1100961E-001f, +5.9189712E-002f); L5[4, 1] = new ComplexFloat(+2.3807881E-001f, +1.3619525E-001f); L5[4, 2] = new ComplexFloat(+1.0797070E-001f, +5.4774906E-003f); L5[4, 3] = new ComplexFloat(-8.0625940E-001f, -2.8594254E-001f); L5[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D5 = new ComplexFloatVector(5); D5[0] = new ComplexFloat(+1.9230769E-001f, -3.8461538E-002f); D5[1] = new ComplexFloat(+1.8080000E-001f, +9.4400000E-002f); D5[2] = new ComplexFloat(+1.8015464E-001f, +8.8402062E-002f); D5[3] = new ComplexFloat(+1.5698660E-001f, +6.5498707E-002f); D5[4] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); U5 = new ComplexFloatMatrix(5); U5[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 1] = new ComplexFloat(-3.4615385E-001f, -7.3076923E-001f); U5[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 2] = new ComplexFloat(-5.6320000E-001f, -4.9760000E-001f); U5[1, 2] = new ComplexFloat(+8.9600000E-002f, -3.0720000E-001f); U5[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 3] = new ComplexFloat(-7.7757732E-001f, +1.8298969E-002f); U5[1, 3] = new ComplexFloat(+7.0103093E-002f, -4.5773196E-001f); U5[2, 3] = new ComplexFloat(+5.9536082E-002f, -3.1520619E-001f); U5[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 4] = new ComplexFloat(-3.8732272E-001f, +5.0102819E-001f); U5[1, 4] = new ComplexFloat(-3.1309322E-001f, -3.3622620E-001f); U5[2, 4] = new ComplexFloat(+6.0556288E-002f, -3.9414442E-001f); U5[3, 4] = new ComplexFloat(-7.6951473E-002f, -2.3979216E-001f); U5[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det5 = new ComplexFloat(+5.0900000E+002f, -4.2310000E+003f); I5 = new ComplexFloatMatrix(5); I5[0, 0] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); I5[0, 1] = new ComplexFloat(+2.2939970E-004f, -4.3279784E-002f); I5[0, 2] = new ComplexFloat(+3.0931791E-002f, -6.1154404E-002f); I5[0, 3] = new ComplexFloat(-3.3198751E-002f, -7.1638344E-002f); I5[0, 4] = new ComplexFloat(-9.0017358E-002f, +6.1172024E-002f); I5[1, 0] = new ComplexFloat(-1.1644584E-001f, -8.9749247E-002f); I5[1, 1] = new ComplexFloat(+1.4442611E-001f, +1.0032784E-001f); I5[1, 2] = new ComplexFloat(-1.2433728E-002f, -5.1220119E-003f); I5[1, 3] = new ComplexFloat(+4.7268453E-002f, -1.4096573E-005f); I5[1, 4] = new ComplexFloat(-3.3198751E-002f, -7.1638344E-002f); I5[2, 0] = new ComplexFloat(+1.7345558E-002f, +6.6582631E-003f); I5[2, 1] = new ComplexFloat(-1.2410964E-001f, -1.0040846E-001f); I5[2, 2] = new ComplexFloat(+1.4624793E-001f, +1.1547147E-001f); I5[2, 3] = new ComplexFloat(-1.2433728E-002f, -5.1220119E-003f); I5[2, 4] = new ComplexFloat(+3.0931791E-002f, -6.1154404E-002f); I5[3, 0] = new ComplexFloat(+3.1622138E-002f, +3.4957299E-002f); I5[3, 1] = new ComplexFloat(+2.3108689E-002f, -1.2234063E-002f); I5[3, 2] = new ComplexFloat(-1.2410964E-001f, -1.0040846E-001f); I5[3, 3] = new ComplexFloat(+1.4442611E-001f, +1.0032784E-001f); I5[3, 4] = new ComplexFloat(+2.2939970E-004f, -4.3279784E-002f); I5[4, 0] = new ComplexFloat(-2.1293920E-002f, +3.7434662E-003f); I5[4, 1] = new ComplexFloat(+3.1622138E-002f, +3.4957299E-002f); I5[4, 2] = new ComplexFloat(+1.7345558E-002f, +6.6582631E-003f); I5[4, 3] = new ComplexFloat(-1.1644584E-001f, -8.9749247E-002f); I5[4, 4] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); X5 = new ComplexFloatVector(5); X5[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X5[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X5[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X5[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); X5[4] = new ComplexFloat(+5.0000000E+000f, +0.0000000E+000f); Y5 = new ComplexFloatVector(5); Y5[0] = new ComplexFloat(+1.4000000E+001f, +2.2000000E+001f); Y5[1] = new ComplexFloat(+2.6000000E+001f, +3.2000000E+001f); Y5[2] = new ComplexFloat(+3.5000000E+001f, +3.7000000E+001f); Y5[3] = new ComplexFloat(+4.4000000E+001f, +3.0000000E+001f); Y5[4] = new ComplexFloat(+5.2000000E+001f, +1.4000000E+001f); // unit testing values - order 10 LC10 = new ComplexFloatVector(10); LC10[0] = new ComplexFloat(+1.0000000E+001f, +1.0000000E+000f); LC10[1] = new ComplexFloat(+9.0000000E+000f, +1.0000000E+000f); LC10[2] = new ComplexFloat(+8.0000000E+000f, +1.0000000E+000f); LC10[3] = new ComplexFloat(+7.0000000E+000f, +1.0000000E+000f); LC10[4] = new ComplexFloat(+6.0000000E+000f, +1.0000000E+000f); LC10[5] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); LC10[6] = new ComplexFloat(+4.0000000E+000f, +1.0000000E+000f); LC10[7] = new ComplexFloat(+3.0000000E+000f, +1.0000000E+000f); LC10[8] = new ComplexFloat(+2.0000000E+000f, +1.0000000E+000f); LC10[9] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10 = new ComplexFloatVector(10); TR10[0] = new ComplexFloat(+1.0000000E+001f, +1.0000000E+000f); TR10[1] = new ComplexFloat(+1.0000000E+000f, +9.0000000E+000f); TR10[2] = new ComplexFloat(+1.0000000E+000f, +8.0000000E+000f); TR10[3] = new ComplexFloat(+1.0000000E+000f, +2.0000000E+000f); TR10[4] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10[5] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10[6] = new ComplexFloat(+1.0000000E+000f, +4.0000000E+000f); TR10[7] = new ComplexFloat(+1.0000000E+000f, +3.0000000E+000f); TR10[8] = new ComplexFloat(+1.0000000E+000f, +2.0000000E+000f); TR10[9] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); L10 = new ComplexFloatMatrix(10); L10[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[1, 0] = new ComplexFloat(-9.0099010E-001f, -9.9009901E-003f); L10[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[2, 0] = new ComplexFloat(+7.2554049E-003f, +4.5437889E-003f); L10[2, 1] = new ComplexFloat(-8.9835104E-001f, -1.7149139E-002f); L10[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[3, 0] = new ComplexFloat(+8.1190931E-003f, +4.8283630E-003f); L10[3, 1] = new ComplexFloat(+8.5500220E-003f, +3.8783605E-003f); L10[3, 2] = new ComplexFloat(-8.9685128E-001f, -2.5375839E-002f); L10[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[4, 0] = new ComplexFloat(+9.0797285E-003f, +5.0413564E-003f); L10[4, 1] = new ComplexFloat(+9.5223197E-003f, +3.9833209E-003f); L10[4, 2] = new ComplexFloat(+1.3594954E-002f, +1.3510004E-003f); L10[4, 3] = new ComplexFloat(-9.0106887E-001f, -3.2599942E-002f); L10[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[5, 0] = new ComplexFloat(+1.0110174E-002f, +5.1587582E-003f); L10[5, 1] = new ComplexFloat(+1.0553084E-002f, +3.9861933E-003f); L10[5, 2] = new ComplexFloat(+1.4900585E-002f, +9.5517949E-004f); L10[5, 3] = new ComplexFloat(+1.4574245E-002f, -1.1129242E-003f); L10[5, 4] = new ComplexFloat(-9.0776628E-001f, -3.8281015E-002f); L10[5, 5] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[6, 0] = new ComplexFloat(+1.1163789E-002f, +5.1884795E-003f); L10[6, 1] = new ComplexFloat(+1.1597112E-002f, +3.8999115E-003f); L10[6, 2] = new ComplexFloat(+1.6188452E-002f, +4.4138654E-004f); L10[6, 3] = new ComplexFloat(+1.5752309E-002f, -1.7871732E-003f); L10[6, 4] = new ComplexFloat(+1.4568519E-002f, -5.3100094E-003f); L10[6, 5] = new ComplexFloat(-9.1612446E-001f, -3.9858108E-002f); L10[6, 6] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[7, 0] = new ComplexFloat(+1.2250407E-002f, +5.1493111E-003f); L10[7, 1] = new ComplexFloat(+1.2666180E-002f, +3.7419578E-003f); L10[7, 2] = new ComplexFloat(+1.7480233E-002f, -1.7281679E-004f); L10[7, 3] = new ComplexFloat(+1.6920428E-002f, -2.5592884E-003f); L10[7, 4] = new ComplexFloat(+1.5502251E-002f, -6.3119298E-003f); L10[7, 5] = new ComplexFloat(+1.0175586E-002f, -6.2706520E-003f); L10[7, 6] = new ComplexFloat(-9.2129653E-001f, -4.0086723E-002f); L10[7, 7] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[8, 0] = new ComplexFloat(+1.3361099E-002f, +5.0636594E-003f); L10[8, 1] = new ComplexFloat(+1.3753926E-002f, +3.5354454E-003f); L10[8, 2] = new ComplexFloat(+1.8776835E-002f, -8.5571402E-004f); L10[8, 3] = new ComplexFloat(+1.8083822E-002f, -3.3986502E-003f); L10[8, 4] = new ComplexFloat(+1.6416076E-002f, -7.3767089E-003f); L10[8, 5] = new ComplexFloat(+1.0693868E-002f, -7.1281839E-003f); L10[8, 6] = new ComplexFloat(+8.4803223E-003f, -7.7622936E-003f); L10[8, 7] = new ComplexFloat(-9.2544568E-001f, -3.8329752E-002f); L10[8, 8] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[9, 0] = new ComplexFloat(+1.4514517E-002f, +4.9086455E-003f); L10[9, 1] = new ComplexFloat(+1.4876264E-002f, +3.2557272E-003f); L10[9, 2] = new ComplexFloat(+2.0088847E-002f, -1.6446645E-003f); L10[9, 3] = new ComplexFloat(+1.9247642E-002f, -4.3429207E-003f); L10[9, 4] = new ComplexFloat(+1.7306259E-002f, -8.5413384E-003f); L10[9, 5] = new ComplexFloat(+1.1183742E-002f, -8.0532599E-003f); L10[9, 6] = new ComplexFloat(+8.7870452E-003f, -8.6470170E-003f); L10[9, 7] = new ComplexFloat(+6.7700213E-003f, -5.2124680E-003f); L10[9, 8] = new ComplexFloat(-9.2836000E-001f, -3.8752385E-002f); L10[9, 9] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D10 = new ComplexFloatVector(10); D10[0] = new ComplexFloat(+9.9009901E-002f, -9.9009901E-003f); D10[1] = new ComplexFloat(+6.8010260E-002f, +5.2693294E-002f); D10[2] = new ComplexFloat(+6.8503012E-002f, +5.2264825E-002f); D10[3] = new ComplexFloat(+6.8598237E-002f, +5.1618595E-002f); D10[4] = new ComplexFloat(+6.8466983E-002f, +5.0945485E-002f); D10[5] = new ComplexFloat(+6.8034270E-002f, +5.0441605E-002f); D10[6] = new ComplexFloat(+6.7730052E-002f, +5.0175369E-002f); D10[7] = new ComplexFloat(+6.7391349E-002f, +5.0080104E-002f); D10[8] = new ComplexFloat(+6.7234262E-002f, +4.9912171E-002f); D10[9] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); U10 = new ComplexFloatMatrix(10); U10[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 1] = new ComplexFloat(-1.8811881E-001f, -8.8118812E-001f); U10[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 2] = new ComplexFloat(-3.0868450E-001f, -8.2968120E-001f); U10[1, 2] = new ComplexFloat(+8.1788201E-002f, -1.3059729E-001f); U10[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 3] = new ComplexFloat(-6.9271338E-001f, -4.1101317E-001f); U10[1, 3] = new ComplexFloat(+3.0656677E-001f, -4.4856765E-001f); U10[2, 3] = new ComplexFloat(+7.8629842E-002f, -1.3672690E-001f); U10[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 4] = new ComplexFloat(-7.5308973E-001f, -1.7764936E-001f); U10[1, 4] = new ComplexFloat(-2.1811893E-002f, -2.3257783E-001f); U10[2, 4] = new ComplexFloat(+3.0081682E-001f, -4.5300731E-001f); U10[3, 4] = new ComplexFloat(+7.3373192E-002f, -1.4180544E-001f); U10[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 5] = new ComplexFloat(-6.6968846E-001f, +1.6997563E-001f); U10[1, 5] = new ComplexFloat(-1.4411312E-001f, -3.0897730E-001f); U10[2, 5] = new ComplexFloat(-3.1145914E-002f, -2.3117177E-001f); U10[3, 5] = new ComplexFloat(+2.9376277E-001f, -4.5405633E-001f); U10[4, 5] = new ComplexFloat(+6.6435695E-002f, -1.4363825E-001f); U10[5, 5] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 6] = new ComplexFloat(-3.6546783E-001f, +1.3495818E-001f); U10[1, 6] = new ComplexFloat(-3.3276275E-001f, +6.1455619E-002f); U10[2, 6] = new ComplexFloat(-1.4928934E-001f, -3.0660365E-001f); U10[3, 6] = new ComplexFloat(-3.6720508E-002f, -2.2950990E-001f); U10[4, 6] = new ComplexFloat(+2.8936799E-001f, -4.5408893E-001f); U10[5, 6] = new ComplexFloat(+6.2044535E-002f, -1.4415916E-001f); U10[6, 6] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 7] = new ComplexFloat(-2.2796156E-001f, +2.1789305E-001f); U10[1, 7] = new ComplexFloat(-1.4794186E-001f, -5.5572852E-002f); U10[2, 7] = new ComplexFloat(-3.3492680E-001f, +6.5840476E-002f); U10[3, 7] = new ComplexFloat(-1.5249085E-001f, -3.0276392E-001f); U10[4, 7] = new ComplexFloat(-4.0507028E-002f, -2.2608317E-001f); U10[5, 7] = new ComplexFloat(+2.8587453E-001f, -4.5245103E-001f); U10[6, 7] = new ComplexFloat(+5.8369087E-002f, -1.4290942E-001f); U10[7, 7] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 8] = new ComplexFloat(-1.8901586E-001f, +3.4805079E-002f); U10[1, 8] = new ComplexFloat(-5.2426683E-002f, +1.9340427E-001f); U10[2, 8] = new ComplexFloat(-1.4964696E-001f, -5.4033437E-002f); U10[3, 8] = new ComplexFloat(-3.3763728E-001f, +6.7573088E-002f); U10[4, 8] = new ComplexFloat(-1.5560000E-001f, -3.0169126E-001f); U10[5, 8] = new ComplexFloat(-4.3805054E-002f, -2.2544210E-001f); U10[6, 8] = new ComplexFloat(+2.8335018E-001f, -4.5271747E-001f); U10[7, 8] = new ComplexFloat(+5.5874343E-002f, -1.4345634E-001f); U10[8, 8] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 9] = new ComplexFloat(-1.9701952E-001f, +6.3155749E-002f); U10[1, 9] = new ComplexFloat(-4.2642564E-003f, -1.6090427E-002f); U10[2, 9] = new ComplexFloat(-5.3607239E-002f, +1.9546918E-001f); U10[3, 9] = new ComplexFloat(-1.5130367E-001f, -5.1953666E-002f); U10[4, 9] = new ComplexFloat(-3.4040569E-001f, +7.0063213E-002f); U10[5, 9] = new ComplexFloat(-1.5894822E-001f, -2.9987956E-001f); U10[6, 9] = new ComplexFloat(-4.7450414E-002f, -2.2408765E-001f); U10[7, 9] = new ComplexFloat(+2.8041710E-001f, -4.5254539E-001f); U10[8, 9] = new ComplexFloat(+5.2922147E-002f, -1.4361015E-001f); U10[9, 9] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det10 = new ComplexFloat(+3.6568548E+010f, +2.4768517E+010f); I10 = new ComplexFloatMatrix(10); I10[0, 0] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); I10[0, 1] = new ComplexFloat(+1.0691834E-002f, -6.9924390E-003f); I10[0, 2] = new ComplexFloat(+4.1309398E-002f, -1.6380491E-002f); I10[0, 3] = new ComplexFloat(+7.9682744E-003f, -1.7380034E-002f); I10[0, 4] = new ComplexFloat(+4.2659401E-003f, -2.8007075E-002f); I10[0, 5] = new ComplexFloat(-2.6301184E-002f, -1.2239617E-002f); I10[0, 6] = new ComplexFloat(-7.5562748E-003f, -1.1009683E-002f); I10[0, 7] = new ComplexFloat(-1.3317795E-002f, +1.0434171E-002f); I10[0, 8] = new ComplexFloat(+5.1470750E-004f, -1.2906015E-003f); I10[0, 9] = new ComplexFloat(-1.6347168E-002f, -5.5689657E-003f); I10[1, 0] = new ComplexFloat(-6.0294731E-002f, -4.8784282E-002f); I10[1, 1] = new ComplexFloat(+5.7037418E-002f, +5.5989338E-002f); I10[1, 2] = new ComplexFloat(-2.8067888E-002f, +6.7497836E-003f); I10[1, 3] = new ComplexFloat(+3.3576008E-002f, -4.6936404E-004f); I10[1, 4] = new ComplexFloat(+3.2614353E-003f, +8.4914935E-003f); I10[1, 5] = new ComplexFloat(+2.8539068E-002f, -1.5668319E-002f); I10[1, 6] = new ComplexFloat(-1.9485222E-002f, -1.7952100E-003f); I10[1, 7] = new ComplexFloat(+5.4035811E-003f, -2.0272674E-002f); I10[1, 8] = new ComplexFloat(-1.3705944E-002f, +1.1564861E-002f); I10[1, 9] = new ComplexFloat(+5.1470750E-004f, -1.2906015E-003f); I10[2, 0] = new ComplexFloat(+7.1308213E-004f, -1.2546164E-005f); I10[2, 1] = new ComplexFloat(-6.0272601E-002f, -4.8871146E-002f); I10[2, 2] = new ComplexFloat(+5.7219842E-002f, +5.5680641E-002f); I10[2, 3] = new ComplexFloat(-2.8112753E-002f, +6.6173592E-003f); I10[2, 4] = new ComplexFloat(+3.3454600E-002f, -6.5413224E-004f); I10[2, 5] = new ComplexFloat(+3.0216929E-003f, +8.5724569E-003f); I10[2, 6] = new ComplexFloat(+2.8435161E-002f, -1.5684889E-002f); I10[2, 7] = new ComplexFloat(-1.9514358E-002f, -1.6393606E-003f); I10[2, 8] = new ComplexFloat(+5.4035811E-003f, -2.0272674E-002f); I10[2, 9] = new ComplexFloat(-1.3317795E-002f, +1.0434171E-002f); I10[3, 0] = new ComplexFloat(+1.0191444E-003f, -1.4239535E-004f); I10[3, 1] = new ComplexFloat(+9.9108704E-004f, -2.5251613E-004f); I10[3, 2] = new ComplexFloat(-5.9819166E-002f, -4.9484148E-002f); I10[3, 3] = new ComplexFloat(+5.7389952E-002f, +5.5227507E-002f); I10[3, 4] = new ComplexFloat(-2.8106424E-002f, +6.0757008E-003f); I10[3, 5] = new ComplexFloat(+3.3259014E-002f, -8.2858379E-004f); I10[3, 6] = new ComplexFloat(+2.9250084E-003f, +8.3171088E-003f); I10[3, 7] = new ComplexFloat(+2.8435161E-002f, -1.5684889E-002f); I10[3, 8] = new ComplexFloat(-1.9485222E-002f, -1.7952100E-003f); I10[3, 9] = new ComplexFloat(-7.5562748E-003f, -1.1009683E-002f); I10[4, 0] = new ComplexFloat(+1.1502413E-003f, +1.6639121E-005f); I10[4, 1] = new ComplexFloat(+1.1380402E-003f, -1.0980979E-004f); I10[4, 2] = new ComplexFloat(+1.3977289E-003f, -5.8000250E-004f); I10[4, 3] = new ComplexFloat(-5.9700112E-002f, -4.9533948E-002f); I10[4, 4] = new ComplexFloat(+5.7405368E-002f, +5.5059022E-002f); I10[4, 5] = new ComplexFloat(-2.8274330E-002f, +6.2766221E-003f); I10[4, 6] = new ComplexFloat(+3.3259014E-002f, -8.2858379E-004f); I10[4, 7] = new ComplexFloat(+3.0216929E-003f, +8.5724569E-003f); I10[4, 8] = new ComplexFloat(+2.8539068E-002f, -1.5668319E-002f); I10[4, 9] = new ComplexFloat(-2.6301184E-002f, -1.2239617E-002f); I10[5, 0] = new ComplexFloat(+1.5848813E-003f, +2.8852793E-004f); I10[5, 1] = new ComplexFloat(+1.5972212E-003f, +1.1105891E-004f); I10[5, 2] = new ComplexFloat(+2.0644546E-003f, -4.7842310E-004f); I10[5, 3] = new ComplexFloat(+1.9356717E-003f, -7.4622243E-004f); I10[5, 4] = new ComplexFloat(-5.9306111E-002f, -4.9933722E-002f); I10[5, 5] = new ComplexFloat(+5.7405368E-002f, +5.5059022E-002f); I10[5, 6] = new ComplexFloat(-2.8106424E-002f, +6.0757008E-003f); I10[5, 7] = new ComplexFloat(+3.3454600E-002f, -6.5413224E-004f); I10[5, 8] = new ComplexFloat(+3.2614353E-003f, +8.4914935E-003f); I10[5, 9] = new ComplexFloat(+4.2659401E-003f, -2.8007075E-002f); I10[6, 0] = new ComplexFloat(+1.5061253E-003f, +6.6650996E-004f); I10[6, 1] = new ComplexFloat(+1.5609115E-003f, +4.9307536E-004f); I10[6, 2] = new ComplexFloat(+2.1665459E-003f, +1.9121555E-005f); I10[6, 3] = new ComplexFloat(+2.1027094E-003f, -2.7790747E-004f); I10[6, 4] = new ComplexFloat(+1.9356717E-003f, -7.4622243E-004f); I10[6, 5] = new ComplexFloat(-5.9700112E-002f, -4.9533948E-002f); I10[6, 6] = new ComplexFloat(+5.7389952E-002f, +5.5227507E-002f); I10[6, 7] = new ComplexFloat(-2.8112753E-002f, +6.6173592E-003f); I10[6, 8] = new ComplexFloat(+3.3576008E-002f, -4.6936404E-004f); I10[6, 9] = new ComplexFloat(+7.9682744E-003f, -1.7380034E-002f); I10[7, 0] = new ComplexFloat(+1.4282653E-003f, +8.8920966E-004f); I10[7, 1] = new ComplexFloat(+1.5084436E-003f, +7.2160481E-004f); I10[7, 2] = new ComplexFloat(+2.1887064E-003f, +3.2867753E-004f); I10[7, 3] = new ComplexFloat(+2.1665459E-003f, +1.9121555E-005f); I10[7, 4] = new ComplexFloat(+2.0644546E-003f, -4.7842310E-004f); I10[7, 5] = new ComplexFloat(+1.3977289E-003f, -5.8000250E-004f); I10[7, 6] = new ComplexFloat(-5.9819166E-002f, -4.9484148E-002f); I10[7, 7] = new ComplexFloat(+5.7219842E-002f, +5.5680641E-002f); I10[7, 8] = new ComplexFloat(-2.8067888E-002f, +6.7497836E-003f); I10[7, 9] = new ComplexFloat(+4.1309398E-002f, -1.6380491E-002f); I10[8, 0] = new ComplexFloat(+8.3509562E-004f, +9.5832342E-004f); I10[8, 1] = new ComplexFloat(+9.3009336E-004f, +8.5497971E-004f); I10[8, 2] = new ComplexFloat(+1.5084436E-003f, +7.2160481E-004f); I10[8, 3] = new ComplexFloat(+1.5609115E-003f, +4.9307536E-004f); I10[8, 4] = new ComplexFloat(+1.5972212E-003f, +1.1105891E-004f); I10[8, 5] = new ComplexFloat(+1.1380402E-003f, -1.0980979E-004f); I10[8, 6] = new ComplexFloat(+9.9108704E-004f, -2.5251613E-004f); I10[8, 7] = new ComplexFloat(-6.0272601E-002f, -4.8871146E-002f); I10[8, 8] = new ComplexFloat(+5.7037418E-002f, +5.5989338E-002f); I10[8, 9] = new ComplexFloat(+1.0691834E-002f, -6.9924390E-003f); I10[9, 0] = new ComplexFloat(+7.2861524E-004f, +1.0511118E-003f); I10[9, 1] = new ComplexFloat(+8.3509562E-004f, +9.5832342E-004f); I10[9, 2] = new ComplexFloat(+1.4282653E-003f, +8.8920966E-004f); I10[9, 3] = new ComplexFloat(+1.5061253E-003f, +6.6650996E-004f); I10[9, 4] = new ComplexFloat(+1.5848813E-003f, +2.8852793E-004f); I10[9, 5] = new ComplexFloat(+1.1502413E-003f, +1.6639121E-005f); I10[9, 6] = new ComplexFloat(+1.0191444E-003f, -1.4239535E-004f); I10[9, 7] = new ComplexFloat(+7.1308213E-004f, -1.2546164E-005f); I10[9, 8] = new ComplexFloat(-6.0294731E-002f, -4.8784282E-002f); I10[9, 9] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); X10 = new ComplexFloatVector(10); X10[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X10[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X10[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X10[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); X10[4] = new ComplexFloat(+5.0000000E+000f, +0.0000000E+000f); X10[5] = new ComplexFloat(+6.0000000E+000f, +0.0000000E+000f); X10[6] = new ComplexFloat(+7.0000000E+000f, +0.0000000E+000f); X10[7] = new ComplexFloat(+8.0000000E+000f, +0.0000000E+000f); X10[8] = new ComplexFloat(+9.0000000E+000f, +0.0000000E+000f); X10[9] = new ComplexFloat(+1.0000000E+001f, +0.0000000E+000f); Y10 = new ComplexFloatVector(10); Y10[0] = new ComplexFloat(+6.4000000E+001f, +1.4200000E+002f); Y10[1] = new ComplexFloat(+8.1000000E+001f, +1.6400000E+002f); Y10[2] = new ComplexFloat(+1.0500000E+002f, +1.7500000E+002f); Y10[3] = new ComplexFloat(+1.3500000E+002f, +1.7400000E+002f); Y10[4] = new ComplexFloat(+1.7000000E+002f, +1.6000000E+002f); Y10[5] = new ComplexFloat(+2.0900000E+002f, +1.7600000E+002f); Y10[6] = new ComplexFloat(+2.5100000E+002f, +1.9200000E+002f); Y10[7] = new ComplexFloat(+2.9500000E+002f, +1.9700000E+002f); Y10[8] = new ComplexFloat(+3.4000000E+002f, +1.3500000E+002f); Y10[9] = new ComplexFloat(+3.8500000E+002f, +5.5000000E+001f); // Tolerances Tolerance1 = 1.000E-06f; Tolerance2 = 2.000E-06f; Tolerance3 = 1.000E-06f; Tolerance4 = 1.000E-05f; Tolerance5 = 1.000E-05f; Tolerance10 = 5.000E-05f; }
/// <summary> /// Create a complex number based on an existing complex number /// </summary> /// <param name="c"></param> public ComplexFloat(ComplexFloat c) { this.Re = c.Re; this.Im = c.Im; }