summaryrefslogtreecommitdiff
path: root/test/files/specialized/fft.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-18 00:09:46 -0700
committerPaul Phillips <paulp@improving.org>2013-09-18 07:13:38 -0700
commitf4267ccd96a9143c910c66a5b0436aaa64b7c9dc (patch)
tree174861715807c23ba332f78769a9f7e1377b7f02 /test/files/specialized/fft.scala
parentd45a3c8cc8e9f1d95d797d548a85abd8597f5bc7 (diff)
downloadscala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.gz
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.bz2
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.zip
Cull extraneous whitespace.
One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
Diffstat (limited to 'test/files/specialized/fft.scala')
-rw-r--r--test/files/specialized/fft.scala26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/files/specialized/fft.scala b/test/files/specialized/fft.scala
index 62a6a2abb9..76029832a9 100644
--- a/test/files/specialized/fft.scala
+++ b/test/files/specialized/fft.scala
@@ -1,13 +1,13 @@
/*
* http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/dft/
- Modification of Paul Bourkes FFT code by Peter Cusack
+ Modification of Paul Bourkes FFT code by Peter Cusack
to utilise the Microsoft complex type.
- This computes an in-place complex-to-complex FFT
+ This computes an in-place complex-to-complex FFT
x and y are the real and imaginary arrays of 2^m points.
dir = 1 gives forward transform
- dir = -1 gives reverse transform
+ dir = -1 gives reverse transform
*/
import Math.{sqrt, pow}
@@ -24,19 +24,19 @@ object Test {
x(j) = tmp
}
- def times(x: Complex, y: Complex): Complex =
+ def times(x: Complex, y: Complex): Complex =
(x._1 * y._1 - x._2 * y._2, x._1 * y._2 + x._2 * y._1)
-
+
def div(x: Complex, y: Complex): Complex = {
val num = pow(y._1, 2) + pow(y._2, 2)
((x._1 * y._1 + x._2 * y._2)/num,
(x._2 * y._1 - x._1 * y._2)/num)
}
- def div(x: Complex, y: Long) =
+ def div(x: Complex, y: Long) =
(x._1 / y, x._2 / y)
- def add(x: Complex, y: Complex) =
+ def add(x: Complex, y: Complex) =
(x._1 + y._1, x._2 + y._2)
def minus(x: Complex, y: Complex) =
@@ -49,8 +49,8 @@ object Test {
/*Calculate the number of points */
n = 1
- for (i <- 0l until m)
- n <<= 1
+ for (i <- 0l until m)
+ n <<= 1
/* Do the bit reversal */
i2 = n >> 1
@@ -86,7 +86,7 @@ object Test {
for (i <- j.until(n, l2)) {
i1 = i + l1;
t1 = times(u, x(i1.toInt))
- x(i1.toInt) = minus(x(i.toInt), t1)
+ x(i1.toInt) = minus(x(i.toInt), t1)
x(i.toInt) = add(x(i.toInt), t1)
}
@@ -97,7 +97,7 @@ object Test {
c = (c._1, sqrt( (1.0 - c._1) / 2.0 ))
// if (dir == 1)
// c.imag(-c.imag());
- if (dir == 1)
+ if (dir == 1)
c = (c._1, -c._2)
// c.real(sqrt((1.0 + c.real()) / 2.0));
@@ -107,8 +107,8 @@ object Test {
/* Scaling for forward transform */
if (dir == 1) {
for (i <- 0l until n)
- x(i.toInt) = div(x(i.toInt), n)
- }
+ x(i.toInt) = div(x(i.toInt), n)
+ }
}
def run() {