help-octave
[Top][All Lists]
Advanced

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

subroutines


From: James A. Tzitzouris
Subject: subroutines
Date: Thu, 6 Aug 1998 12:17:32 -0400 (EDT)

This is a 2 part question.  The first part may be a dumb question (i.e.,
one answered in the man pages, though I can't find it).  

Is there support in octave 2.0.13 for subroutines?  I know MATLAB 5.x has
support for such things.  By subroutine I mean something like the
following (in MATLAB syntax, i.e., no need for "endfunction"):

%%%%%%%%%%%%%%%%     MATLAB 5.x Code norm.m    %%%%%%%%%%%%%%%%%%%%%%%%%

function val=norm(x)

        val = sqrt(sum(sq(x)));

% now here is the definition of the subroutine sq()
% which is only defined in the scope of norm()

function y=sq(x)

        y = x.*x;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



Part 2:  I am planning to write the qp() and nlp() functions for octave 
(they're on the wish list).  The nlp() function will call the qp()
function as a subroutine.  Is it computationally faster to have a copy of
the qp() function embedded in the nlp() code as a "subroutine" (assuming
the answer to part 1 is "yes") or should I not waste my time with
subroutines and just make an external call to qp() from nlp()? 

Any input would be greatly appreciated.  I am a newcomer to octave, but I
have used MATLAB profusely throughout my academic career.  

Thanks in advance,

James Tzitzouris

Doctoral Candidate, Optimization and Operations Research
Department of Mathematical Sciences
Department of Electrical and Computer Engineering

Whitehead Hall, office 306-D
Johns Hopkins University
Baltimore, MD  21218
office:  (410) 516-0158
home:    (410) 366-3125
email:   address@hidden
www:     http://www.mts.jhu.edu/~jimt2





reply via email to

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