Re: Thanks! One down, but another pops up it seems :)

From: George <>
Date: Sat, 8 May 1999 14:42:30 -0700

[CC'd the list to get some discussion there going]

On Sat, May 08, 1999 at 04:00:52PM -0400, Squeak wrote:
> Thanks for all those patches, my project is all done (the structural
> equilibrium thingy i needed all the matrices for).

cool ... I'm glad it helped :) And I'm definately thankful for the
bugreports, I'll release 0.4.2 soon with all those fixes (and more:).

> Is there any help on writing extra builtin functions? (For speed).

All the instructions that are now available are in the README file. Which is
of course highly inadequate. I'm always thinking about starting to convert
the thing into proper DocBook and making it more readable. Maybe someone on
the list wants to get the ball rolling on that. I'd probably be much more
persuaded to write new docs if it was all nicely converted to docbook :)

BTW: What do you mean by "For speed"??? Do you mean documenting on how to
make your functions faster? I haven't done that much research in how to
optimize the functions yet, though of course, you may want to precalculate
all constants instead of leaving it for runtime, probably use iterative
methods more then recursive. (Though I will do what most scheme interpretors
do in this area of treating some recursions as loops, but that will require
more thought on the ramifications of such optimizations, and iterative loops
will still be faster, as they don't push a new variable context)

Also note that passing matrices by value is actually a tiny bit faster then
passing them by reference. This sounds weird but it's the truth. Internally
no new copy is made until you actually change the matrix. So there is still
only one copy if you only use the data. So unless you want to modify the
matrix inside the function it's faster and nicer to pass it by value.
Similiar for numbers (the gmp types as also treated with copy-on-write kind
of algs). There are still places where I can use this strategy, such as
function bodies and others where data is still copied.

Another performance modification is perhaps not using the ; too much. If the
';' is used on the end of a loop body or a function body, it acually adds
";." which means that it returns a NULL. due to the fact that a lot of things
are copy-on-write, returning null and something might have the same
performance penalty, but with the NULL you have added a ';' operator and a
null node that have to be evaluated. I haven't done any meassurements on this
so I don't know.

If anyone cares to do any speed comparisons I'd be greatfull as it would help
me pinpoint where the bottlenecks are.

> How bout symbolic math? maybe just scalar variables? I'd love to be able
> to watch a variables propagation thru all these matrix operations. Dunno
> if that'd be doable, probably would slow things down alot, but hey I can
> always dream.

Symbolic math is definately something that I want to add in the long run,
though something that I'll probably need someone else to help me in that

The idea so far would be this. You would write your expression and preceed it
with a keyword "symbolic". Then the calculator would go in, and do it's work
as a symbolic calculator.

The problems here is, When should the symbolic evaluation engine enter a user
function and when should it treat it as an entity. I think the answer here
would be to make a list of functions that are treated as entities (somewhat
like the online function descriptions are handeled now). For example you
don't want sin(x) to ever be entered, but you want some user functions to be
entered and calculated symbolically.


George Lebl <>
  The following implements RSA in perl and is illegal to export from the US:
          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
Received on Sat May 08 1999 - 14:42:37 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:02 CDT