Ilya Zakharevich on Tue, 20 May 2003 13:30:51 -0700


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

Re: charpoly using too much stack space !


On Tue, May 20, 2003 at 11:19:59AM -0500, Gonzalo Tornaria wrote:
> we need to multiply several times by the same sparse matrix, we should
> "study" the matrix first (just once), and then use this every time. This
> is perfect for charpoly, where all the work amounts to "n"
> multiplications by the same (presumably sparse) matrix.  Note that the
> intermediate results are NOT sparse (in general).

Easy to do when t_EXT is finally in.

Hope this helps,
Ilya

P.S.  I had an interesting interchange in the private mail about
      (dis)advantages of t_EXT.  I got another idea which may make
      things much better maintainance-wise.

      Old version:

	  t_EXT has n+2 >= 2 words: the first as usual, the second a
	  pointer to the dispatch table for different operations, the
	  other n words are subtype-specific (used by the dispatch table
	  entries only).

      New version:

	  t_EXT has undefined (opaque) storage layout.  All the
	  manipulations are done by API (no direct access to fields).
	  It is created on stack by a call

	     GEN g = stack_EXT(subtype_atom, n);

	  Here subtype_atom is created by

	    subtype_atom_t subtype_atom =
	      subtype_create(dispatch_table, sizeof(*dispatch_table));

          (the second argument allows extension of the dispatch_table
          while keeping binary compatibility with extensions).

	  The n "private words" are accessed by a macro

	      long word = EXT_nth(g, n, subtype_atom);

      This way one can start immediatly using the t_EXT patch (after
      defining the above 3 macros, and typedef EXT_dispatch_table_t
      *subtype_atom_t), while not committing ourselves to the
      particular implementation.

      What do people think?

Ilya