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 ECA80718C for ; Thu, 11 Aug 2011 08:56:35 +0000 (UTC) Received: (qmail 80224 invoked by uid 500); 11 Aug 2011 08:56:34 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 79362 invoked by uid 500); 11 Aug 2011 08:56:14 -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 79088 invoked by uid 99); 11 Aug 2011 08:56:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2011 08:56:08 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebastien.brisard@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2011 08:56:01 +0000 Received: by vws10 with SMTP id 10so1773201vws.30 for ; Thu, 11 Aug 2011 01:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=OJUBvUlcYqu9t/QbBQKWJckkskcWZ2X8EPWLoaUOaZw=; b=ECro/TE4N149Bi4rAHM/3GWFxse8sXe9YibWd5Hy0hXtAw4x91a9YLdnEY9nTgtUqG y/Y7yzVPtLcyefAGBQFX3MR9mtBvcGhENGBDiqZdeyRU4yCgEqE7ZO14VKNCxQRNHC7I Cqct0aArFsMcriYItJ16Hv5xvbjSWoOvFkV8s= MIME-Version: 1.0 Received: by 10.52.68.231 with SMTP id z7mr9893284vdt.86.1313052940576; Thu, 11 Aug 2011 01:55:40 -0700 (PDT) Sender: sebastien.brisard@gmail.com Received: by 10.220.192.137 with HTTP; Thu, 11 Aug 2011 01:55:40 -0700 (PDT) In-Reply-To: <1313052399.2877.6.camel@knuffelchen> References: <1313048561.2738.2.camel@knuffelchen> <1313052399.2877.6.camel@knuffelchen> Date: Thu, 11 Aug 2011 10:55:40 +0200 X-Google-Sender-Auth: e_kCfUqfojU9bOJ_84Rzi77663w Message-ID: Subject: Re: [math] Read-only RealVector From: =?ISO-8859-1?Q?S=E9bastien_Brisard?= To: Commons Developers List , aploese@gmx.de Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 2011/8/11 Arne Ploese : > So you not only want to observe the result, but you want a read only > RealVector. > That's right. I'm sorry, my first message was not clear, especially if you did not follow the thread on iterative solvers. I want to observe the *solver*, and the current state of the solver is a *RealVector*, which should by no means be modified by the observer. The safest way to do that would be for the solver to have a method like public RealVector getCurrentSolution(){ return x.copy(); } but that takes both time and memory. So I was thinking of something more like public RealVector getCurrentSolution(){ return new ReadOnlyRealVector(x); } which takes virtually no additional memory (and presumably very little time). The two advantages of this approach are * it does not jeopardize the whole hierarchy tree, since you do not have to create a new interface, * it is quite general, and could be adopted for any base object (not only RealVector). The downside is that some methods throw exceptions, which might be deemed dirty. I don't really know. S --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org