Mercurial > octave
changeset 31852:2c9418209425
maint: Merge stable to default
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 24 Feb 2023 17:45:59 -0500 |
parents | 43d56bbe9d40 (current diff) 0d77475a7507 (diff) |
children | 5c046a512888 |
files | |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/expr.txi Fri Feb 24 16:46:43 2023 -0500 +++ b/doc/interpreter/expr.txi Fri Feb 24 17:45:59 2023 -0500 @@ -144,6 +144,18 @@ @end group @end example +The shape rules for @var{A}(@var{P}) are: +@itemize @bullet +@item When at least one of @var{A} or @var{P} has two or more dimensions, then +@var{A}(@var{P}) takes the shape of @var{P}. This happens when at least one +of the variables is a 2-D matrix or an N-D array. + +@item When both @var{A} and @var{P} are 1-D vectors, then @var{A}(@var{P}) takes +the shape of @var{A} itself. In particular, when @var{A} is a row vector, then +@var{A}(@var{P}) is also a row vector irrespective of @var{P}'s shape. The +case when @var{A} is a column vector is analogous. +@end itemize + Note that it is permissible to use a 1-D index with a multi-dimensional object (also called linear indexing). In this case, the elements of the multi-dimensional array are taken in column-first order like Fortran. That is,