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] |
Hi, After a weak of hard work I'm proud to announce that the prototype for Schelab, a numerical analysis library for Scheme is out. Currently only simple operations on matrices, such as addition, subtraction and products are implemented, but up from now it is easy to add any new feature. Schelab is being developed on MzScheme, Guile 1.2 (buggy) and Gambit-C 3.0. WHAT IT IS ---------- Schelab is an OO library based on Christian Queinnec's Meroon-V3. It is intended to become the kernel of a matrix algebra system and includes + A library for garbage collectable memory chunks. + A library of classes for foreign data types from FORTRAN and C. + A FFI for FORTRAN that needs no glue code. + A set of overloadable mathematical operations. + Interface to BLAS. (incomplete, but usable) + Classes for complex and real matrices plus simple ops (+,-,*) + A timing facility. WHERE IT RUNS ------------- This library runs both on top of Guile and of MzScheme, and it can be easily ported to other environments with these requisites: + be able to run Meroon-V3 + allow the introduction of new primitives in C + allow the creation of non movable, but garbage collectable objects (for the `memory blocks' library) These are the requirements for a Linux system: + MzScheme or Guile 1.2 or Gambit-C 3.0 + A C and FORTRAN compilers to build the extensions. + The BLAS library compiled as a shared library. Currently the C code as well as the Makefiles are prepared for Linux, which is the only environment I know of. If you get it to run on DOS/WIN**/MAC or on any other system, please tell me so I can introduce your changes in the package. SAMPLE SESSIONS --------------- Some timings (in milliseconds) for the three supported environments: A) GAMBIT-C (3.0) -- Code has not been compiled > (load "init-gsc.scm") > (schelab-require '(schelab matops)) > (schelab-load '(tests matrix1)) > (define a (make-real-matrix 100 100 0.1)) > (time (do ((i 100 (- i 1)))((zero? i))(plus a a))) 253 ms real time 250 ms cpu time (170 user, 80 system) 3 collections accounting for 60 ms cpu time (60 user, 0 system) 8416496 bytes allocated 7920 minor faults no major faults > (time (do ((i 100 (- i 1)))((zero? i))(minus a a))) 214 ms real time 210 ms cpu time (170 user, 40 system) 1 collection accounting for 20 ms cpu time (20 user, 0 system) 8402936 bytes allocated 7928 minor faults no major faults > (time (do ((i 100 (- i 1)))((zero? i))(times a a))) 3544 ms real time 3540 ms cpu time (3510 user, 30 system) 1 collection accounting for 20 ms cpu time (20 user, 0 system) 8798096 bytes allocated 8168 minor faults no major faults > (time (do ((j 99 (- j 1))) ((zero? j)) (do ((i 99 (- i 1))) ((zero? i)) (n-set! a (list i j) 1.0)))) 703 ms real time 700 ms cpu time (680 user, 20 system) no collections 2482620 bytes allocated 1312 minor faults no major faults B) MzSCHEME: > (load "init-mz.scm") > (schelab-require '(schelab matops)) > (define a (make-real-matrix 100 100 0.1)) > (time (do ((i 100 (- i 1)))((zero? i))(plus a a))) cpu time: 600 real time: 600 gc time: 150 > (time (do ((i 100 (- i 1)))((zero? i))(minus a a))) cpu time: 610 real time: 606 gc time: 180 > (time (do ((i 100 (- i 1)))((zero? i))(times a a))) cpu time: 3970 real time: 3963 gc time: 150 > (time (do ((j 99 (- j 1))) ((zero? j)) (do ((i 99 (- i 1))) ((zero? i)) (n-set! a (list i j) 1)))) cpu time: 1470 real time: 1477 gc time: 0 C) GUILE 1.2: guile> (load "init-guile.scm") guile> (schelab-require '(schelab matops)) guile> (schelab-require '(system timer)) guile> (define a (make-real-matrix 100 100 0.1)) guile> (time (do ((i 100 (- i 1)))((zero? i))(times a a)) Time: 8155.807 guile> (time (do ((i 100 (- i 1)))((zero? i))(plus a a))) Time: 1266.251 guile> (time (do ((i 100 (- i 1)))((zero? i))(minus a a))) Time: 1288.696 guile> (time (do ((j 99 (- j 1))) ((zero? j)) (do ((i 99 (- i 1))) ((zero? i)) (n-set! a (list i j) 1)))) Time: 8574.112 D) SCILAB (A most efficient MatLab clone) -->a = rand(100,100); -->timer();for i=1:100; a+a; end; timer()*1000 ans = 170. -->timer();for i=1:100; a-a; end; timer()*1000 ans = 170. -->timer();for i=1:100; a*a; end; timer()*1000 ans = 3940. -->timer();for j=1:100; for i=1:100; a(1,i) = 1; end; end; timer() ans = 0.7 As you see, Gambit outperforms all of them and only MzScheme gets close. I believe that the main reason is of Gambit having a *COMPILED* version of Meroon, which provides it with a fast dispatching mechanism => a fast way to check whether an object is or not of a given class => setting/retrieving fields is faster. DISCLAIMER ---------- In case you download it, please remember it's just a prototype: it lacks all of the functions that you would expect from a matrix algebra environment, and only provides the kernel plus some useful Scheme libraries. 0) This is free software. You can hack it, wrap it, jump on top of it or do whatever you want, but I deserve usual acknowledgement for my work 1) The whole package is provided as is. No guarantee, neither explicit nor implicit is made about the suitability of the software for your purpose or needs. 2) You use this software at your own risk: I shall not be resposible for any damage, loss of data or undesired consequence of using the program. TO-DO ----- For the moment these are my main objectives: + Add a decent set of solvers for linear systems. + Delayed operations. + Add hypermatrices and sparse matrices. + Add an interface to the FFTPACK library. WHERE TO GET IT!!! ------------------ http://www.arrakis.es/~worm/schelab.html -- Juan Jose Garcia Ripoll job: jjgarcia@ind-cr.uclm.es Dpto. de Matematicas home: worm@arrakis.es E.T.S.I. Industriales www: http://www.arrakis.es/~worm Univ. de Castilla-La Mancha Ciudad Real (Spain)