Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BD382200D5E for ; Sat, 23 Dec 2017 21:35:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BBABD160C1C; Sat, 23 Dec 2017 20:35:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D94A5160BFD for ; Sat, 23 Dec 2017 21:35:20 +0100 (CET) Received: (qmail 11987 invoked by uid 500); 23 Dec 2017 20:35:19 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 11975 invoked by uid 99); 23 Dec 2017 20:35:19 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Dec 2017 20:35:19 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 0E286180705 for ; Sat, 23 Dec 2017 20:35:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.479 X-Spam-Level: ** X-Spam-Status: No, score=2.479 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=decampo-org.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id dEnBfWGCpmJl for ; Sat, 23 Dec 2017 20:35:16 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id F3D005FB29 for ; Sat, 23 Dec 2017 20:35:15 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id y75so20928351oie.4 for ; Sat, 23 Dec 2017 12:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=decampo-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=PzegrWr8eklTkraFRNS7dgk+pjP9RF2z/S9mN7Q/cng=; b=v5q4ZIH09IOOuyI3lmWTDuOWDhJAbNlJmC9B3cDoMQXaBfq3Y/7ffVd/9PlHnhJztZ hhyxaOaX+HXG89DJ1Z8uuscEQ+ntHDyBcSuPi6rXp9Zy08NYyjzHL1taY5JAnFqk3ofv 3TnHrlPlvxnP30enu40J4RxWqa9zEQQXlOFRSwhXoMYiwTo3LqB7Pj7DE928x1k/ym7m HMT/bTbIWHR7wPmze6LE/FlM40I6ldE4fcYhj8GiJqS18+cRFfZUhWxZYL4xdyHuGFOS rH/ceXgAc/OIcqbHU8AG+uVFEozdxgn2am+5JhbknoCpmw5jFjNbEa+6ELTcoVdxU1+O S19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=PzegrWr8eklTkraFRNS7dgk+pjP9RF2z/S9mN7Q/cng=; b=YS/Wyl9nZ6/kCYcP5sa08egZfIS0FTe7+3il+OfBbVLXw/Ohwa3sJoJmPEIEyyryZu RfxHvc9xx+3Uj1cHJhCnbGFJbgVBKQLnvGJmiHs24KpExIhdGlsDIy5IVtMvwcW7pkd6 pYjMEFJ3vsSSEw43OpRtZilkjz0HFruPCP6OYdnouvqoWq6ahA/ynj48444iPY7ATrlR nHg/TwwKjok7g39Bw1z3toG+X4/9XVioJDpLFs5QAv0Ws3OlyniAI89LetIF26WGAVVJ SZex6C6Tw9P3dOV/pOWKPkkEpL/q6G9MPyQ5lH0dkBNHmMFjFrc8aLDjaCVL/goQOmsz 5bxQ== X-Gm-Message-State: AKGB3mITeJl/XEqL0cLTeFR+aN8cZkewVkiTW1b30UnzQy7nXoYHu5L/ 5cP6oxmV1Lbf3cBKkUupGV/cTCIApVMi09QRL9lNJlYU X-Google-Smtp-Source: ACJfBos3CDvIiiJ5nXb1/Y2kJg0bueo97dARwYLBDU/g5IFbngqtnT/gNvVJIGpDAsXMW+YjdC4jVIyGoXXbW4enk+Y= X-Received: by 10.202.83.22 with SMTP id h22mr12215404oib.8.1514061315013; Sat, 23 Dec 2017 12:35:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.35.147 with HTTP; Sat, 23 Dec 2017 12:35:14 -0800 (PST) X-Originating-IP: [72.228.81.86] In-Reply-To: <843d672d6f25e606e8a036528c74d9d6@scarlet.be> References: <07a3cd49cfde1678a0623e7a4cf7da49@scarlet.be> <0ba285df6fd096adbf4be8529d1caaac@scarlet.be> <843d672d6f25e606e8a036528c74d9d6@scarlet.be> From: Raymond DeCampo Date: Sat, 23 Dec 2017 15:35:14 -0500 Message-ID: Subject: Re: [Math][Numbers] Move Field, etc. to numbers? To: Commons Developers List Content-Type: multipart/alternative; boundary="001a113df1d8d99187056107de58" archived-at: Sat, 23 Dec 2017 20:35:21 -0000 --001a113df1d8d99187056107de58 Content-Type: text/plain; charset="UTF-8" What would you do with FieldElement and in particular FieldElement.getField()? On Fri, Dec 22, 2017 at 10:42 AM, Gilles wrote: > Hello. > > Sorry for not replying earlier (and the top-post). > > I've a bad feeling about "Field" and "FieldElement" as > they exist in "Commons Math". > I'd like to see whether/how we can do better starting > from "scratch"[1]. > > I started to make changes in the CM codes but more and > more were necessary because "Field" is used (often > indirectly, when a type "implements" it) in hundreds > of statements... > > In "Commons Numbers", a worthy goal is to not tangle > "field"-related classes with a basic utility such as > "Fraction". > > So, I'd wish to create a new module: > commons-numbers-field > with new classes such as "FractionField" that reflect > the intended functionality[1]. > > WDYT? > > If that makes sense, then CM ("client" code) should > _adapt_ to the lower level API rather then the other > way around (in CM, the higher level concepts, such as > "FieldMatrix" impose a complex API on otherwise basic > utilities. > > Regards, > Gilles > > [1] http://mathworld.wolfram.com/FieldAxioms.html > > > On Wed, 20 Sep 2017 08:35:00 -0400, Raymond DeCampo wrote: > >> On Wed, Sep 20, 2017 at 7:29 AM, Gilles >> wrote: >> >> On Sat, 16 Sep 2017 14:19:04 -0400, Raymond DeCampo wrote: >>> >>> [...] >>>> >>>> >>>>> So from the POV of a "Commons Numbers" developer, what is the >>>>> added value of "Field"? >>>>> [IMO none at the moment (but that could change).] >>>>> >>>>> >>>> >>>> I'm not looking at it from the POV of a CN developer. I am looking at >>>> it >>>> from the POV of a CN user. >>>> >>>> >>> If "Commons Numbers" were only to be a copy from what is/was >>> in CM I'd have to agree that there was no point in having a >>> new component in the first place. >>> >>> >>> Well perhaps we have different philosophies here. I thought the main >> goal >> was to slice up CM into manageable pieces to allow for better releases and >> to allow people to focus on the portions of the library which are >> important >> to them without being held back by the portions which are not of interest. >> >> >> Since there are no users right now, it seems reasonable to >>> me that the KISS principle should apply. >>> >>> I believe this is covered in the following >>> >>>> paragraph you quoted. >>>> >>>> >>> It is a nice feature, but as with any feature implemented on >>> top of a more basic utility, we should first look for a solution >>> that is compatible with the upstream dependency. >>> >>> Since Java is strongly typed and does not support duck typing without >>> >>>> >>>>> resorting to reflection gymnastics, there is currently no way to write >>>>>> an >>>>>> algorithm using e.g. the add() method which could be applied to >>>>>> o.a.c.n.f.Fraction and o.a.c.n.c.Complex without duplication, >>>>>> reflection >>>>>> or >>>>>> pointless wrapper extensions. >>>>>> >>>>>> >>>>> You may be right. >>> But is the CM solution the best we can do, now that it is >>> the moment where other solutions can be explored? >>> >>> [...] >>> >>>> >>>>> To be blunt I don't agree with the approach >>>>> >>>> >>>> >>> Which one? >>> >>> so I am not about to devote >>> >>>> time and effort to supporting it. >>>> >>>> >>> You are smarter than I ever was, since I devoted a lot of time >>> to implement compromise decisions in CM, although I knew that >>> they were bad (and proven to be so later on). >>> >>> You are definitely right that the wrapper approach takes a >>> lot of time, mainly because of the awful amount of duplication >>> in the CM unit tests classes. >>> [I spent countless hours fixing the same in the RNG code.] >>> >>> I badly underestimated the task for "Fraction"/"BigFraction". :-/ >>> >>> I'm also not particularly interested in >>> >>>> arguing about it. So I have completed the portions where we have >>>> agreement >>>> and left the rest. >>>> >>>> Summarizing the other issues I found while trying to eliminate >>>> BigFraction, >>>> Fraction and Complex from CM: >>>> >>>> I found nine test classes which use FractionField, those would need to >>>> be >>>> rewritten. I imagine they could use a different Field implementation >>>> without a great deal of difficulty. >>>> >>>> >>> You are quite right; the "main" code is easy to adapt. >>> Adapting the unit tests, however, is a nightmare (+100 errors). >>> >>> And I don't understand why it had to be, since the common "Field" >>> interfaces should in principle have allowed to write a test base >>> class, with the actual types be automatically exercised through >>> factory subclasses. >>> >> >> >> I think that the issue with the unit tests is that they used Fraction >> and/or BigFraction for this purpose, i.e. a convenient implementation of >> FieldElement when one was needed. >> >> >> >>> >>> I also found a couple of public methods in MatrixUtils that I imagine >>> will >>> >>>> need to be deleted. I don't think they would be missed but OTOH they >>>> were >>>> added because somebody wanted them. >>>> >>>> What you do propose to do about the ComplexField, FractionField and >>>> BigFractionField classes? These were part of the CM API in the last >>>> release are is the plan to just drop them? >>>> >>>> >>> I'd have thought they could be modified so that under the hood, >>> they use the "Numbers" implementations. >>> >>> >>> The issue with this is that the Field interface specifies a method >> returning the corresponding FieldElement class. So you need FieldElement >> wrapper implementations for the classes as well. Then all you are doing >> is >> implementing delegating methods in Fraction/BigFraction/Complex with the >> wrappers - it's enough to make you want to work in a language with duck >> typing. >> >> I'm not in front of the code right now so I'm not sure this would work >> but, >> how would you feel about including just the FieldElement interface (name >> negotiable) in numbers and leaving Field in CM? >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --001a113df1d8d99187056107de58--