#18485: Make function to generate *all* independent sets.
-------------------------------------+-------------------------------------
Reporter: Rudi | Owner: Rudi
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-7.0
Component: matroid theory | Resolution:
Keywords: | Merged in:
Authors: Rudi Pendavingh | Reviewers: Vincent Delecroix,
Report Upstream: N/A | Travis Scrimshaw
Branch: | Work issues:
u/tscrim/matroid_all_independent_sets-18485| Commit:
Dependencies: | 4a5bd5f18c87dbbc2c61423e13492ee384d0e5fb
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by Rudi):
Hi Vincent,
thanks for the feedback.
Replying to [comment:51 vdelecroix]:
> 1. This is very bad
> {{{
> + I = <bitset_t*>sage_malloc((r + 1) * sizeof(bitset_t))
> + T = <bitset_t*>sage_malloc((r + 1) * sizeof(bitset_t))
> + for i in range(r + 1):
> + bitset_init(I[i], self._bitset_size)
> + bitset_init(T[i], self._bitset_size)
> }}}
> It calls `2(r+2)` times memory allocation for arrays of fixed size!
There should be only *one* memory allocation call for everything.
>
The overhead of these 2(r+2) memory allocations is negligible compared to
the other work that independent_sets() does. Most subsets of the ground
set of cardinality at most r will be independent, so for a matroid on n
elements, writing the output takes time proportional to ` \sum_{i=0}^r (n
choose i)`. So when this memory allocation takes more than a microsecond,
were looking at an r in the hundreds. Then the function as a whole will
probably take many years.
--
Ticket URL: <http://trac.sagemath.org/ticket/18485#comment:54>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.