Matrix and Vector Entry Selection
In the LinearAlgebra package, many functions that operate on Matrices and Vectors include an "element, row or column selection" parameter L in their calling sequence. The parameter L can be one of an integer, a range of integers, or a list of integers and/or ranges of integers.
By using one of these types for L, you can select one row (column), a range of rows (columns), or a list of rows (columns) from a Matrix, respectively. Similarly, you can select one element, a range of elements, or a list of elements from a Vector.
In the following sections, V is a Vector and A is a Matrix.
Valid Values of L
Vector Entry Selection
Matrix Entries
Permissible Integer Values
If L is an integer, it must be non-zero since the indices of Matrices and Vectors always start from 1, and |L| must be between 1 and the corresponding dimension value, inclusive.
If L is a negative integer, the selection proceeds as follows: -1 selects the last row (column) or element, -2 selects the second last row (column) or element, -3 selects the third last row (column) or element, etc.
Errors and the Degenerate Case for Ranges
If L includes the range i..j with i = j+1 and 1 <= i <= dim + 1, where dim is the corresponding dimension value, then the result is degenerate in the corresponding dimension (the dimension value in that component is 0). This is not an error. Otherwise, if L includes either an empty set of indices or indices outside the appropriate dimension range, it is an error.
If a LinearAlgebra function operates on a Vector and includes L in its calling sequence, the entries specified by L are returned in the following manner.
If L is a positive integer, the Lth element of the Vector is selected.
If L is a negative integer, the element selected is as described in the Valid Values of L section above.
If L is a range i..j of integers that is not degenerate, the elements V[i] through V[j] of the Vector are selected.
If L is a list of integers and/or non-degenerate ranges with valid integer endpoints, the elements corresponding to the integer values in L are selected.
If a LinearAlgebra function operates on a Matrix and includes L in its calling sequence, the entries specified by L are returned in the following manner.
If L is a positive integer, the Lth row (column) of the Matrix is selected.
If L is a negative integer, the row (column) selected is as described in the Valid Values of L section above.
If L is a range i..j of integers that is not degenerate, the rows (columns) i through j of the Matrix are selected.
If L is a list of integers and/or non-degenerate ranges with valid integer endpoints, the rows (columns) corresponding to the integer values in L are selected.
See Also
LinearAlgebra Package Index
LinearAlgebra[SubMatrix]
LinearAlgebra[SubVector]
lists
Matrix
type[MVIndex]
Vector
Download Help Document