From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32174 invoked by alias); 9 Mar 2007 13:58:53 -0000 Received: (qmail 32165 invoked by uid 22791); 9 Mar 2007 13:58:52 -0000 X-Spam-Check-By: sourceware.org Received: from mailsend02.psi.ch (HELO MAILSEND02.psi.ch) (129.129.191.54) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Mar 2007 13:58:43 +0000 Received: from MAILBOX0A.psi.ch ([129.129.190.193]) by MAILSEND02.psi.ch with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Mar 2007 14:58:39 +0100 Received: from 129.129.206.98 ([129.129.206.98]) by MAILBOX0A.psi.ch ([129.129.190.181]) via Exchange Front-End Server mail.psi.ch ([129.129.191.53]) with Microsoft Exchange Server HTTP-DAV ; Fri, 9 Mar 2007 13:58:39 +0000 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-aOyKtTYKmE1VszBkDfTu"; protocol="application/pgp-signature"; micalg=pgp-sha1 Received: from pc446 by mail.psi.ch; 09 Mar 2007 14:58:39 +0100 Content-class: urn:content-classes:message Subject: possible design weekness Date: Fri, 09 Mar 2007 13:58:00 -0000 Message-ID: <1173448719.10868.3.camel@pc446.psi.ch> From: "Alxneit-Kamber Ivo" To: Reply-To: "Alxneit-Kamber Ivo" Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2007-q1/txt/msg00040.txt.bz2 --=-aOyKtTYKmE1VszBkDfTu Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-length: 2060 Dear all I have recently been bitten by what seems to be a design weekness in how the functions (function to be minimized, or system of ODE's) are defined. These function do not return a status value but the function value. This prevents to easily notifiy the caller (iterate) of a failure such as e.g. a domain error of one of its arguments or a failed malloc(). The function used in the non-linear least squares fit, however is implemented better as it returns a status value to the caller. Other parts of the GSL library, multi-dimensional root finding or one-dimensional minimization, e.g., take a slightly less optimal aprroach. Here the caller (iterate) checks, if the function value or its derivative, if applicable, is finite and issues an error otherwise. I think it would be worthwhile (maybe for a version 2.0) to implement a common definition for these functions like status =3D f(double *result, 'arguments', (void*) parameters); For a status different from 'GSL_SUCCESS' let the driver either take care of the failure (this depends on the application/algorithm) or let it fail propagating the status from the function to the user. Then the user can handle the situation in his main loop. I currently have no real idea how to prevent breaking of old user code by implementing this new interface while keeping the old in place: - for the 'GSL_XXX_EVAL_YYY' family of macros a simple wrapper would do the job. (allways return GSL_SUCCESS for the old style or analyze the result and then assign the status to be returned). - the fact that the new interface has one more argument could probably be handled by variable argument functions (never used these). - how to deal with the fact that the new style function is of different type (int instead of double)? Comments or suggestions? --=20 Dr. Ivo Alxneit Laboratory for Solar Technology phone: +41 56 310 4092 Paul Scherrer Institute fax: +41 56 310 2688 CH-5232 Villigen http://solar.web.psi.ch Switzerland gnupg key: 0x515E30C7 --=-aOyKtTYKmE1VszBkDfTu Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part Content-length: 189 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBF8WgOAd7CE1FeMMcRAiOhAJ91NP1dJU/wYAhZYSo68S3meYxY7wCfd9NW jcSLejJeeSRwQ84M3uR0IHk= =UZhk -----END PGP SIGNATURE----- --=-aOyKtTYKmE1VszBkDfTu--