[metapost] memory problem

Stephan Hennig mailing_list at arcor.de
Sun May 7 12:46:12 CEST 2006


Denis.Roegel at loria.fr schrieb:
>> If you have a lot of 'not known' variables, this process can become
>> very slow.
> 
> If this is so, I wonder if some extension of metapost could 
> or should have such a notion of sets of independent equations. 

I think this is not needed. A possible solution were not to store one
list of 'not known' variables, but to store a list of equations a
variable is involved in for every 'not known' variable. Adding a new
equation would then require to scan the equation list of the first 'not
known' variable and subsequently scan the equation lists of all 'not
known' variables encountered in that scan. Consider the following
example with four equations:

2x = y                    (1)
x = y + z                 (2)

a = b                     (3)
b = 2c                    (4)

The equation lists of the six 'not known' variables are

L(x) = {1, 2}
L(y) = {1, 2}
L(z) = {2}
L(a) = {3}
L(b) = {3, 4}
L(c) = {4}.


Adding a new equation

c = a                     (5)

requires to

scan L(c) which points to equation (4).
          There are two variables in (4), b and c . So recurse

  scanning L(b) which finds equation (3),
           with variables a and b. We now

    scan L(a) which doesn't find a new equation. Next we
    scan L(b), which we're already processing. We now return

  scanning L(c) from (4), which again gives us equation (4). Finally,
           in equation (5) we find another variable a. Since we already

scanned L(a), we're done. The equation system is (5), (4), (3).

As you can see only variables belonging to one equation system are
investigated. Independent equation systems do not interfere.

Taco, could you please give a short outline about future MetaPost
development -- the difficulties and the easy parts (if there are any) --
for all those who didn't attend BachoTeX? Is MetaPost ready for such
proposals?

Regards,
Stephan Hennig



More information about the metapost mailing list