This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Matrix support and guile signal handlers


>>>>> "T" == Telford Tendys <telford@eng.uts.edu.au> writes:

    T> I'm a bit of a guile newbie, I'm writing a matrix handling
    T> library and I'd like to be able to use the scheme interpreter
    T> to exaluate expressions, some of which may involve matricies.

    T> People who use Matlab or octave would know of the usefulness of
    T> an interpretive language combined with a matrix library.

    T> Has guile got matrix support?

    T> Has anyone else already started on this project?

I've just released a matrix library for Guile, based on BLAS/LAPACK
(similar to the foundations of Matlab/Octave).  I put it at

  http://www.cs.cmu.edu/~chrislee/chrlib/

last week.  Yesterday I found a couple of reasons why this may not
compile correctly for people besides myself, so I am working now on
getting it in a form better for redistribution.

    T> I'm thinking that I should be able to make the matrix data type
    T> an atomic type in guile by using struct gscm_type and
    T> gscm_alloc_obj().

    T> Then I can map new functions into scheme such as (mat-+),
    T> (mat-*) and (mat-invert).

    T> Is this a plausible direction?

I do this all the time :)

    T> The system of exceptions, error handling and interrupts in
    T> guile seems a little beyond me.  I'm used to unix signals and
    T> the concept of breaking my code at some random point and never
    T> returning to that point just doesn't click with me.  Usually my
    T> signal handlers just change a few variables and then
    T> return. Only the most critical stuff gets done in the handlers.

    T> I don't use C++ exceptions either :-)

My matrix library works in two modes: it can be used as a stand-alone
C library, in which case the library generally just calls exit(1) when
there is a problem (or abort() if you want it to core-dump for
debugging).  The error handling is configurable, however, and you can
replace the default function called for errors and warnings at runtime
(this is done by libgei, distributed at the same location -- only a
couple of lines of code).  When the library is loaded into the Guile
interpreter, the default error behavior is set to throw a Guile error
exception, so it works fine with the native error handing of the
Scheme interpreter.  It could also be set up to present pop-up windows
or signal a C++/Ada/... exception.

    T> However, if someone can point me in the direction of some
    T> explanation of how the system is supposed to work and why it's
    T> worth doing then I'll breathe deeply and give it a go (I'm
    T> saying this beause I have a feeling that if I want to get guile
    T> working properly then I'll have to).

Wait a few hours, and check the CHRLIB web page to see if I have the
distribution fixed.  In the meantime you are welcome to download the
code and take a look at my approach.  I don't think many people have
downloaded this library (at least I haven't heard much yet), so I
would be glad to hear your suggestions or how I could improve it for
your needs.

 -Chris