help-octave
[Top][All Lists]
Advanced

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

Re: control pkg


From: Doug Stewart
Subject: Re: control pkg
Date: Mon, 13 Feb 2012 10:35:32 -0500



2012/2/13 Michael Goffioul <address@hidden>
2012/2/13 Carnë Draug <address@hidden>:
> On 13 February 2012 14:52, Doug Stewart <address@hidden> wrote:
>> 2012/2/13 Carnë Draug <address@hidden>
>>> On 13 February 2012 14:38, Doug Stewart <address@hidden> wrote:
>>> > 2012/2/13 Carnë Draug <address@hidden>
>>> >> On 13 February 2012 14:07, Doug Stewart <address@hidden> wrote:
>>> >> > I have
>>> >> >
>>> >> > octave:1> ver
>>> >> >
>>> >> > ----------------------------------------------------------------------
>>> >> > GNU Octave Version 3.6.1-rc0
>>> >> > GNU Octave License: GNU General Public License
>>> >> > Operating System: Linux 2.6.32-38-generic #83-Ubuntu SMP Wed Jan 4
>>> >> > 11:13:04
>>> >> > UTC 2012 i686
>>> >> >
>>> >> > ----------------------------------------------------------------------
>>> >> > Package Name   | Version | Installation directory
>>> >> > ---------------+---------+-----------------------
>>> >> >       control *|   2.2.4 | /home/doug/octave/control-2.2.4
>>> >> > miscellaneous *|  1.0.11 | /home/doug/octave/miscellaneous-1.0.11
>>> >> >         optim *|  1.0.17 | /home/doug/octave/optim-1.0.17
>>> >> >        signal *|   1.1.2 | /home/doug/octave/signal-1.1.2
>>> >> >       specfun *|   1.1.0 | /home/doug/octave/specfun-1.1.0
>>> >> >        struct *|   1.0.9 | /home/doug/octave/struct-1.0.9
>>> >> >
>>> >> >
>>> >> > i do:
>>> >> >
>>> >> > octave:2> help c2d
>>> >> > error: help: `c2d' not found
>>> >> >
>>> >> > but
>>> >> > octave:2> help tf
>>> >> > `tf' is a function from the file
>>> >> > /home/doug/octave/control-2.2.4/@tf/tf.m
>>> >> >
>>> >> >  -- Function File: S = tf ("S")
>>> >> >  -- Function File: Z = tf ("Z", TSAM)
>>> >> >  -- Function File: SYS = tf (SYS)
>>> >> >  -- Function File: SYS = tf (N
>>> >> >
>>> >> >
>>> >> > Why are some of the things in control pkg available and others are
>>> >> > not?????
>>> >> >
>>> >> > Doug
>>> >>
>>> >>
>>> >> This is explained in the manual here
>>> >>
>>> >>
>>> >> http://www.gnu.org/software/octave/doc/interpreter/Creating-a-Class.html#Creating-a-Class
>>> >>
>>> >> Note that methods of a class can be documented. The help for the
>>> >> constructor itself can be obtained with the constructor name, that is
>>> >> for the polynomial constructor help polynomial will return the help
>>> >> string. Also the help can be obtained by restricting the search for
>>> >> the help to a particular class, for example help
>>> >> @polynomial/polynomial. This second method is the only means of
>>> >> getting help for the overloaded methods and functions of the class.
>>> >>
>>> >> The help text you are trying to access, is a function of the class so
>>> >> you need to specify the class as in "help @lti/c2d".
>>> >>
>>> >> Carnë
>>> >
>>> >
>>> > So the help is:
>>> >> help @lti/c2d
>>> > address@hidden/c2d' is a function from the file
>>> > /home/doug/octave/control-2.2.4/@lti/c2d.m
>>> >
>>> >  -- Function File: SYS = c2d (SYS, TSAM)
>>> >  -- Function File: SYS = c2d (SYS, TSAM, METHOD)
>>> >  -- Function File: SYS = c2d (SYS, TSAM, "PREWARP", W0)
>>> >      Convert the continuous lti model into its discrete-time equivalent.
>>> > is this wrong?
>>> > Doug
>>>
>>> No. This is correct. You call the function normally. But since the
>>> first argument will be an object of the lti class, octave knows where
>>> to look for the function/method. But when trying to access the help
>>> text, octave does not know which c2d you're talking about so you must
>>> specify the class. This allows for different classes to have methods
>>> with the same name.
>>>
>>> Carnë
>>
>>
>> How hard would it be to fix help so that it would work normaly for these
>> functions?
>
> Fix? I don't think there's anything to fix.
>
> Imagine the situation where 2 classes have the same method. Which one
> would help show? Such situation is not uncommon at all, specially with
> display methods and overloading arithmetic operations. Just see on the
> linear-algebra package the methods for the blksparse and kronprod
> classes.
>
> http://octave.sourceforge.net/linear-algebra/overview.html

Well, I agree that it could be made a bit more user-friendly:
- if there's only one instance of the method, even within a class
declaration, display it by default
- if there are multiple instances in different classes, display
something like "this method has been overloaded in the following
classes" and list the possible "@class/methodname" overloads
- if there's a main instance (outside any class declaration), display
it; if there are overloads, display the possible overloads at the end
of the help string of the main one, to let the user know the function
has been overloaded

Michael.

I agree with Michael, something should be shown for
help c2d   and the other functions.
Doug

--
DAS

https://linuxcounter.net/user/206392.html

reply via email to

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