help-octave
[Top][All Lists]
Advanced

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

Re: Hiding subroutines?


From: taltman
Subject: Re: Hiding subroutines?
Date: Fri, 5 Dec 2003 23:44:00 +0000 (UTC)

Hi,

There's the rub; no module system in Octave. You add toolboxes by
merely extending Octave's search path. 

Well, if you would really like to get hackish:

You can put just the main M-file in the path, and have it "source"
files out-of-path. So throw all of your utility M-files into one
Octave script file, and then call:

source("/path/to/utilities.m");

http://www.octave.org/doct/octave_14.html#SEC104

As for solving systems of equations, check out Octave's "\" operator:

http://www.octave.org/doc/octave_2.html#SEC10

And LU-decomposition might save you some work:

http://www.octave.org/doc/octave_21.html#SEC157

---

Hope this helps!

~Tomer



On Dec 5, 2003 at 5:46pm, Vic Norton wrote:

vic >Date: Fri, 05 Dec 2003 17:46:11 -0500
vic >From: Vic Norton <address@hidden>
vic >To: address@hidden
vic >Subject: Hiding subroutines?
vic >Resent-Date: Fri, 05 Dec 2003 16:46:29 -0600
vic >Resent-From: address@hidden
vic >
vic >Is there a way to hide functions that are utilities for a main routine?
vic >
vic >For example, I am writing a Simplex Method, Phase 2 function, simp2, 
vic >that uses a bunch of utility subroutines. When I compile things and 
vic >ask "who" I see
vic >
vic >    *** currently compiled functions:
vic >
vic >    ea2b       icmp       ivect2set  ltsolve    simp2      utsolve
vic >    fu         iset2vect  ix2e       replidx    simp2step
vic >
vic >I would like to just see "simp2". The other stuff is supporting this. 
vic >Is there some way to accomplish this?
vic >
vic >Second question. Some of these "utilities" are undoubtedly internal 
vic >to octave. I wonder if the internal routines can be accessed 
vic >directly. For example "utsolve" and "ltsolve" just solve upper and 
vic >lower triangular systems respectively:
vic >
vic >   ## utsolve
vic >   x = b;
vic >   for i = m : -1 : 1
vic >           if (U(i,i) == 0)
vic >                   error("diagonal element is zero in utsolve\n");
vic >           endif
vic >           x(i,:) = (b(i,:) - U(i,i+1:m) * x(i+1:m,:))/U(i,i);
vic >   endfor
vic >
vic >and
vic >
vic >   ## ltsolve
vic >   x = b;
vic >   for i = 1 : m
vic >           if (L(i,i) == 0)
vic >                   error("diagonal element is zero in ltsolve\n");
vic >           endif
vic >           x(i,:) = (b(i,:) - L(i,1:i-1) * x(1:i-1,:))/L(i,i);
vic >   endfor
vic >
vic >Regards,
vic >
vic >Vic
vic >
vic >



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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