# Logical Operators (tables)

All inequality operators return logical values (either 0/false or 1/true).

& | Scalar | Row Vector | Column Vector | Matrix |
---|---|---|---|---|

Scalar | Returns a true or false value (1 or 0) based on whether both expressions are true. | Returns a vector the size of the row vector populated with true or false values (1 or 0). If the scalar value is not true, the entire vector is false. If the scalar is true and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Returns a vector the size of the column vector populated with true or false values (1 or 0). If the scalar value is not true, the entire vector is false. If the scalar is true and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Returns a matrix the size of the original matrix, populated with true or false values (1 or 0). If the scalar value is not true, the entire matrix is false. If the scalar is true and only specific entities of the matrix are false, only those corresponding positions in the new matrix are false as well. |

Row Vector | Returns a vector the size of the row vector populated with true or false values (1 or 0). If the scalar value is not true, the entire vector is false. If the scalar is true and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Requires both vectors to be the same size. Returns a vector the size of the row vector populated with true or false values (1 or 0). If one vector is populated entirely with false, the entire new vector is false. If one vector is true and only specific entities of the other vector are false, only those corresponding positions in the new vector are false as well. | ||

Column Vector | Returns a vector the size of the column vector populated with true or false values (1 or 0). If the scalar value is not true, the entire vector is false. If the scalar is true and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Requires both vectors to be the same size. Returns a vector the size of the column vector populated with true or false values (1 or 0). If one vector is populated entirely with false, the entire new vector is false. If one vector is true and only specific entities of the other vector are false, only those corresponding positions in the new vector are false as well. | ||

Matrix | Returns a matrix the size of the original matrix, populated with true or false values (1 or 0). If the scalar value is not true, the entire matrix is false. If the scalar is true and only specific entities of the matrix are false, only those corresponding positions in the new matrix are false as well. | Requires both matrices to be the same size. Returns a matrix the size of the matrices populated with true or false values (1 or 0). If one matrix is populated entirely with false, the entire new matrix is false. If one matrix is true and only specific entities of the other vector are false, only those corresponding positions in the new matrix are false as well. |

| | Scalar | Row Vector | Column Vector | Matrix |
---|---|---|---|---|

Scalar | Returns a true or false value (1 or 0) based on whether one expressions is true. | Returns a vector the size of the row vector populated with true or false values (1 or 0). If the scalar value is true, the entire vector is true. If the scalar is false and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Returns a vector the size of the column vector populated with true or false values (1 or 0). If the scalar value is true, the entire vector is true. If the scalar is false and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Returns a matrix the size of the matrix populated with true or false values (1 or 0). If the scalar value is true, the entire matrix is true. If the scalar is false and only specific entities of the matrix are false, only those corresponding positions in the new matrix are false as well. |

Row Vector | Returns a vector the size of the row vector populated with true or false values (1 or 0). If the scalar value is true, the entire vector is true. If the scalar is false and only specific entities of the vector are false, only those corresponding positions in the new vector are false as well. | Returns a vector the size of the row vectors populated with true or false values (1 or 0). If one vector is populated entirely with true, the entire new vector is true. If one vector is false and only specific entities of the other vector are false, only those corresponding positions in the new vector are false as well. | ||

Column Vector | Requires both vectors to be the same size. Returns a vector the size of the column vectors populated with true or false values (1 or 0). If one vector is populated entirely with true, the entire new vector is true. If one vector is false and only specific entities of the other vector are false, only those corresponding positions in the new vector are false as well. | |||

Matrix | Requires both matrices to be the same size. Returns a vector the size of the matrices populated with true or false values (1 or 0). If one matrix is populated entirely with true, the entire new vector is true. If one matrix is false and only specific entities of the other matrix are false, only those corresponding positions in the new matrix are false as well. |

~ | Scalar | Row Vector | Column Vector | Matrix |
---|---|---|---|---|

If the scalar is true (or any number other than zero), will produce a false, and if the scalar is false, will produce a true. | Returns a vector the same size as the row vector, populated with true or false values based on whether the logical is true or false for each entity in the vector. If the scalar is true (or any number other than zero), a false will be returned, and if the scalar is false, a true will be returned. | Returns a vector the same size as the column vector, populated with true or false values based on whether the logical is true or false for each entity in the vector. If the scalar is true (or any number other than zero), a false will be returned, and if the scalar is false, a true will be returned. | Returns a vector the same size as the matrix, populated with true or false values based on whether the logical is true or false for each entity in the matrix. If the scalar is true (or any number other than zero), a false will be returned, and if the scalar is false, a true will be returned. |

## Examples

```
~ [6 3 0 6]
[1 5 3] & [4 0 3]
[1 5 3] | [4 0 0]
```

```
[4 2 5] & [6 9 4 2]
[7; 9; 3] | [6 8]
```