[Numpy-discussion] matrix multiply
Charles R Harris
Sun Apr 6 14:27:13 CDT 2008
On Sun, Apr 6, 2008 at 12:59 PM, Alan G Isaac <email@example.com> wrote:
> > On 06/04/2008, Alan G Isaac <firstname.lastname@example.org> wrote:
> >> Just checking:
> >> it's important to me that this won't change
> >> the behavior of boolean matrices, but I don't
> >> see a test for this. E.g., ::
> >> >>> import numpy as N
> >> >>> A = N.mat('1 0;1 1',dtype='bool')
> >> >>> A**2
> >> matrix([[ True, False],
> >> [ True, True]], dtype=bool)
> On Sun, 6 Apr 2008, Anne Archibald apparently wrote:
> > I have no desire to change the behaviour of boolean matrices, and I'll
> > write a test, but what is it supposed to do with them? Just produce
> > reduce(dot,[A]*n)?
> That's the part I care about.
> > For zero it will give the identity,
> > and for negative powers some sort of floating-point
> > inverse.
> That deserves discussion.
> Not all "invertible" boolean matrices have an inverse in the algebra.
> Just the orthogonal ones do.
> I guess I would special case inverses for Boolean matrices.
> Just test if the matrix B is orthogonal (under Boolean
> multiplication) and if so return B's transpose.
> > Currently for positive powers it should produce the right
> > answer provided multiplication is associative (which
> > I think it is).
> Yes; N×N boolean matrices are I believe a semi-group under multiplication.
The boolean algebra is a field and the correct addition is xor, which is
the same as addition modulo 2. This makes all matrices with determinant 1
invertible. This isn't the current convention, however, as it was when
Caratheodory was writing on measures and rings of sets were actually rings
and the symmetric difference was used instead of union.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion