[Top][All Lists]

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

Re: [gforth] Gforth's fsl-util.*

From: Bernd Paysan
Subject: Re: [gforth] Gforth's fsl-util.*
Date: Sun, 25 Nov 2012 15:40 +0100
User-agent: KMail/4.8.5 (Linux/3.4.11-2.16-desktop; KDE/4.8.5; x86_64; ; )

Am Sonntag, 25. November 2012, 13:01:31 schrieb David Kuehling:
> Hi,
> I've recently come to using the FSL (Forth scientific library)
> matrix/array support that ships with Gforth as fsl-util.4th.
> A few comments/questions about that:
>  * Gforth CVS contains two files, fsl-util.4th and fsl-util.fs where
>    fsl-util.fs seems to be the more recent version, however only only
>    fs-util.4th is installed.  Is that by mistake?


>  * Both files suffer from printing out text to stdout during loading,
>    even with WARNINGS OFF, which makes them somewhat unusable from
>    scripts that need well-defined (machine-readable) output.  (Though
>    there's a workaround [1])

This should be fixed, at least something like

script? 0= [IF] <print version> [THEN]

>  * The Vector/Matrix indexing operators '}' and '}}' have quite some
>    overhead when implemented in Forth.  What about adding them as
>    primitives?  (I volunteer for the job unless there're objections).

They also have some overhead when added as primitive, though that is of course 
less.  IMHO, the FSL indexing operators are broken by design, as most Forth 
compilers don't do strength reduction, and even those who might can't do it in 
FSL, because the multiplication value is possibly aliased to other memory 
writes.  What you *want* is a slicing operator, which gives you a ( step end 
start ) on the stack, so that you can do

DO I f@ <operation> dup +LOOP drop

probably all, including the slicing operator, wrapped into some nicer syntax, 
which does all the looping for you.

It's probably better spent time to use the numeric primitives v* and faxpy 
inside FSL where possible; and adding the slice+looping operators I suggested 
above, this would speed up FSL considerably more than speeding up } and }}.

Bernd Paysan
"If you want it done right, you have to do it yourself"

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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