William Stein wrote:
> On Wed, May 14, 2008 at 6:57 AM, David Joyner <[EMAIL PROTECTED]> wrote:
>> On Wed, May 14, 2008 at 8:54 AM, Pedro Patricio <[EMAIL PROTECTED]> wrote:
>>>  nope, booleans means 1+1=1.
>>>  take + as OR and * as AND in the propositional calculus.
> 
> So 1+1 = 1 and 1*1 = 1 and 1*0 = 0 and 1+0 = 1 and 0+0=0?
> That's *not* a ring, so you shouldn't make matrices over it in
> Sage, since in Sage all matrices are over rings.
> 
> You could "fake things" by creating a new "the booleans" data
> type but then you are asking for trouble since they aren't a ring.
> 
> You could also just make a very simple boolean type with
> the properties you want and make a numpy matrix with
> entries that type.  What do you actually want to *do* with
> your boolean matrix?
>

 From your post on sage-edu, it sounds like you just want the adjacency 
matrix of the transitive closure of a digraph; is that right?  If so, 
you might use the transitive closure function.  I can't remember if it 
is defined for digraphs, but it should be easy to extend.

It should be particularly easy in the digraph case because the 
transitive closure of a strongly connected component is a (digraph) 
clique.  So, in the end, you might ask for the strongly connected 
components of the digraph and then work from there (just figure out 
which components are connected to which other ones).

I think that would be the much more natural way to solve your problem. 
Especially since it uses graph algorithms instead of matrix 
multiplication, which hopefully is faster.

If you need more of a hint for the direction to go, let me know.

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to