www.delorie.com/gnu/docs/octave/octave_50.html   search  
 
Buy GNU books!


GNU Octave

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1.1 Empty Matrices

A matrix may have one or both dimensions zero, and operations on empty matrices are handled as described by Carl de Boor in An Empty Exercise, SIGNUM, Volume 25, pages 2--6, 1990 and C. N. Nett and W. M. Haddad, in A System-Theoretic Appropriate Realization of the Empty Matrix Concept, IEEE Transactions on Automatic Control, Volume 38, Number 5, May 1993. Briefly, given a scalar s, an m by n matrix M(mxn), and an m by n empty matrix [](mxn) (with either one or both dimensions equal to zero), the following are true:

 
s * [](mxn) = [](mxn) * s = [](mxn)

    [](mxn) + [](mxn) = [](mxn)

    [](0xm) *  M(mxn) = [](0xn)

     M(mxn) * [](nx0) = [](mx0)

    [](mx0) * [](0xn) =  0(mxn)

By default, dimensions of the empty matrix are printed along with the empty matrix symbol, `[]'. The built-in variable print_empty_dimensions controls this behavior.

Built-in Variable: print_empty_dimensions
If the value of print_empty_dimensions is nonzero, the dimensions of empty matrices are printed along with the empty matrix symbol, `[]'. For example, the expression

 
zeros (3, 0)

will print

 
ans = [](3x0)

Empty matrices may also be used in assignment statements as a convenient way to delete rows or columns of matrices. See section Assignment Expressions.

Octave will normally issue a warning if it finds an empty matrix in the list of elements that make up another matrix. You can use the variable empty_list_elements_ok to suppress the warning or to treat it as an error.

Built-in Variable: empty_list_elements_ok
This variable controls whether Octave ignores empty matrices in a matrix list.

For example, if the value of empty_list_elements_ok is nonzero, Octave will ignore the empty matrices in the expression

 
a = [1, [], 3, [], 5]

and the variable a will be assigned the value [ 1, 3, 5 ].

The default value is "warn".

When Octave parses a matrix expression, it examines the elements of the list to determine whether they are all constants. If they are, it replaces the list with a single matrix constant.

Built-in Variable: propagate_empty_matrices
If the value of propagate_empty_matrices is nonzero, functions like inverse and svd will return an empty matrix if they are given one as an argument. The default value is 1.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003