# bug #41478: Include non-standard logical matrix-multiply operations

 Submitter: David Spies Submitted: Thu 06 Feb 2014 07:56:21 AM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: Feature Request Status: None Assigned to: None Originator Name: Open/Closed:  * Open Release:  * dev Operating System:  * Any Fixed Release: None Planned Release: None
* Mandatory Fields

Add a New Comment Rich Markup

## Discussion

Thu 06 Feb 2014 07:56:21 AM UTC, original submission:

Can you add three fairly standard logical matrix multiply operations (particularly for sparse matrices) which can be useful for dealing with graphs and adjacency matrices?

mult_any
Same as
res = logical(A * B)

mult_all
Same as
res = A * B == sum(B,1)
(here the '==' is automatically broadcasted)
This one is the one I actually need since the matrix A * B may require more memory than I have available, but I suspect there's a more memory efficient way to make this particular computation.
Particularly if we find a k such that A(i,k) is false and B(k,j) is true than res(i,j) must be false (without having to explore other k-values)

mult_parity
Same as
res = logical(mod(A * B,2))

You can think of these operations in the context that the columns of B mark sets of relevant variables and the rows of A are values for those variables.  The resulting matrix represents each of the operations (any, or, parity) for each set of values on each set of variables.

Note that a normal matrix multiply can be thought of as mult_join_sum for a logical matrix B.

I suppose there could be others like mult_maj, but that doesn't correspond to a commutative associative binary operation like the others (and, or, xor), so I expect there might not be anything to be gained by implementing it explicitly.

David Spies <dspyz>

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by dspyz (Submitted the item)
•