Complex
Inheritance: java.lang.Object, com.aspose.ms.System.ValueType, com.aspose.ms.lang.Struct
All Implemented Interfaces: com.aspose.ms.System.IEquatable
public class Complex extends Struct<Complex> implements System.IEquatable<Complex>
The complex number structure.
Constructors
Constructor | Description |
---|---|
Complex() | |
Complex(double real, double imaginary) | Initializes a new instance of the Complex struct. |
Complex(Complex c) | Initializes a new instance of the Complex struct. |
Fields
Field | Description |
---|---|
SIZE_OF_DOUBLE | The size of double . |
SIZE_OF_COMPLEX | The size of complex. |
ZERO | Zero complex. |
ONE | One complex having Re (.getRe/.setRe(double)) and Im (.getIm/.setIm(double)) equal to 1. |
I | I complex having Im (.getIm/.setIm(double)) equal to 1. |
Methods
Complex()
public Complex()
Complex(double real, double imaginary)
public Complex(double real, double imaginary)
Initializes a new instance of the Complex struct.
Parameters:
Parameter | Type | Description |
---|---|---|
real | double | The real part. |
imaginary | double | The imaginary part. |
Complex(Complex c)
public Complex(Complex c)
Initializes a new instance of the Complex struct.
Parameters:
Parameter | Type | Description |
---|---|---|
c | Complex | The complex number. |
SIZE_OF_DOUBLE
public static final int SIZE_OF_DOUBLE
The size of double
.
SIZE_OF_COMPLEX
public static final int SIZE_OF_COMPLEX
The size of complex.
ZERO
public static final Complex ZERO
Zero complex.
ONE
public static final Complex ONE
One complex having Re
(.getRe/.setRe(double)) and Im
(.getIm/.setIm(double)) equal to 1.
I
public static final Complex I
I complex having Im
(.getIm/.setIm(double)) equal to 1.
to_Complex(double value)
public static Complex to_Complex(double value)
Performs an explicit conversion from double
to Complex.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | The value. |
Returns: Complex - The result of the conversion.
to_Complex(float value)
public static Complex to_Complex(float value)
Performs an explicit conversion from float
to Complex.
Parameters:
Parameter | Type | Description |
---|---|---|
value | float | The value. |
Returns: Complex - The result of the conversion.
op_Equality(Complex a, Complex b)
public static boolean op_Equality(Complex a, Complex b)
Implements the operator ==.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: boolean - The result of the operator.
op_Inequality(Complex a, Complex b)
public static boolean op_Inequality(Complex a, Complex b)
Implements the operator !=.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: boolean - The result of the operator.
op_UnaryNegation(Complex a)
public static Complex op_UnaryNegation(Complex a)
Implements the operator -.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns: Complex - The result of the operator.
op_Addition(Complex a, Complex b)
public static Complex op_Addition(Complex a, Complex b)
Implements the operator +.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of the operator.
op_Addition(Complex a, double s)
public static Complex op_Addition(Complex a, double s)
Implements the operator +.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of the operator.
op_Addition(double s, Complex a)
public static Complex op_Addition(double s, Complex a)
Implements the operator +.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of the operator.
op_Subtraction(Complex a, Complex b)
public static Complex op_Subtraction(Complex a, Complex b)
Implements the operator -.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of the operator.
op_Subtraction(Complex a, double s)
public static Complex op_Subtraction(Complex a, double s)
Implements the operator -.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of the operator.
op_Subtraction(double s, Complex a)
public static Complex op_Subtraction(double s, Complex a)
Implements the operator -.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of the operator.
op_Multiply(Complex a, Complex b)
public static Complex op_Multiply(Complex a, Complex b)
Implements the operator *.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of the operator.
op_Multiply(double s, Complex a)
public static Complex op_Multiply(double s, Complex a)
Implements the operator *.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of the operator.
op_Multiply(Complex a, double s)
public static Complex op_Multiply(Complex a, double s)
Implements the operator *.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of the operator.
op_Division(Complex a, Complex b)
public static Complex op_Division(Complex a, Complex b)
Implements the operator /.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of the operator.
op_Division(Complex a, double s)
public static Complex op_Division(Complex a, double s)
Implements the operator /.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of the operator.
op_Division(double s, Complex a)
public static Complex op_Division(double s, Complex a)
Implements the operator /.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of the operator.
add(Complex a, Complex b)
public static Complex add(Complex a, Complex b)
Adds a
and b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The sum complex.
add(Complex a, double s)
public static Complex add(Complex a, double s)
Adds a
and s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns:
Complex - The complex with its Re increased by s
.
add(Complex a, Complex b, Complex[] result)
public static void add(Complex a, Complex b, Complex[] result)
Adds a
and b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
result | Complex[] | The result. |
add(Complex a, double s, Complex[] result)
public static void add(Complex a, double s, Complex[] result)
Adds a
and s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
result | Complex[] | The result. |
subtract(Complex a, Complex b)
public static Complex subtract(Complex a, Complex b)
Subtracts b
from a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of subtraction.
subtract(Complex a, double s)
public static Complex subtract(Complex a, double s)
Subtracts s
from a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of subtraction.
subtract(double s, Complex a)
public static Complex subtract(double s, Complex a)
Subtracts s
from a
.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of subtraction.
subtract(Complex a, Complex b, Complex[] result)
public static void subtract(Complex a, Complex b, Complex[] result)
Subtracts b
from a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
result | Complex[] | The result. |
subtract(Complex a, double s, Complex[] result)
public static void subtract(Complex a, double s, Complex[] result)
Subtracts s
from a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
result | Complex[] | The result. |
subtract(double s, Complex a, Complex[] result)
public static void subtract(double s, Complex a, Complex[] result)
Subtracts a
from s
.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
result | Complex[] | The result. |
multiply(Complex a, Complex b)
public static Complex multiply(Complex a, Complex b)
Multiplies a
by b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of multiplication.
multiply(Complex a, double s)
public static Complex multiply(Complex a, double s)
Multiplies a
by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of multiplication.
multiply(Complex a, Complex b, Complex[] result)
public static void multiply(Complex a, Complex b, Complex[] result)
Multiplies a
by b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
result | Complex[] | The result. |
multiply(Complex a, double s, Complex[] result)
public static void multiply(Complex a, double s, Complex[] result)
Multiplies a
by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
result | Complex[] | The result. |
divide(Complex a, Complex b)
public static Complex divide(Complex a, Complex b)
Divides a
by b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: Complex - The result of division.
divide(Complex a, double s)
public static Complex divide(Complex a, double s)
Divides a
by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
Returns: Complex - The result of division.
divide(double s, Complex a)
public static Complex divide(double s, Complex a)
Divides a
by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
Returns: Complex - The result of division.
divide(Complex a, Complex b, Complex[] result)
public static void divide(Complex a, Complex b, Complex[] result)
Divides a
by b
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
result | Complex[] | The result. |
divide(Complex a, double s, Complex[] result)
public static void divide(Complex a, double s, Complex[] result)
Divides a
by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
s | double | The s value. |
result | Complex[] | The result. |
divide(double s, Complex a, Complex[] result)
public static void divide(double s, Complex a, Complex[] result)
Divides s
by a
.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
a | Complex | The “a” complex. |
result | Complex[] | The result. |
negate(Complex a)
public static Complex negate(Complex a)
Negates a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns: Complex - The result of negation.
approxEqual(Complex a, Complex b)
public static boolean approxEqual(Complex a, Complex b)
Checks approximate equality.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
Returns: boolean - The approximate equality result.
approxEqual(Complex a, Complex b, double tolerance)
public static boolean approxEqual(Complex a, Complex b, double tolerance)
Checks approximate equality.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
b | Complex | The b complex. |
tolerance | double | The tolerance. |
Returns: boolean - The approximate equality result.
parse(String s)
public static Complex parse(String s)
Parses the specified s
into a Complex.
Parameters:
Parameter | Type | Description |
---|---|---|
s | java.lang.String | The s value. |
Returns: Complex - The complex number.
tryParse(String s, Complex[] result)
public static boolean tryParse(String s, Complex[] result)
Tries to parse the specified s
into a Complex.
Parameters:
Parameter | Type | Description |
---|---|---|
s | java.lang.String | The s value. |
result | Complex[] | The result. |
Returns: boolean - True, if the complex number is parsed.
sqrt(Complex a)
public static Complex sqrt(Complex a)
Gets square root of a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns: Complex - The square root.
log(Complex a)
public static Complex log(Complex a)
Gets log of a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns:
Complex - The log of a
.
exp(Complex a)
public static Complex exp(Complex a)
Raises e by a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns:
Complex - e raised by a
.
sin(Complex a)
public static Complex sin(Complex a)
Gets Sin of a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns:
Complex - Sin of a
.
cos(Complex a)
public static Complex cos(Complex a)
Gets Cos of a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns:
Complex - Cos of a
.
tan(Complex a)
public static Complex tan(Complex a)
Gets Tan of a
.
Parameters:
Parameter | Type | Description |
---|---|---|
a | Complex | The “a” complex. |
Returns:
Complex - Tan of a
.
isEquals(Complex obj1, Complex obj2)
public static boolean isEquals(Complex obj1, Complex obj2)
Parameters:
Parameter | Type | Description |
---|---|---|
obj1 | Complex | |
obj2 | Complex |
Returns: boolean
multiply_internalize(double s)
public Complex multiply_internalize(double s)
Multiplies by s
.
Parameters:
Parameter | Type | Description |
---|---|---|
s | double | The s value. |
Returns: Complex - The result of multiplication.
getRe()
public final double getRe()
Gets the real part.
Returns: double - the real part.
setRe(double value)
public final void setRe(double value)
Sets the real part.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | the real part. |
getIm()
public final double getIm()
Gets the imaginary part.
Returns: double - the imaginary part.
setIm(double value)
public final void setIm(double value)
Sets the imaginary part.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | the imaginary part. |
set(double re, double im)
public final Complex set(double re, double im)
Sets the values and returns itself.
Parameters:
Parameter | Type | Description |
---|---|---|
re | double | The Re value. |
im | double | The Im value. |
Returns: Complex - The object itself.
getMagnitude()
public final double getMagnitude()
Gets the magnitude.
Value: The magnitude.
Returns: double - the magnitude.
getPhase()
public final double getPhase()
Gets the phase.
Value: The phase.
Returns: double - the phase.
getSquaredMagnitude()
public final double getSquaredMagnitude()
Gets the squared magnitude.
Value: The squared magnitude.
Returns: double - the squared magnitude.
hashCode()
public int hashCode()
Returns a hash code for this instance.
Returns: int - A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
equals(Object obj)
public boolean equals(Object obj)
Determines whether the specified Object
, is equal to this instance.
Parameters:
Parameter | Type | Description |
---|---|---|
obj | java.lang.Object | The Object to compare with this instance. |
Returns:
boolean - true
if the specified Object
is equal to this instance; otherwise, false
.
toString()
public String toString()
Returns a String that represents this instance.
Returns: java.lang.String - A String that represents this instance.
deepClone()
public final Complex deepClone()
Clones this instance.
Returns: Complex - A clone of this complex.
CloneTo(Complex that)
public void CloneTo(Complex that)
Parameters:
Parameter | Type | Description |
---|---|---|
that | Complex |
Clone()
public Complex Clone()
Returns: Complex