forked from arrayfire/arrayfire-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloatComplex.java
More file actions
44 lines (33 loc) · 773 Bytes
/
FloatComplex.java
File metadata and controls
44 lines (33 loc) · 773 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 FloatComplex {
private float real;
private float imag;
public float real() {
return real;
}
public float imag() {
return imag;
}
public void set(float re, float im) {
real = re;
imag = im;
}
public void setReal(float re) {
real = re;
}
public void setImag(float im) {
imag = im;
}
public FloatComplex(float re, float im) {
set(re, im);
}
public FloatComplex() {
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";
}
}