Work on docs matrix2
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 4 Oct 2021 18:46:06 +0000 (11:46 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 4 Oct 2021 18:46:06 +0000 (11:46 -0700)
doc/matrices.texi

index 835a7e19ebc863ef95aded353818bf139231992d..af3d508dfa62ae65b3276d5eefa543a2c6961dba 100644 (file)
@@ -734,8 +734,8 @@ matrix language represents a single matrix.
 
 The matrix language does not support missing values.
 
-@node Matrix Expressions
-@subsection Matrix Expressions
+@node Matrix Operators
+@subsection Matrix Operators
 
 Many matrix commands use expressions.  A matrix expression may use the
 following operators, listed in descending order of operator
@@ -768,7 +768,7 @@ precedence:
 Each of these operators is described in more detail below.
 
 @node Matrix Construction Operator
-@subsubsection The Matrix Construction Operator @t{@{@}}
+@subsubsection Matrix Construction Operator @t{@{@}}
 
 Use the @t{@{}@t{@}} operator to construct matrices.  Within
 the curly braces, commas separate elements within a row and semicolons
@@ -844,7 +844,7 @@ curly braces can be used as follows:
 The final example above uses the transposition function @code{T}.
 
 @node Matrix Sequence Operator
-@subsubsection The Integer Sequence Operator @samp{:}
+@subsubsection Integer Sequence Operator @samp{:}
 
 The syntax @code{@var{first}:@var{last}:@var{step}} yields a row
 vector of consecutive integers from @var{first} to @var{last} counting
@@ -872,7 +872,7 @@ Here are some examples:
 @end multitable
 
 @node Matrix Index Operator
-@subsubsection The Index Operator @code{()}
+@subsubsection Index Operator @code{()}
 
 The result of the submatrix or indexing operator, written
 @code{@var{m}(@var{rindex}, @var{cindex})}, contains the rows of
@@ -933,28 +933,44 @@ number of rows or columns:
 @item @t{@{11; 12; 13; 14@}(0)} @tab @result{} @tab (error)
 @end multitable
 
-@node Matrix Unary Arithmetic Operators
-@subsubsection Unary Arithmetic Operators
+@node Matrix Unary Operators
+@subsubsection Unary Operators
 
-The unary @samp{-} operator inverts the sign of each element in its
-argument.  The unary @samp{+} operator has no effect:
+The unary operators take a single operand of any dimensions and
+operate on each of its elements independently.  The unary operators
+are:
+
+@table @code
+@item -
+Inverts the sign of each element.
+
+@item +
+No change.
+
+@item NOT
+Logical inversion: each positive value becomes 0 and each zero or
+negative value becomes 1.
+@end table
+
+Examples:
 
 @multitable @columnfractions .4 .05 .4
 @item @t{-@{1, -2; 3, -4@}} @tab @result{} @tab @t{@{-1, 2; -3, 4@}}
 @item @t{+@{1, -2; 3, -4@}} @tab @result{} @tab @t{@{1, -2; 3, -4@}}
+@item @t{NOT @{1, 0; -1, 1@}} @tab @result{} @tab @t{@{0, 1; 1, 0@}}
 @end multitable
 
-@node Matrix Elementwise Operators
-@subsubsection Elementwise Operators
+@node Matrix Elementwise Binary Operators
+@subsubsection Elementwise Binary Operators
 
-The elementwise operators require their operands to be matrices with
-the same dimensions.  Alternatively, if one operand is a scalar, then
-its value is treated as if it were duplicated to the dimensions of the
-other operand.  The result is a matrix of the same size as the
+The elementwise binary operators require their operands to be matrices
+with the same dimensions.  Alternatively, if one operand is a scalar,
+then its value is treated as if it were duplicated to the dimensions
+of the other operand.  The result is a matrix of the same size as the
 operands, in which each element is the result of the applying the
 operator to the corresponding elements of the operands.
 
-The elementwise operators are listed below.
+The elementwise binary operators are listed below.
 
 @itemize @bullet
 @item
@@ -1010,9 +1026,6 @@ The logical operators, which treat positive operands as true and
 nonpositive operands as false.  They yield 0 for false and 1 for true:
 
 @table @code
-@item NOT
-True if its single operand is false.
-
 @item AND
 True if both operands are true.
 
@@ -1025,7 +1038,7 @@ True if exactly one operand is true.
 @end itemize
 
 @node Matrix Multiplication Operator
-@subsubsection The Matrix Multiplication Operator @samp{*}
+@subsubsection Matrix Multiplication Operator @samp{*}
 
 If @code{A} is an @math{@var{m}@times{}@var{n}} matrix and @code{B} is
 an @math{@var{n}@times{}@var{p}} matrix, then @code{A*B} is the
@@ -1047,7 +1060,7 @@ Some examples:
 @end multitable
 
 @node Matrix Exponentiation Operator
-@subsubsection The Matrix Exponentiation Operator @code{**}
+@subsubsection Matrix Exponentiation Operator @code{**}
 
 The result of @code{A**B} is defined as follows when @code{A} is a
 square matrix and @code{B} is an integer scalar: