Patch to qp() to support extra arg specifying maximum iterations
Ben Abbott
bpabbott at mac.com
Sun Feb 1 20:26:45 CST 2009
On Feb 1, 2009, at 9:15 PM, Joshua Redstone wrote:
> On Sun, Feb 1, 2009 at 6:07 PM, Ben Abbott <bpabbott at mac.com> wrote:
>
> On Feb 1, 2009, at 8:45 PM, Joshua Redstone wrote:
>
> On Sun, Feb 1, 2009 at 4:51 PM, Ben Abbott <bpabbott at mac.com> wrote:
>
> On Feb 1, 2009, at 6:43 PM, Joshua Redstone wrote:
>
> Hi,
> Attached is a patch to eliminate a FIXME in qp.m. This adds an
> extra arg to qp() to specify the maximum number of iterations.
> The old hard-coded value of 200 iterations is sometimes insufficient
> for convergence.
>
> I originally posted this 3 months ago, but perhaps sent it to the
> wrong list. I've update the diff to the current repository version.
> I haven't contributed before, so please let me know if there's
> something else I should do.
> Thanks,
> Josh
>
> <qp.diff>
>
> Josh,
>
> I'm unfamiliar with qp(). Is it possible to add some tests that
> validate this change?
>
> Ben
>
>
> I attached a diff of a followon changeset that adds a few tests to
> qp.m to exercise the maxit argument.
> I actually don't understand qp.m internals so the examples are
> pretty contrived.
> Also, I have mercurial 1.0.1 and I couldn't figure out how to
> generate a single 'export' style patch that included both changesets.
> Josh
>
> I don't know if it is possible to export a patch that includes two
> changesets. What I tend to do is create a changeset for each, and
> import them into a virgin mercurial archive and then produce a
> changeset (I hope that makes sense). The only caveat is that the 2nd
> Changelog entry may not apply, so I edit the Changelog manually and
> then generate a combined changeset.
>
> I expect someone with a better understanding of mercurial will
> educate us sometime tomorrow :-)
>
> Regarding the Changelog, you should add the change to the Changelog
> file in the scripts directory. Thus the changeset should include
> something like what is below ...
>
> --- a/scripts/ChangeLog Sun Feb 01 20:40:10 2009 +0100
> +++ b/scripts/ChangeLog Sun Feb 01 15:40:19 2009 -0800
> @@ -1,3 +1,8 @@
> +2009-02-01 Joshua Redstone <redstone at gmail.com>
> +
> + * scripts/optimization/qp.m: Add extra argument, max_iter,
> to qp(),
> + specifying the maximum number of iterations.
> +
>
> Ben
>
> Yeah, it'd be great if 'export' somehow took multiple changesets.
> In the meantime, are the simple tests I added to qp.m what you were
> looking for?
> I just made sure the the maxit did something useful and didn't break
> the old call signature.
> Josh
Josh,
I tried to merge your changes, and modified the proper ChangeLog.
Using the final result, the first test fails for me (I've attached the
changeset).
octave:13> test qp
X =
2.9113e+15
-2.9113e+15
OBJ = -4.5036e+15
INFO =
{
solveiter = 200
info = 3
}
LAMBDA =
0.0000e+00
2.1835e+15
0.0000e+00
2.1835e+15
***** test
[X, OBJ, INFO, LAMBDA] = qp ([0; 3], [1 2 ; 3 4],[0; 0],[],[],[],[],
[0; 0],[1 1 ; 1 1],[2; 2])
assert(INFO.info == 0)
[X, OBJ, INFO, LAMBDA] = qp ([0; 3], [1 2 ; 3 4],[0; 0],[],[],[],[],
[0; 0],[1 1 ; 1 1],[2; 2], 200)
assert(INFO.info == 0)
[X, OBJ, INFO, LAMBDA] = qp ([0; 3], [1 2 ; 3 4],[0; 0],[],[],[],[],
[0; 0],[1 1 ; 1 1],[2; 2], 1)
assert(INFO.info == 3)
!!!!! test failed
I don't see what I may have done wrong, please check it for me.
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeset-qp.patch
Type: application/octet-stream
Size: 3059 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090201/fde41315/attachment.obj
-------------- next part --------------
More information about the Octave-maintainers
mailing list