commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Chou <>
Subject Re: [math] Complex dilemmas
Date Thu, 05 Jun 2003 07:11:57 GMT
--- Phil Steitz <> wrote:
> I had planned to submit "my" Complex classes as part of the iniital 
> submission and I have been tearing this stuff apart and putting it back 
> together again for the past several weeks,adding layers of abstraction 
> and then tearing them away,  never quite ending in a satisfied state.
> So.. I am asking for a little help.
> Here are the decisions that I would like to confirm/discuss:
> 1. Complex is a concrete, immutable class.  The only methods belonging 
> to Complex itself are things that it makes sense to apply to a single 
> Complex number -- e.g., arg, modulus, re, im, etc.
> 2. Imaginary is a concrete, immutable class.  It's raison d'etre is to 
> support more efficient, more accurate and in some cases more natural 
> computations when dealing with complex numbers with no real parts.
> 3. ComplexUtils is a collection of static methods supporting 
> mathematical operations involving Complex, Imaginary and Double operands 
> -- e.g., plus(Complex,Complex), plus(Complex,Imaginary), 
> plus(Complex,double), etc.
> 4. All use C9x Annex G:IEC 559-compatible complex arithmetic for 
> arithmetic operations / infinity/NaN semantics/branch cuts/topolog, as 
> defined here
> 5. ExpandableComplexArray is an array class with "in place" operations 
> supported by ComplexUtils -- things like
> times: (ExpandableComplexArray,int,Complex) |-> Complex or
> times: (ExpandableComplexArray,Complex) |-> ExpandableComplexArray
> To put this in perspective vis a vis the other stuff out there, here are 
> some comparisons/observiations:
> The existing library that I like the most is Visual Numerics
> This one class combines Complex, ComplexUtils and Imaginary above. It 
> also implements the C9x Annex G value semantics. The mathematical scope 
> of the methods defined there is roughly equivalent to what I have in 
> mind (really just what is in the C spec), though I would drop a few 
> things, pull the operations out into ComplexUtils, add proj to support 
> spherical semantics (as defined here: 
> and add 
> the Imaginary and ExpandableComplexArray classes.
> Colt 
> is very similar to VNI.  Most importantly, it advertises the same C9x 
> Annex G value semantics.

And no wonder, Colt includes VNI according to .

> So...from a functionality and computational semantics standpoint, it 
> seems clear that implementing the basic C9x function set with signed 
> zero and the Annex G semantics is the right thing to do.  This will keep 
> us interoperable with and allow easy migration from VNI or Colt.
> What I need help confirming is the organization of the classes above. 
> Please remember that these things will be used in computationally 
> intense scenarios embedded in complex code. We need the syntax to be as 
> simple as possible and the level of indirection to be minimal.

>From what you've described so far, it sounds pretty good.  Is there a way you
can provide more specifics, such as via a Web page?

One question that comes to mind is:  "What problems does having complex
mathematics solve?"  Basically I am wondering whether we should consider how or
even if real-world users would employ these facilities before going through the
exercise of getting them right.

A side question:  even if Java permitted operator overloading, I have read
comments to the effect that the technique is not to be preferred.  Never having
done much with it in a language that permits it, I don't have the experience to
know why.  As someone who thinks mathematically (at least at times), operator
overloading seems like the most natural thing to do to preserve the semantics
I'm accustomed to among number systems that contain one another (a seemingly
very natural inheritance hierarchy).  Can anyone out there explain why operator
overloading might be considered bad?


Albert Davidson Chou

    Get answers to Mac questions at .

Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message