[Top][All Lists]

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

Re: dynamic loaded functions only?

From: Paul Kienzle
Subject: Re: dynamic loaded functions only?
Date: Tue, 17 Dec 2002 21:02:01 -0500

The data is not actually copied until you do A.fortran_vec() to access the
for modification. The goal is to eliminate all other references to the data
so that fortran_vec() doesn't make a copy. So maybe you could play some
tricks with the interpreter.

Here's something to try:  pass the vector by name to an oct-file.  Within
the oct-file, the active symbol table is the symbol table of the caller.
You probably want to leave your data at the top level and only pass the name
around.  Fortunately, you can also access the top level symbol table from
the oct-file.

The function you want to write is fft_in_place (I suppose if I got off my
butt and had my dispatch function working, you could
register("fft","fft_in_place","string") which would mean call fft_in_place
if fft is called with a string rather than a matrix, but this isn't working

Within fft_in_place, you need to look up the symbol in the symbol table
using toplevel::name to access the name in the top_level_symtab rather than
curr_sym_tab; see get_global_value() from for an example),
retrieve the matrix value from the octave value and make sure the octave
value is deleted or otherwise goes out of scope and finally delete the
symbol from the symbol table.  Now there should only be one reference to
matrix value, so you can use fortran_vec() to get the data and perform the
in-place fft.  When you are done,
reinsert the matrix in the symbol table under the name it used before.

Be warned that liboctave will probably create another copy of the vector
during the FFT, so you will have to call the FFT routines directly.  This is
a little bit tricky since FFT may be using FFTW or it may be using the
builtin FFT.  You will probably have to pull the code from liboctave
directly into your own fft_in_place routine to make it do what you want.

Let me know how it goes.  This may be something to add to octave-forge.

Paul Kienzle

----- Original Message -----
From: "Albert F. Niessner" <address@hidden>
To: "Octave Help" <address@hidden>
Sent: Tuesday, December 17, 2002 2:12 PM
Subject: dynamic loaded functions only?

> It appears as though I can only have dynamically loaded functions in
> octave. Is it possible to have procedures instead?
> To clarify, functions have no side effects and all inputs are passed by
> value. What I would like to have is a procedure that modifies the matrix
> that is input in place -- a procedure. As an example, lets say the input
> is a 2 GB time domain series that I want to examine in the frequency
> domain. Having three copies of it would exceed my the available memory
> on my linux box. Hence, I would like to write an in-place FFT routine,
> but the args(0).matrix_value returns a copy of what I pass in from the
> octave command line. I looked through ov-base.h and did not see anything
> other than matrix_value -- I was hoping for a matrix_reference or
> something.
> So, how do I get dynamically loaded procedures as well as functions?
> Al Niessner
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> Octave's home on the web:
> How to fund new projects:
> Subscription information:
> -------------------------------------------------------------

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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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