Compile with Boolean Arrays
- To: mathgroup at smc.vnet.net
- Subject: [mg111679] Compile with Boolean Arrays
- From: Stephen Wandzura <smwandzura at hrl.com>
- Date: Tue, 10 Aug 2010 03:54:54 -0400 (EDT)
- Reply-to: Stephen Wandzura <wandzura at mac.com>
Can anyone explain why this works:
MatrixMultiply =
Compile[
{{a, _Integer, 2}, {x, _Integer, 1}},
Inner[Times, a, x, Plus],
{{Inner[__], _Integer, 1}}
]
MatrixMultiply[{{2, 0}, {0, 1}}, {2, 1}]
But this doesn't:
LogicalMatrixMultiply =
Compile[
{{a, True | False, 2}, {x, True | False, 1}},
Inner[And, a, x, Or],
{{Inner[__], True | False, 1}}
]
LogicalMatrixMultiply[{{True, False}, {False, True}}, {True, False}]
I thought I used the correct syntax for Boolean arguments in Compile...