Wed 16 Nov 2016 06:42:17 PM UTC, comment #13:
Marking as postponed until bug #45367 is solved.
|
Tue 25 Oct 2016 12:21:51 AM UTC, comment #12:
I added a dependency on bug #45367 with is a report on adding PartialMatching to inputParser.
|
Mon 24 Oct 2016 03:26:13 PM UTC, comment #11:
I benchmarked with the following code:
And then median(bm) to not have a few outliers change the result.
Results:
Basically the same. I don't trust that my computer is accurately timing events down to microsecond precision anyways. I left the code as is.
|
Mon 24 Oct 2016 10:54:00 AM UTC, comment #10:
oops, you are right, sorry!
Does the new attached patch look correct to you?
With this I see a suspiciously substantial speed-up ...
without patch
with patch
(file #38801)
|
Fri 21 Oct 2016 03:26:21 PM UTC, comment #9:
Your patch has
but p.Unmatched is a scalar struct of size 1x1 (by definition, not empty) so this branch of the code will always be taken. That's why I changed it to depend on fieldnames to make sure the struct was actually empty.
|
Fri 21 Oct 2016 01:43:08 PM UTC, comment #8:
Rik,
I was aware of the behaviour of isempty on structs
but in my patch I was testing
as p.Unmatched is set to an empty struct before p.parse ()
it should be empty if and only if no unmatched parameters are found.
|
Fri 21 Oct 2016 12:46:17 AM UTC, comment #7:
True, and so to be completely general one would have to code
However, for this case there is no need since the structure is directly returned from inputParser and hasn't had the deletions necessary to trigger the issue in question.
|
Thu 20 Oct 2016 07:43:03 PM UTC, comment #6:
> However, if you use fieldnames then both "empty" structures above report that they are empty.
This alone will not work if the struct had fields before and was then "emptied" (depending on how define empty struct).
|
Thu 20 Oct 2016 03:18:37 PM UTC, comment #5:
@Carlo: I tried "isempty (odestruct_extra)" the first time I recoded the routine, but discovered a quirk. isempty() returns true if the number of elements is 0. Thus a scalar structure is a 1x1 object and has one element, even if it has no field names. This is not what most people mean when they say "the structure is empty". See the following code in Octave which is unintuitive.
However, if you use fieldnames then both "empty" structures above report that they are empty. Searching around on the Internet I found that the fieldnames method is, indeed, the recommended way to test structures for being empty.
|
Thu 20 Oct 2016 01:08:07 AM UTC, comment #4:
Rik,
I observed the following:
So the attached change may improve performance by a few more hundreds of microseconds.
c.
(file #38770)
|
Wed 19 Oct 2016 07:13:29 PM UTC, comment #3:
I made a change so that Octave emits a warning when an unknown property is used (http://hg.savannah.gnu.org/hgweb/octave/rev/c28648e039da).
Changing report status back to confirmed and release to dev. The final fix should take place on the development branch.
|
Sun 16 Oct 2016 07:49:20 PM UTC, comment #2:
From e-mail, workaround #1 depends on support for non-exact matching in inputParser class. Temporary fix should be workaround #2, to issue a warning.
I added notes to odeset.m to document this (http://hg.savannah.gnu.org/hgweb/octave/rev/0b21aece4b93).
|
Sun 16 Oct 2016 05:47:45 PM UTC, comment #1:
Possible workarounds include:
1) Implementing non-exact match in Octave
2) Generating a warning when a property name does not match a known value
|
Sun 16 Oct 2016 05:23:33 PM UTC, original submission:
In Matlab, odeset will match a partial property name to the exact property name. Octave does not do this. Instead, it creates a new property under the abbreviated name.
This is a problem. Code on Matlab which makes use of this feature does not generate any warning, therefore, there is no indication that the option should be written more specifically. When this code is ported to Octave, it will run, but differentent results will be obtained because some options have not been set identically. As an example,
will set RelTol to a very strict 1e-12 in Matlab, but leave it at the default value in Octave.
Test code:
Results:
|