[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave and Guile?
From: |
Mikael Djurfeldt |
Subject: |
Re: Octave and Guile? |
Date: |
15 Sep 2000 00:01:45 +0200 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7 |
"John W. Eaton" <address@hidden> writes:
> Is anyone here interested in such a project?
I'm very interested. I think it's an excellent idea. And the Guile
object system, GOOPS, with its multimethod dispatch mechanism seems
very suitable for representing Octave operators.
(BTW, with GOOPS, it is possible to let the ordinary numerical
operators + - * / work on vectors and matrices too without loosing any
performance in operations on numbers.)
Anders Sandberg and I have written a matrix library for Guile + GOOPS
which provides Matlab-like functionality:
http://www.nada.kth.se/~mdj/guile/matrix-1.0.1.tar.gz
This is very experimental and was only meant as a prototype. Since I
use it in my daily computations, I've incrementally added kludges
which I've needed.
I think I have learnt from this and have some ideas about what should
be improved when making a new matrix library.
Examples:
guile> (use-modules (math matrix))
guile> (define a #M((1 2) (3 4)))
guile> a
#M((1.0 2.0)
(3.0 4.0))
guile> (* a a)
#M(( 7.0 10.0)
(15.0 22.0))
guile> (+ a (ident 2))
#M((2.0 2.0)
(3.0 5.0))
guile> (define r (.. 1 4))
guile> r
#R(1 2 .. 4)
guile> (* 5 r)
#R(5 10 .. 20)
guile> (define m (* r (transpose r)))
guile> m
#M((1.0 2.0 3.0 4.0)
(2.0 4.0 6.0 8.0)
(3.0 6.0 9.0 12.0)
(4.0 8.0 12.0 16.0))
guile> (a 1 1)
4.0
guile> (set! (a 1 1) 5)
guile> (a 1 1)
5.0
guile> (m 1 (.. 1 2))
#M((4.0 6.0))
guile> (m 2 (..))
#M((3.0 6.0 9.0 12.0))
guile> (set! (m (.. 0 1) (.. 0 1)) a)
guile> m
#M((1.0 2.0 3.0 4.0)
(3.0 5.0 6.0 8.0)
(3.0 6.0 9.0 12.0)
(4.0 8.0 12.0 16.0))
If you have gnuplot, you can do:
guile> (define x (.. 0 6.28 0.1))
guile> (plot x (sin x))
guile> (hold)
Plot held
guile> (plot x (cos x))
But, probably, a real plotting interface should use GTk.
As I said, this is all very experimental, but maybe it can give some
ideas of what you could do using Guile.
Currently, vectors are matrices. One of the first things I'd like to
do is to represent vectors as a separate type.
Best regards,
/mdj
- Octave and Guile?, John W. Eaton, 2000/09/14
- Advocacy and Re: Octave and Guile?, Friedrich Dominicus, 2000/09/14
- Re: Octave and Guile?, Jim Blandy, 2000/09/14
- Re: Octave and Guile?,
Mikael Djurfeldt <=
- Message not available
- Message not available
- Message not available
- Re: Octave and Guile?, John W. Eaton, 2000/09/15
- Re: Octave and Guile?, Mikael Djurfeldt, 2000/09/15
- Re: Octave and Guile?, Mikael Djurfeldt, 2000/09/15
- Re: Octave and Guile?, Keisuke Nishida, 2000/09/15
- Re: Octave and Guile?, Miroslav Silovic, 2000/09/16
- Re: Octave and Guile?, Marius Vollmer, 2000/09/17