commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Barnhill <>
Subject [MATH] ComplexUtils pull request; some future proposals
Date Wed, 28 Oct 2015 16:33:54 GMT
Dear all,

Thanks for the feedback on ComplexUtils and I have submitted a pull request
with the edits.

I have added functionality to convert between Complex arrays and real
double, real float, interleaved double, interleaved float, split double
(one real, one imag) and split float arrays. Per Gilles' suggestion I have
included the use of IntegerSequence.range() arguments and the methods
mostly refer to workhorse Extract() methods. I also added a method to
initialize Complex[] arrays to all zeros, to avoid null pointer exceptions.

I have also updated ComplexUtilsTest to include JUnit tests of every
method, which all pass. I had to define many arrays to run the tests and
hopefully the comments make the purpose of each clear. I was not entirely
clear how to use the tolerance parameter and submitted ulp each time, so
contact me if I should do something else.

I am using nearly all of these methods in the medical imaging library I am
working on so I don't think I overdid it.

Repeating the methods for different types, so many times, got me to
thinking about the overall structure of arrays in math functions and what I
would most like to see. So in my own library I am creating a MathArray
superclass. This in turn can be Complex, real, split, or interleaved, and
contain any type of primitive, kind of like the ImageJ ImageProcessor
interface This will allow every method I have put in ComplexUtils, and many
more I keep in other libraries, to be written only once for the superclass.
Further the superclass will have a full range of math methods that operate
on arrays element wise, enabling syntax approaching Matlab to be used for
arrays that is basically the same as what is already in place for Complex
objects, i.e. commands like

If this is of interest to the community I can submit a pull request when
I've got it worked up. If someone has already designed such a library I'd
be grateful if someone mentions it before I get started.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message