Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E38B58B63 for ; Fri, 9 Sep 2011 07:58:35 +0000 (UTC) Received: (qmail 2754 invoked by uid 500); 9 Sep 2011 07:31:45 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 2217 invoked by uid 500); 9 Sep 2011 07:31:35 -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 2193 invoked by uid 99); 9 Sep 2011 07:31:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 07:31:28 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=FREEMAIL_FROM,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.67.169.19] (HELO solo.fdn.fr) (80.67.169.19) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 07:31:20 +0000 Received: from lehrin (reverse-229.fdn.fr [80.67.176.229]) by smtp.fdn.fr (Postfix) with ESMTP id B71CE4438D for ; Fri, 9 Sep 2011 09:30:59 +0200 (CEST) Received: by lehrin (Postfix, from userid 5001) id 5285C4077; Fri, 9 Sep 2011 09:30:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lehrin.spaceroots.org X-Spam-Level: Received: from lehrin.spaceroots.org (lehrin.spaceroots.org [127.0.0.1]) by lehrin (Postfix) with ESMTP id 6E0234073 for ; Fri, 9 Sep 2011 09:30:58 +0200 (CEST) Message-ID: <4E69C0B2.8060204@free.fr> Date: Fri, 09 Sep 2011 09:30:58 +0200 From: Luc Maisonobe User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110419 Thunderbird/3.1.9 MIME-Version: 1.0 To: Commons Developers List Subject: Re: [math] use the more general super-type RealMatrix in place of Array2DRowRealMatrix in package ode? References: <4E6919E1.3010905@free.fr> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,FREEMAIL_FROM autolearn=unavailable version=3.3.1 Le 09/09/2011 04:05, S�bastien Brisard a �crit : > Sorry Ted, I was not very clear in my explanations. > solve does return a RealMatrix. Internally, it builds BlockRealMatrix, though. > The issue is that Luc needs the underlying double[][] array in this > ODE application. Yes, this is exactly the point. In fact, this is also internal code user never sees. the matrices here correspond to an internal state that is changed a very large number of time. > This you could easily get if the returned matrix were > a Array2DRowRealMatrix, and you could have something along the lines > {code} > RealMatrix x = decomposition.getSolver().solve(new > Array2DRowRealMatrix(b, false)); > if (x instanceof Array2DRowRealMatrix){ > return x.getDataRef(); > } else { > return new Array2DRowRealMatrix(x.getData(), false); > } > {code} > but this hack is of no use here, since it turns out that the > decomposition solver being used here *always* returns a > BlockRealMatrix (as an Array2DRealMatrix). So basically, deep copy of > x through x.getData() will *always* occur. That's what is worrying me. Don't worry. As I wrote in the comment on this issue, this class is under scrutiny for other changes due to other issues. I don't like either being forced to use an Array2DRowRealMatrix. In fact I already tried to remove them some months ago but failed, I had to go back to this signature. I will make another attempt. As I may well change completely the way the internal state is updated, I hope this will naturally simplify things. For now, just leave the multi step integrators classes alone (all classes with Adams, Nordsieck and Multistep in their names, as well as BDF when it will be committed later on), you would waste your time on them. Luc > I hope I do make my point, now. > S�bastien > > 2011/9/9 Ted Dunning: >> Why doesn't solve just return a RealMatrix? Why does it insist on returning >> an Array2DRowRealMatrix? >> >> Does the user really care? >> >> 2011/9/8 S�bastien Brisard >> >>> Hi Luc, >>> thanks for your detailed explanations attached to the MATH-659. I'm >>> worried about the changes I have applied to the code, now. Here is >>> what I've done. I've replaced the following line >>> {code} >>> return new Array2DRowRealMatrix(decomposition.getSolver().solve(b), false); >>> {code} >>> with >>> {code} >>> RealMatrix x = decomposition.getSolver().solve(new >>> Array2DRowRealMatrix(b, false)); >>> return new Array2DRowRealMatrix(x.getData(), false); >>> {code} >>> >>> decomposition is in fact an instance of QRDecompositionImpl.Solver, >>> whose method solve(RealMatrix) returns a BlockRealMatrix, not an >>> Array2DRowRealMatrix, hence the ugly last line. This code seems to be >>> correct (unit tests still pass), but I'm worried about the efficiency, >>> especially if initializeHighOrderDerivatives is called very often. >>> What do you think should be done? >>> >>> Best regards, >>> S�bastien >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org >>> For additional commands, e-mail: dev-help@commons.apache.org >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org