commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject Re: [math] Complex dilemmas
Date Thu, 05 Jun 2003 13:20:26 GMT
Al Chou wrote:
> --- 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.
>>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?

Well, I suppose that I could submit the code....Will do if we get past 
the next issue.

> 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.

This is a very good question and one that we should *always* ask.  I 
have to confess that I have used "my" implementation only for 
mathematical applications.  I know that there are direct engineering 
applications, but I frankly do not know how common they are in the "real 

It is also troubling that the VNI implementation started out as the 
reference implementation for a JSR that never went anywhere and it is 
clear from this:
which dates back to dec 2000, that Sun has looked carefully at providing 
direct support in the language, but concluded that it is not worth the 

Given that it will be a fair amount of work to get a numerically sound 
C9x compliant implementation together (what I have now does not 
implement the transcendental functions at all and does not comply fully 
with C9x), I propose that we drop this from our goals for initial 
release.  If people really want direct support for complex numbers, we 
can bring them in to a subsequent release.

> 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?
> Al
> =====
> 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:

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

View raw message