Module boolmatrix
A data type returned by various matrix predicate operations.
Inherits from CommonWriteOps and XprOps.
Functions
BoolMatrix:all (how) | Are all entries true? |
BoolMatrix:any (how) | Are any entries true? |
BoolMatrix:band (other) | Boolean and of the two matrices. |
BoolMatrix:bor (other) | Boolean or of the two matrices. |
BoolMatrix:__call (_row_, _col_) | Metamethod. |
BoolMatrix:cols () | Getter. |
BoolMatrix:count () | Getter. |
BoolMatrix:__eq () | Metamethod. |
BoolMatrix:rows () | Getter. |
BoolMatrix:select (then_source, else_source) | Given two matrices, or a matrix-scalar pair (where the scalar is interpreted as a constant matrix matching its partner in shape), goes through this matrix's coefficents, building up a new output matrix. |
BoolMatrix:size () | Getter. |
BoolMatrix:__tostring () | Metamethod. |
Functions
- BoolMatrix:all (how)
-
Are all entries true?
Parameters:
- how (TODO: "colwise", "rowwise", or nothing)
Returns:
-
BoolMatrix
A column or row vector with results for column or row (q.v. how).
Or
-
boolean
Were all entries true?
- BoolMatrix:any (how)
-
Are any entries true?
Parameters:
- how As per BoolMatrix:all.
Returns:
-
BoolMatrix
Ditto.
Or
-
boolean
Was any entry true?
- BoolMatrix:band (other)
-
Boolean and of the two matrices.
Parameters:
- other BoolMatrix
Returns:
-
BoolMatrix
res
- BoolMatrix:bor (other)
-
Boolean or of the two matrices.
Parameters:
- other BoolMatrix
Returns:
-
BoolMatrix
res
- BoolMatrix:__call (_row_, _col_)
-
Metamethod.
Fetch the coefficient at the given row and column (or offset for vectors).
Parameters:
- _row_ uint Matrix row (or offset, in a vector).
- _col_ uint Matrix column (must be present unless this is a vector).
Returns:
-
boolean
Coefficient.
- BoolMatrix:cols ()
-
Getter.
Returns:
-
uint
Number of columns.
- BoolMatrix:count ()
-
Getter.
Returns:
-
uint
Number of true coefficients. (TODO: should support "colwise", "rowwise")
- BoolMatrix:__eq ()
-
Metamethod.
Compares two BoolMatrix instances.
Returns:
-
boolean
Are the two matrices equal?
- BoolMatrix:rows ()
-
Getter.
Returns:
-
uint
Number of rows.
- BoolMatrix:select (then_source, else_source)
-
Given two matrices, or a matrix-scalar pair (where the scalar is interpreted as a
constant matrix matching its partner in shape), goes through this matrix's coefficents,
building up a new output matrix. Any true coefficient results in the corresponding
entry coming from then_source, otherwise from else_source.
TODO: If both matrices, then and else must have same shape?
Parameters:
- then_source Matrix or Scalar
- else_source Matrix or Scalar
Returns:
-
Matrix
R
- BoolMatrix:size ()
-
Getter.
Returns:
-
uint
Number of elements (rows × columns).
- BoolMatrix:__tostring ()
-
Metamethod.
Calls to tostring (and thus to print ) will pretty-print this matrix.