Class Complex

java.lang.Object
org.openscience.cdk.math.Complex

public class Complex extends Object
This class handles complex values.
Belongs to CDK module:
qm
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The imaginary part of this value
    double
    The real part of this value
  • Constructor Summary

    Constructors
    Constructor
    Description
    Complex(double real, double imag)
    Creates a complex number
    Creates a copy of a complex object
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a complex value
    void
    Div this value by a complex value
    double
    Gets the imaginary part of this value
    double
    Gets the real part of this complex value
    void
    Multiply this value with a complex value
    void
    setImaginaryPart(double imag)
    Sets the imaginary part of this value
    void
    setRealPart(double real)
    Sets the real part of this complex value
    void
    Subtracs a complex value
    Create a string of the content of this class

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • real

      public double real
      The real part of this value
    • imag

      public double imag
      The imaginary part of this value
  • Constructor Details

    • Complex

      public Complex(double real, double imag)
      Creates a complex number
      Parameters:
      real - the real part
      imag - the imaginary part
    • Complex

      public Complex(Complex c)
      Creates a copy of a complex object
  • Method Details

    • setRealPart

      public void setRealPart(double real)
      Sets the real part of this complex value
    • getRealPart

      public double getRealPart()
      Gets the real part of this complex value
    • setImaginaryPart

      public void setImaginaryPart(double imag)
      Sets the imaginary part of this value
    • getImaginaryPart

      public double getImaginaryPart()
      Gets the imaginary part of this value
    • add

      public void add(Complex c)
      Add a complex value
    • sub

      public void sub(Complex c)
      Subtracs a complex value
    • mul

      public void mul(Complex c)
      Multiply this value with a complex value
    • div

      public void div(Complex c)
      Div this value by a complex value
    • toString

      public String toString()
      Create a string of the content of this class
      Overrides:
      toString in class Object