summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/math
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
commitdf94066e3af02ff02d5ab4d033a3d603f743234c (patch)
tree168a1edaf58d386c175ffb601e9d4da8e13d31e2 /base/src/main/java/bjc/utils/math
parentae51c587c53f7ca311e556e3cbd0c5566d6c2843 (diff)
Formatting pass
Diffstat (limited to 'base/src/main/java/bjc/utils/math')
-rw-r--r--base/src/main/java/bjc/utils/math/Dual.java159
1 files changed, 77 insertions, 82 deletions
diff --git a/base/src/main/java/bjc/utils/math/Dual.java b/base/src/main/java/bjc/utils/math/Dual.java
index 53ddc32..e571519 100644
--- a/base/src/main/java/bjc/utils/math/Dual.java
+++ b/base/src/main/java/bjc/utils/math/Dual.java
@@ -1,83 +1,78 @@
-package bjc.utils.math;
-
-/**
- * Represents a 'dual' number.
- *
- * Think imaginary numbers, where instead of i, we add a value d such that d^2 =
- * 0.
- */
-public class Dual {
- /**
- * The real part of the dual number.
- */
- public double real;
- /**
- * The dual part of the dual number.
- */
- public double dual;
-
- /**
- * Create a new dual with both parts zero.
- */
- public Dual() {
- real = 0;
- dual = 0;
- }
-
- /**
- * Create a new dual number with a zero dual part.
- *
- * @param real
- * The real part of the number.
- */
- public Dual(double real) {
- this.real = real;
- this.dual = 0;
- }
-
- /**
- * Create a new dual number with a specified dual part.
- *
- * @param real
- * The real part of the number.
- * @param dual
- * The dual part of the number.
- */
- public Dual(double real, double dual) {
- this.real = real;
- this.dual = dual;
- }
-
- @Override
- public String toString() {
- return String.format("<%f, %f>", real, dual);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(dual);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(real);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Dual other = (Dual) obj;
- if (Double.doubleToLongBits(dual) != Double.doubleToLongBits(other.dual))
- return false;
- if (Double.doubleToLongBits(real) != Double.doubleToLongBits(other.real))
- return false;
- return true;
- }
+package bjc.utils.math;
+
+/**
+ * Represents a 'dual' number.
+ *
+ * Think imaginary numbers, where instead of i, we add a value d such that d^2 =
+ * 0.
+ */
+public class Dual {
+ /**
+ * The real part of the dual number.
+ */
+ public double real;
+ /**
+ * The dual part of the dual number.
+ */
+ public double dual;
+
+ /**
+ * Create a new dual with both parts zero.
+ */
+ public Dual() {
+ real = 0;
+ dual = 0;
+ }
+
+ /**
+ * Create a new dual number with a zero dual part.
+ *
+ * @param real
+ * The real part of the number.
+ */
+ public Dual(double real) {
+ this.real = real;
+ this.dual = 0;
+ }
+
+ /**
+ * Create a new dual number with a specified dual part.
+ *
+ * @param real
+ * The real part of the number.
+ * @param dual
+ * The dual part of the number.
+ */
+ public Dual(double real, double dual) {
+ this.real = real;
+ this.dual = dual;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("<%f, %f>", real, dual);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(dual);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(real);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(getClass() != obj.getClass()) return false;
+ Dual other = (Dual) obj;
+ if(Double.doubleToLongBits(dual) != Double.doubleToLongBits(other.dual)) return false;
+ if(Double.doubleToLongBits(real) != Double.doubleToLongBits(other.real)) return false;
+ return true;
+ }
} \ No newline at end of file