octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ode csets


From: c.
Subject: Re: ode csets
Date: Thu, 20 Oct 2016 00:05:05 +0200

On 19 Oct 2016, at 21:01, Rik <address@hidden> wrote:

> One question is the sort order for default options.  Whenever a default
> option is changed, it moves to the front of the list.  That is probably
> something happening in inputParser, but I'm not sure I like it.  Does
> anyone on the octave-maintainer's list have an opinion?  Example:
> 
> +verbatim+
> odeset ("Vectorized", 1, "FooProp2", 2, "FooProp1", 1)
> ans =
> 
>  scalar structure containing the fields:
> 
>    Vectorized =  1
>    AbsTol = [](0x0)
>    BDF = [](0x0)
>    Events = [](0x0)
>    InitialSlope = [](0x0)
>    InitialStep = [](0x0)
>    JConstant = [](0x0)
>    JPattern = [](0x0)
>    Jacobian = [](0x0)
>    MStateDependence = [](0x0)
>    Mass = [](0x0)
>    MassSingular = [](0x0)
>    MaxOrder = [](0x0)
>    MaxStep = [](0x0)
>    MvPattern = [](0x0)
>    NonNegative = [](0x0)
>    NormControl = [](0x0)
>    OutputFcn = [](0x0)
>    OutputSel = [](0x0)
>    Refine = [](0x0)
>    RelTol = [](0x0)
>    Stats = [](0x0)
>    FooProp1 =  1
>    FooProp2 =  2
> -verbatim-


I would say this is a compatibility bug in inputParser that should be fixed 
there:

-- Matlab test --
>> ip = inputParser ();
>> ip.addParameter ('a', 1);
>> ip.addParameter ('b', 2);
>> ip.parse ('b', 2, 'a', 2);
>> ip.Results

ans = 

    a: 2
    b: 2
-- end Matlab test --

while in Octave

-- Octave test --
>> ip = inputParser ();
>> ip.addParameter ('a', 1);
>> ip.addParameter ('b', 2);
>> ip.parse ('b', 2, 'a', 2)
>> ip.Results
ans =

  scalar structure containing the fields:

    b =  2
    a =  2
-- end Octave test --

but I don't think this is very important as 

-- Octave test --
>> isequal (struct ('a', 2, 'b', 2), struct ('b', 2, 'a', 2))
ans = 1
-- end Octave test --

and the same also holds true in Matlab 2016a (though, IIRC, the behaviour in 
Matlab was different in older releases).

I would suggest to submit a bug for inputParser and fix the behaviour there but 
I don't think this is very high priority ...

c.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]