Efficient and elegant complex numbers are one of the preconditions for the use of Java in scientific computing. This paper introduces a preprocessor and its translation rules that map a new basic type complex and its operations to pure Java. For the mapping it is insufficient to just replace one complex-variable with two double.-variables. Compared to code that uses Complex objects and method invocations to express arithmetic operations, the new basic type increases readability and it is also executed faster. On average, the versions of our benchmark programs that use the basic type outperform the class-based versions by a factor of 2 up to 21 (depending on the JVM used). Copyright © 2000 John Wiley & Sons, Ltd.
[1]
Samuel P. Midkiff,et al.
Efficient support for complex numbers in Java
,
1999,
JAVA '99.
[2]
Samuel P. Midkiff,et al.
Fortran 90 in CSE: a case study
,
1998
.
[3]
Guy L. Steele,et al.
Growing a Language
,
1999,
High. Order Symb. Comput..
[4]
George K. Thiruvathukal.
Java Grande Forum Report: Making Java Work for High-End Computing
,
1998
.
[5]
Martin Odersky,et al.
Making the future safe for the past: adding genericity to the Java programming language
,
1998,
OOPSLA '98.
[6]
William Kahan,et al.
Augmenting a Programming Language with Complex Arithmetic
,
1991
.