public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Jonathan \"Duke\" Leto" <jonathan@leto.net>
To: gsl-discuss@sourceware.org
Cc: "Filipe G. Vieira" <fgvieira@berkeley.edu>,
	Thierry Moisan <thierry.moisan@gmail.com>
Subject: Fwd: GSL mnultimin
Date: Mon, 23 Jan 2012 19:49:00 -0000	[thread overview]
Message-ID: <CABQG1aQ6hY9HLnR4rq+K=FT6Ps7o95vSyBYyT3m9+FqTZMxp+w@mail.gmail.com> (raw)
In-Reply-To: <CAG7hEaQy3mkzZf-h5aq-_x5GqpAg6KNFF+YsWhLc5TOvmYPd0A@mail.gmail.com>

Howdy,

Passing along this question about Math::GSL here, since this list is
more appropriate.

Duke


---------- Forwarded message ----------
From: Filipe G. Vieira <fgvieira@berkeley.edu>
Date: Mon, Jan 23, 2012 at 10:44 AM
Subject: GSL mnultimin
To: jonathan@leto.net, thierry.moisan@gmail.com



Hi,

I've just found your perl module to run GSL::multimin.
I'm trying to use that functions in C++ but I have a doubt that,
despite not related to the perl module, I thought you might be able to
help me with.
I want to limit the search space to [0,1] but the GSL function has no
limit option. I tried to implement myself and I came up with two
alternatives but I don't know if they are the best options.

One is to just return a high score whenever the parameter goes out of
the interval:
if(gsl_vector_get(0,i) < min || gsl_vector_get(x,i) > max) return 1e100;

The other is to set the parameter to 0:
if(gsl_vector_get(0,i) < min) x->data[0] = min;
if(gsl_vector_get(0,i) > max) x->data[0] = max;


Are these approaches correct? Which one is the best? Any better way to do it?
thanks,
FGV


-- 
Jonathan "Duke" Leto <jonathan@leto.net>
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.

           reply	other threads:[~2012-01-23 19:49 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAG7hEaQy3mkzZf-h5aq-_x5GqpAg6KNFF+YsWhLc5TOvmYPd0A@mail.gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABQG1aQ6hY9HLnR4rq+K=FT6Ps7o95vSyBYyT3m9+FqTZMxp+w@mail.gmail.com' \
    --to=jonathan@leto.net \
    --cc=fgvieira@berkeley.edu \
    --cc=gsl-discuss@sourceware.org \
    --cc=thierry.moisan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).