2.5 Boolean Matrices

Boolean constants are %t and %f. They can be used in boolean matrices. The syntax is the same as for ordinary matrices i.e. they can be concatenated, transposed, etc...

Operations symbols used with boolean matrices or used to create boolean matrices are == and ~.

If B is a matrix of booleans or(B) and and(B) perform the logical or and and.

-->%t
 %t  =
 
  T  
 
-->[1,2]==[1,3]
 ans  =
 
! T F !
 
-->[1,2]==1
 ans  =
 
! T F !
 
-->a=1:5; a(a>2)
 ans  =
 
!   3.    4.    5. !

-->A=[%t,%f,%t,%f,%f,%f];   
 
-->B=[%t,%f,%t,%f,%t,%t]
 B  =
 
! T F T F T T !
 
-->A|B
 ans  =
 
! T F T F T T !

-->A&B
 ans  =
 
! T F T F F F !

Sparse boolean matrices are generated when, e.g., two constant sparse matrices are compared. These matrices are handled as ordinary boolean matrices.