forked from arrayfire/arrayfire-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoubleComplex.java
More file actions
44 lines (33 loc) · 786 Bytes
/
DoubleComplex.java
File metadata and controls
44 lines (33 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.arrayfire;
public class DoubleComplex {
private double real;
private double imag;
public double real() {
return real;
}
public double imag() {
return imag;
}
public void set(double re, double im) {
real = re;
imag = im;
}
public void setReal(double re) {
real = re;
}
public void setImag(double im) {
imag = im;
}
public DoubleComplex(double re, double im) {
set(re, im);
}
public DoubleComplex() {
set(0, 0);
}
public String toString() {
String str = String.valueOf(real);
if (imag < 0) str = str + " - ";
else str = str + " + ";
return str + String.valueOf(Math.abs(imag)) + "i";
}
}