Hello. Le dim. 13 mars 2022 à 02:08, Sumanth Rajkumar <rajkumar.suma...@gmail.com> a écrit : > > SUBJECT: A proposal for Commons numbers (NUMBERS-186) > > Hi Alex, > > I am Sumanth and new to Open source development. I would like to start by > participating in GSOC 22. > > I came across your NUMBERS-186 GSOC mini project idea and took an initial > stab at it
Thanks for your interest. > > If I understand the wish list correctly, we need to implement an efficient > Complex List collection that supports all operations defined in the Complex > class > > In my first attempt, I have implemented a ComplexList that is backed by two > primitive double arrays for real and imaginary parts. The backing arrays > grow as needed similar to the ArrayList<Complex> implementation and > supports all operations of the List<Complex> interface > > I have added methods for operations from the Complex class with the > following variations for each operation > a) Operation for a single complex number at given index > b) Operation for range of complex numbers with startIndex and length > > ComplexList applies all the operations in place modifying the backing > arrays as per the requirement. I have also added support for an > ImmutableComplexList that returns a copy of the List for each of the > operations. Preliminary remarks/questions: * In this project, we avoid "import static". * What is the purpose of having "protected" methods/fields? * "final" should be used to declare every constant. > > My partial implementation (with TODOs for many operations) is available > here. > https://github.com/sumanth-rajkumar/commons-numbers/blob/sumanth-gsoc-22/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexList.java The many "TODO" methods should be left out to ease review. [Better than having to wonder about code that looks (hopefully temporarily) wrong.] Unit tests should provide full coverage, also to simplify review. > I would like to re-use the implementations from Complex class. For some of > the simpler operations I exposed the private static methods from Complex > class. However, in order to fully reuse all operations, the Complex class > will require more refactoring... What do you suggest (provide one concrete example)? > > Am I on the right track? > Will it be ok to refactor the Complex class to allow reuse of operation > methods between Complex and ComplexList classes or should I just copy the > implementations to List class? No, code duplication should be avoided. > > I have also added a sample unit test for ComplexList similar to the > existing ComplexTest. > > Based on feedback, I plan to complete all the TODO implementations & > comments, add full unit test coverage and any other tasks required to raise > a PR > > Further, if there is interest, I also plan to extend the ComplexList for > higher dimensions (2D, 3D, 4D etc..) This class could be useful: https://commons.apache.org/proper/commons-numbers/commons-numbers-arrays/apidocs/org/apache/commons/numbers/arrays/MultidimensionalCounter.html Alex will probably further comment on whether this is going in the right direction. In particular, we should look for a way to "apply" the various complex functions to all the numbers in a list, without repeating the loop "boiler-plate" code. Regards, Gilles > > -Sumanth > > [1] https://issues.apache.org/jira/browse/NUMBERS-186 > [2] > https://markmail.org/message/n4zpcxh7d7knq5tb?q=NUMBERS-186+list:org%2Eapache%2Ecommons%2Edev/ > > > I have posted two ideas for GSoC mini projects under: > > > > https://issues.apache.org/jira/browse/STATISTICS-54 > > https://issues.apache.org/jira/browse/NUMBERS-186 > > > > Alex > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org