[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave and GSOC'2008
From: |
John W. Eaton |
Subject: |
Re: Octave and GSOC'2008 |
Date: |
Thu, 28 Feb 2008 04:55:46 -0500 |
On 28-Feb-2008, Jaroslav Hajek wrote:
| 2. implement simple lazy evaluation for matrices. For instance, transpose,
| ones, zeros, or diag may output some kind of matrix expression that would not
| be converted immediately to a matrix, but retained unevaluated until
| asked to do so.
| That would allow functions to use specialized code for things like
| A'*B or diag(A)*B,
| A' \ B, kron(ones(m,n),A) etc.
| My idea is that octave_value could hold a variable of class
| matrix_expr, which would
| maintain the expression in a "latent" form, but evaluate it whenever
| matrix_value, is_matrix_type or similar methods were called.
| There are certainly some problems, like what class() should output for
| these values,
| (and probably more that I don't see just now)
Some of these things could go in the NDArray/Matrix classes. For
example, transpose. However, if you implement it with a flag it means
slowing down the element access functions (each access must check the
flag) and if you do it by introducing new classes (tranposed_matrix,
transposed_ndarray, etc.) then we have many more classes to manage
(though maybe only a small number of functions in each would need to
be redefined). I'm not sure the complexity is really worth it.
| 3. variable handles, or something like that, that would allow passing
| by reference more
| graciously than using variable name and "evalin". This is suggested in
| the Octave's "wanted features" list, but is it really wanted?
| For instance:
| A = rand(3,3)
| set11tozero(@A)
|
| function set11tozero(x)
| if (isvarhandle(x))
| assign_local_name("A",@x)
| A(1,1) = 0
| endif
It might be better to have the parser/evaluator simply recognize
function x = f (x)
...
endfunction
as a special case. Doing this requires no new syntax. Given Octave's
reference counting and copy-on-write semantics, some care might be
needed so that
a = b
a = f (a)
does not also modify b. I think you'll also need to apply the
call-by-reference semantics only for calls like this:
a = f (a)
and not
b = f (a)
jwe
- Octave and GSOC'2008, Michael Goffioul, 2008/02/26
- Re: Octave and GSOC'2008, Søren Hauberg, 2008/02/26
- Re: Octave and GSOC'2008, John W. Eaton, 2008/02/26
- Re: Octave and GSOC'2008, Søren Hauberg, 2008/02/26
- Re: Octave and GSOC'2008, Jaroslav Hajek, 2008/02/28
- Re: Octave and GSOC'2008,
John W. Eaton <=
- Re: Octave and GSOC'2008, Jaroslav Hajek, 2008/02/28
- Re: Octave and GSOC'2008, John W. Eaton, 2008/02/28
- Re: Octave and GSOC'2008, Jaroslav Hajek, 2008/02/28
- Re: Octave and GSOC'2008, Jaroslav Hajek, 2008/02/28
- Re: Octave and GSOC'2008, John W. Eaton, 2008/02/28