MatrixQ¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
MatrixQ[expr]
gives True if expr is a list of lists that can represent a matrix, and gives False otherwise.
MatrixQ[expr, test]
gives True only if test yields True when applied to each of the matrix elements in expr.
MatrixQ[expr] gives True only if expr is a list and each of its elements is a list of the same length,
containing no elements that are themselves lists.
MatrixQ[expr, NumberQ] tests whether expr is a numerical matrix.
Examples¶
No verified examples yet for this function.
Implementation notes¶
builtin_matrixq (src/list.c) returns True when the argument is a non-empty List of equal-length List rows whose entries are non-lists; with an optional test argument each entry must instead satisfy test[entry] (evaluated to True). Any ragged row, empty outer list, or failing entry yields False.
Attributes: Protected.
Implementation status¶
Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
References¶
- Source:
src/list.c - Specification:
docs/spec/builtins/expression-information.md
Notes & additional examples¶
Worked examples¶
Notes¶
MatrixQ is True for a list of equal-length lists; a flat (rank-1) list is a vector, not a matrix.