This is Info file octave.info, produced by Makeinfo version 1.67 from
the input file /ade-src/fsf/octave/doc/interpreter/octave.texi.

START-INFO-DIR-ENTRY
* Octave: (octave).	Interactive language for numerical computations.
END-INFO-DIR-ENTRY

   Copyright (C) 1996 John W. Eaton.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.


File: octave.info,  Node: Miscellaneous Utilities,  Prev: Evaluating Strings as Commands,  Up: Programming Utilities

Miscellaneous Utilities
=======================

   The following functions allow you to determine the size of a
variable or expression, find out whether a variable exists, print error
messages, or delete variable names from the symbol table.

 - Function File:  columns (A)
     Return the number of columns of A.

 - Function File:  rows (A)
     Return the number of rows of A.

 - Function File:  length (A)
     Return the number of rows of A or the number of columns of A,
     whichever is larger.

 - Function File:  size (A, N)
     Return the number rows and columns of A.

     With one input argument and one output argument, the result is
     returned in a 2 element row vector.  If there are two output
     arguments, the number of rows is assigned to the first, and the
     number of columns to the second.  For example,

          octave:13> size ([1, 2; 3, 4; 5, 6])
          ans =
          
            3  2
          
          octave:14> [nr, nc] = size ([1, 2; 3, 4; 5, 6])
          nr = 3
          
          nc = 2

     If given a second argument of either 1 or 2, `size' will return
     only the row or column dimension.  For example

          octave:15> size ([1, 2; 3, 4; 5, 6], 2)
          ans = 2

     returns the number of columns in the given matrix.

 - Built-in Function:  is_global (A)
     Return 1 if A is globally visible.  Otherwise, return 0.

 - Function File:  is_matrix (A)
     Return 1 if A is a matrix.  Otherwise, return 0.

 - Function File:  is_vector (A)
     Return 1 if A is a vector.  Otherwise, return 0.

 - Function File:  is_scalar (A)
     Return 1 if A is a scalar.  Otherwise, return 0.

 - Function File:  is_square (X)
     If X is a square matrix, then return the dimension of X.
     Otherwise, return 0.

 - Function File:  is_symmetric (X, TOL)
     If X is symmetric within the tolerance specified by TOL, then
     return the dimension of X.  Otherwise, return 0.  If TOL is
     omitted, use a tolerance equal to the machine precision.

 - Built-in Function:  isstr (A)
     Return 1 if A is a string.  Otherwise, return 0.

 - Function File:  isempty (A)
     Return 1 if A is an empty matrix (either the number of rows, or
     the number of columns, or both are zero).  Otherwise, return 0.

 - Command: clear PATTERN ...
     Delete the names matching the given patterns from the symbol
     table.  The pattern may contain the following special characters:
    `?'
          Match any single character.

    `*'
          Match zero or more characters.

    `[ LIST ]'
          Match the list of characters specified by LIST.  If the first
          character is `!' or `^', match all characters except those
          specified by LIST.  For example, the pattern `[a-zA-Z]' will
          match all lower and upper case alphabetic characters.

     For example, the command

          clear foo b*r

     clears the name `foo' and all names that begin with the letter `b'
     and end with the letter `r'.

     If `clear' is called without any arguments, all user-defined
     variables (local and global) are cleared from the symbol table.  If
     `clear' is called with at least one argument, only the visible
     names matching the arguments are cleared.  For example, suppose
     you have defined a function `foo', and then hidden it by
     performing the assignment `foo = 2'.  Executing the command `clear
     foo' once will clear the variable definition and restore the
     definition of `foo' as a function.  Executing `clear foo' a second
     time will clear the function definition.

     This command may not be used within a function body.

 - Command: who OPTIONS PATTERN ...
 - Command: whos OPTIONS PATTERN ...
     List currently defined symbols matching the given patterns.  The
     following are valid options.  They may be shortened to one
     character but may not be combined.

    `-all'
          List all currently defined symbols.

    `-builtins'
          List built-in variables and functions.  This includes all
          currently compiled function files, but does not include all
          function files that are in the `LOADPATH'.

    `-functions'
          List user-defined functions.

    `-long'
          Print a long listing including the type and dimensions of any
          symbols.  The symbols in the first column of output indicate
          whether it is possible to redefine the symbol, and whether it
          is possible for it to be cleared.

    `-variables'
          List user-defined variables.

     Valid patterns are the same as described for the `clear' command
     above.  If no patterns are supplied, all symbols from the given
     category are listed.  By default, only user defined functions and
     variables visible in the local scope are displayed.

     The command `whos' is equivalent to `who -long'.

 - Built-in Function:  exist (NAME)
     Return 1 if the name exists as a variable, and 2 if the name (after
     appending `.m') is a function file in the path.  Otherwise, return
     0.

 - Built-in Function:  error (MSG)
     Print the message MSG, prefixed by the string `error: ', and set
     Octave's internal error state such that control will return to the
     top level without evaluating any more commands.  This is useful for
     aborting from functions.

     If MSG does not end with a new line character, Octave will print a
     traceback of all the function calls leading to the error.  For
     example,

          function f () g () end
          function g () h () end
          function h () nargin == 1 || error ("nargin != 1"); end
          f ()
          error: nargin != 1
          error: evaluating index expression near line 1, column 30
          error: evaluating binary operator `||' near line 1, column 27
          error: called from `h'
          error: called from `g'
          error: called from `f'

     produces a list of messages that can help you to quickly locate the
     exact location of the error.

     If MSG ends in a new line character, Octave will only print MSG
     and will not display any traceback messages as it returns control
     to the top level.  For example, modifying the error message in the
     previous example to end in a new line causes Octave to only print
     a single message:

          function h () nargin == 1 || error ("nargin != 1\n"); end
          f ()
          error: nargin != 1

 - Built-in Variable: error_text

 - Built-in Variable: beep_on_error
     If the value of `beep_on_error' is nonzero, Octave will try to
     ring your terminal's bell before printing an error message.  The
     default value is 0.

 - Built-in Function:  warning (MSG)
     Print the message MSG prefixed by the string `warning: '.

 - Built-in Function:  usage (MSG)
     Print the message MSG, prefixed by the string `usage: ', and set
     Octave's internal error state such that control will return to the
     top level without evaluating any more commands.  This is useful for
     aborting from functions.

     After `usage' is evaluated, Octave will print a traceback of all
     the function calls leading to the usage message.

 - Function File:  perror (NAME, NUM)
     Print the error message for function NAME corresponding to the
     error number NUM.  This function is intended to be used to print
     useful error messages for those functions that return numeric error
     codes.

 - Function File:  menu (TITLE, OPT1, ...)
     Print a title string followed by a series of options.  Each option
     will be printed along with a number.  The return value is the
     number of the option selected by the user.  This function is
     useful for interactive programs.  There is no limit to the number
     of options that may be passed in, but it may be confusing to
     present more than will fit easily on one screen.

 - Built-in Function:  document (SYMBOL, TEXT)
     Set the documentation string for SYMBOL to TEXT.

 - Built-in Function:  file_in_path (PATH, FILE)
     Return the absolute name name of FILE if it can be found in PATH.
     The value of PATH should be a colon-separated list of directories
     in the format described for the built-in variable `LOADPATH'.

     If the file cannot be found in the path, an empty matrix is
     returned.  For example,

          octave:13> file_in_path (LOADPATH, "nargchk.m")
          ans = "/ade/share/octave/2.0/m/general/nargchk.m"

 - Built-in Function: completion_matches (HINT)
     Generate possible completions given HINT.

     This function is provided for the benefit of programs like Emacs
     which might be controlling Octave and handling user input.  The
     current command number is not incremented when this function is
     called.  This is a feature, not a bug.

 - Function File:  nargchk (NARGIN_MIN, NARGIN_MAX, N)
     If N is in the range NARGIN_MIN through NARGIN_MAX inclusive,
     return the empty matrix.  Otherwise, return a message indicating
     whether N is too large or too small.

     This is useful for checking to see that the number of arguments
     supplied to a function is within an acceptable range.

 - Built-in Function:  octave_tmp_file_name ()
     Return a unique temporary file name.

     Since the named file is not opened, by `octave_tmp_file_name', it
     is possible (though relatively unlikely) that it will not be
     available by the time your program attempts to open it.

 - Command: type NAME ...
 - Command: type [-Q] NAME ...
     Display the definition of each NAME that refers to a function.

     Normally also displays if each NAME is user-defined or builtin;
     the `-q' option suppresses this behaviour.

     Currently, Octave can only display functions that can be compiled
     cleanly, because it uses its internal representation of the
     function to recreate the program text.

     Comments are not displayed because Octave's parser currently
     discards them as it converts the text of a function file to its
     internal representation.  This problem may be fixed in a future
     release.

 - Command: which NAME ...
     Display the type of each NAME.  If NAME is defined from a function
     file, the full name of the file is also displayed.

 - Built-in Function: octave_config_info ()
     Return a structure containing configuration and installation
     information.


File: octave.info,  Node: Amusements,  Next: Emacs,  Prev: Programming Utilities,  Up: Top

Amusements
**********

 - Function File:  texas_lotto ()
     Octave cannot promise that you will actually win the lotto, but it
     can pick your numbers for you.  The function `texas_lotto' will
     select six numbers between 1 and 50.

 - Function File:  list_primes (N)
     Computes the first N primes using a brute-force algorithm.

   Other amusing functions include `casesen', `flops', `sombrero',
`exit', `quit', and `warranty'.


File: octave.info,  Node: Emacs,  Next: Installation,  Prev: Amusements,  Up: Top

Using Emacs With Octave
***********************

   The development of Octave code can greatly be facilitated using Emacs
with Octave mode, a major mode for editing Octave files which can e.g.
automatically indent the code, do some of the typing (with Abbrev mode)
and show keywords, comments, strings, etc. in different faces (with
Font-lock mode on devices that support it).

   It is also possible to run Octave from within Emacs, either by
directly entering commands at the prompt in a buffer in Inferior Octave
mode, or by interacting with Octave from within a file with Octave
code.  This is useful in particular for debugging Octave code.

   Finally, you can convince Octave to use the Emacs info reader for
`help -i'.

   All functionality is provided by the Emacs Lisp package `octave'.
This chapter describes how to set up and use this package.

   Please contact <Kurt.Hornik@ci.tuwien.ac.at> if you have any
questions or suggestions on using Emacs with Octave.

* Menu:

* Setting Up Octave Mode::
* Using Octave Mode::
* Running Octave From Within Emacs::
* Using the Emacs Info Reader for Octave::


File: octave.info,  Node: Setting Up Octave Mode,  Next: Using Octave Mode,  Prev: Emacs,  Up: Emacs

Setting Up Octave Mode
======================

   If you are lucky, your sysadmins have already arranged everything so
that Emacs automatically goes into Octave mode whenever you visit an
Octave code file as characterized by its extension `.m'.  If not,
proceed as follows.

  1. Make sure that the file `octave.el' (or better, its byte-compiled
     version `octave.elc') from the Octave distribution is somewhere in
     your load-path.

          *Note:* The current version of `octave.el' was developed,
          tested and byte-compiled under GNU Emacs 19.31.  It may not
          work under other Emacs versions, in particular under XEmacs.

  2. To begin using Octave mode for all `.m' files you visit, add the
     following lines to a file loaded by Emacs at startup time,
     typically your `~/.emacs' file:

          (autoload 'octave-mode "octave" nil t)
          (setq auto-mode-alist
                (cons '(\"\\\\.m$\" . octave-mode) auto-mode-alist))

  3. Finally, to turn on the abbrevs, auto-fill and font-lock features
     automatically, also add the following lines to one of the Emacs
     startup files:
          (add-hook 'octave-mode-hook
                    (lambda ()
                      (abbrev-mode 1)
                      (auto-fill-mode 1)
                      (if (eq window-system 'x)
                          (font-lock-mode 1))))
     See the Emacs manual for more information about how to customize
     Font-lock mode.


File: octave.info,  Node: Using Octave Mode,  Next: Running Octave From Within Emacs,  Prev: Setting Up Octave Mode,  Up: Emacs

Using Octave Mode
=================

   In Octave mode, the following special Emacs commands can be used in
addition to the standard Emacs commands.

`C-h m'
     Describe the features of Octave mode.

`LFD'
     Reindent the current Octave line, insert a newline and indent the
     new line (`octave-reindent-then-newline-and-indent').  An abbrev
     before point is expanded if `abbrev-mode' is non-`nil'.

`TAB'
     Indents current Octave line based on its contents and on previous
     lines (`indent-according-to-mode').

`;'
     Insert an "electric" semicolon (`octave-electric-semi').  If
     `octave-auto-indent' is non-`nil', typing a `;' automatically
     reindents the current line, inserts a newline and indents the new
     line.

``'
     Start entering an abbreviation (`octave-abbrev-start').  If Abbrev
     mode is turned on, typing ``C-h' or ``?' lists all abbrevs.  Any
     other key combination is executed normally.

`M-LFD'
     Break line at point and insert continuation marker and alignment
     (`octave-split-line').

`M-TAB'
     Perform completion on Octave symbol preceding point, comparing that
     symbol against Octave's reserved words and builtin variables
     (`octave-complete-symbol').

`M-C-a'
     Move backward to the beginning of a function
     (`octave-beginning-of-defun').  With prefix argument N, do it that
     many times if N is positive;  otherwise, move forward to the N-th
     following beginning of a function.

`M-C-e'
     Move forward to the end of a function (`octave-end-of-defun').
     With prefix argument N, do it that many times if N is positive;
     otherwise, move back to the N-th preceding end of a function.

`M-C-h'
     Puts point at beginning and mark at the end of the current Octave
     function, i.e., the one containing point or following point
     (`octave-mark-defun').

`M-C-q'
     Properly indents the Octave function which contains point
     (`octave-indent-defun').

`C-c ;'
     Puts the first character of `octave-comment-start' (usually `#')
     at the beginning of every line in the region
     (`octave-comment-region').  With just `C-u' prefix argument,
     uncomment each line in the region.

`C-c :'
     Uncomments every line in the region (`octave-uncomment-region').

`C-c C-p'
     Move one line of Octave code backward, skipping empty and comment
     lines (`octave-previous-code-line').  With numeric prefix argument
     N, move that many code lines backward (forward if N is negative).

`C-c C-n'
     Move one line of Octave code forward, skipping empty and comment
     lines (`octave-next-code-line').  With numeric prefix argument N,
     move that many code lines forward (backward if N is negative).

`C-c C-a'
     Move to the `real' beginning of the current line
     (`octave-beginning-of-line').  If point is in an empty or comment
     line, simply go to its beginning;  otherwise, move backwards to the
     beginning of the first code line which is not inside a continuation
     statement,  i.e., which does not follow a code line ending in `...'
     or `\', or is inside an open parenthesis list.

`C-c C-e'
     Move to the `real' end of the current line (`octave-end-of-line').
     If point is in a code line, move forward to the end of the first
     Octave code line which does not end in `...' or `\' or is inside an
     open parenthesis list.  Otherwise, simply go to the end of the
     current line.

`C-c M-C-n'
     Move forward across one balanced begin-end block of Octave code
     (`octave-forward-block').  With numeric prefix argument N, move
     forward across N such blocks (backward if N is negative).

`C-c M-C-p'
     Move back across one balanced begin-end block of Octave code
     (`octave-backward-block').  With numeric prefix argument N, move
     backward across N such blocks (forward if N is negative).

`C-c M-C-d'
     Move forward down one begin-end block level of Octave code
     (`octave-down-block').  With numeric prefix argument, do it that
     many times;  a negative argument means move backward, but still go
     down one level.

`C-c M-C-u'
     Move backward out of one begin-end block level of Octave code
     (`octave-backward-up-block').  With numeric prefix argument, do it
     that many times; a negative argument means move forward, but still
     to a less deep spot.

`C-c M-C-h'
     Put point at the beginning of this block, mark at the end
     (`octave-mark-block').  The block marked is the one that contains
     point or follows point.

`C-c ]'
     Close the current block on a separate line (`octave-close-block').
     An error is signaled if no block to close is found.

`C-c f'
     Insert a function skeleton, prompting for the function's name,
     arguments and return values which have to be entered without parens
     (`octave-insert-defun').

`C-c C-h'
     Search the function, operator and variable indices of all info
     files with documentation for Octave for entries (`octave-help').
     If used interactively, the entry is prompted for with completion.
     If multiple matches are found, one can cycle through them using
     the standard `,' (`Info-index-next') command of the Info reader.

     The variable `octave-help-files' is a list of files to search
     through and defaults to `'("octave")'.  If there is also an Octave
     Local Guide with corresponding info file `octave-LG' (for example),
     you can have `octave-help' search both files by
          (setq octave-help-files '("octave" "octave-LG"))

     in one of your Emacs startup files.

   A common problem is that the <RET> key does *not* indent the line to
where the new text should go after inserting the newline.  This is
because the standard Emacs convention is that <RET> (aka `C-m') just
adds a newline, whereas <LFD> (aka `C-j') adds a newline and indents
it.  This is particularly inconvenient for users with keyboards which
do not have a special <LFD> key at all;  in such cases, it is typically
more convenient to use <RET> as the <LFD> key (rather than typing
`C-j').

   You can make <RET> do this by adding
     (define-key octave-mode-map "\C-m"
       'octave-reindent-then-newline-and-indent)

to one of your Emacs startup files.  Another, more generally applicable
solution is
     (defun RET-behaves-as-LFD ()
       (let ((x (key-binding "\C-j")))
         (local-set-key "\C-m" x)))
     (add-hook 'octave-mode-hook 'return-behaves-as-LFD)

(this works for all modes by adding to the startup hooks, without having
to know the particular binding of <RET> in that mode!).  Similar
considerations apply for using <M-RET> as <M-LFD>.  As Barry A. Warsaw
<bwarsaw@cnri.reston.va.us> says in the documentation for his
`cc-mode', "This is a very common question. `:-)' If you want this to
be the default behavior, don't lobby me, lobby RMS!"

   The following variables can be used to customize Octave mode.

`octave-auto-newline'
     Non-`nil' means auto-insert a newline and indent after semicolons
     are typed.  The default value is `nil'.

`octave-blink-matching-block'
     Non-`nil' means show matching begin of block when inserting a
     space, newline or `;' after an else or end keyword.  Default is
     `t'.  This is an extremely useful feature for automatically
     verifying that the keywords match--if they don't, an error message
     is displayed.

`octave-block-offset'
     Extra indentation applied to statements in block structures.
     Default is 2.

`octave-comment-column'
     Column to indent right-margin comments to.  Default is 32.  (Such
     comments are created using <M-;> (`indent-for-comment').)

`octave-comment-start'
     Delimiter inserted to start new comment.  Default value is `# '.

`octave-continuation-offset'
     Extra indentation applied to Octave continuation lines.  Default
     is 4.

`octave-continuation-string'
     String used for Octave continuation lines.  Normally `\'.

`octave-fill-column'
     Column beyond which automatic line-wrapping should happen.
     Default is 72.

`octave-inhibit-startup-message'
     If `t', no startup message is displayed when Octave mode is called.
     Default is `nil'.

   If Font Lock mode is enabled, Octave mode will display
   * strings in `font-lock-string-face'

   * comments in `font-lock-comment-face'

   * the Octave reserved words (such as all block keywords) and the text
     functions (such as `cd' or `who') which are also reserved using
     `font-lock-keyword-face'

   * the builtin operators (`&&', `<>', ...) using
     `font-lock-reference-face'

   * the builtin variables (such as `prefer_column_vectors', `NaN' or
     `LOADPATH') in `font-lock-variable-name-face'

   * and the function names in function declarations in
     `font-lock-function-name-face'.

   There is also rudimentary support for Imenu (currently, function
names can be indexed).

   Customization of Octave mode can be performed by modification of the
variable `octave-mode-hook'.  It the value of this variable is
non-`nil', turning on Octave mode calls its value.

   If you discover a problem with Octave mode, you can conveniently
send a bug report using `C-c C-b' (`octave-submit-bug-report').  This
automatically sets up a mail buffer with version information already
added.  You just need to add a description of the problem, including a
reproducible test case and send the message.


File: octave.info,  Node: Running Octave From Within Emacs,  Next: Using the Emacs Info Reader for Octave,  Prev: Using Octave Mode,  Up: Emacs

Running Octave From Within Emacs
================================

   The package `octave' provides commands for running an inferior
Octave process in a special Emacs buffer.  Use
     M-x run-octave

to directly start an inferior Octave process.  If Emacs does not know
about this command, add the line
     (autoload 'run-octave "octave" nil t)

to your `.emacs' file.

   This will start Octave in a special buffer the name of which is
specified by the variable `inferior-octave-buffer' and defaults to
`"*Octave Interaction*"'.  From within this buffer, you can interact
with the inferior Octave process `as usual', i.e., by entering Octave
commands at the prompt.

   You can also communicate with an inferior Octave process from within
files with Octave code (i.e., buffers in Octave mode), using the
following commands.

`C-c i l'
     Send the current line to the inferior Octave process
     (`octave-send-line').  With positive prefix argument N, send that
     many lines.  If `octave-send-line-auto-forward' is non-`nil', go
     to the next unsent code line.

`C-c i b'
     Send the current block to the inferior Octave process
     (`octave-send-block').

`C-c i f'
     Send the current function to the inferior Octave process
     (`octave-send-defun').

`C-c i r'
     Send the region to the inferior Octave process
     (`octave-send-region').

`C-c i s'
     Make sure that `inferior-octave-buffer' is displayed
     (`octave-show-process-buffer').

`C-c i h'
     Delete all windows that display `inferior-octave-buffer'
     (`octave-hide-process-buffer').

`C-c i k'
     Kill the inferior Octave process and its buffer
     (`octave-kill-process').

   The effect of the commands which send code to the Octave process can
be customized by the following variables.
`octave-send-echo-input'
     Non-`nil' means echo input sent to the inferior Octave process.
     Default is `t'.

`octave-send-show-buffer'
     Non-`nil' means display the buffer running the Octave process after
     sending a command (but without selecting it).  Default is `t'.

   If you send code and there is no inferior Octave process yet, it
will be started automatically.

   The startup of the inferior Octave process is highly customizable.
The variable `inferior-octave-startup-args' can be used for specifying
command lines arguments to be passed to Octave on startup as a list of
strings.  For example, to suppress the startup message and use
`traditional' mode, set this to `'("-q" "--traditional")'.  You can
also specify a startup file of Octave commands to be loaded on startup;
note that these commands will not produce any visible output in the
process buffer.  Which file to use is controlled by the variable
`inferior-octave-startup-file'.  If this is `nil', the file
`~/.emacs_octave' is used if it exists.

   And finally, `inferior-octave-mode-hook' is run after starting the
process and putting its buffer into Inferior Octave mode.  Hence, if you
like the up and down arrow keys to behave in the interaction buffer as
in the shell, and you want this buffer to use nice colors, add
     (add-hook 'inferior-octave-mode-hook
               (lambda ()
                 (turn-on-font-lock)
                 (define-key inferior-octave-mode-map [up]
                   'comint-previous-input)
                 (define-key inferior-octave-mode-map [down]
                   'comint-next-input)))

to your `.emacs' file.  You could also swap the roles of `C-a'
(`beginning-of-line') and `C-c C-a' (`comint-bol') using this hook.

     *Note:* If you set your Octave prompts to something different from
     the defaults, make sure that `inferior-octave-prompt' matches them.
     Otherwise, *nothing* will work, because Emacs will have no idea
     when Octave is waiting for input, or done sending output.


File: octave.info,  Node: Using the Emacs Info Reader for Octave,  Prev: Running Octave From Within Emacs,  Up: Emacs

Using the Emacs Info Reader for Octave
======================================

   You can also set up the Emacs Info reader for dealing with the
results of Octave's `help -i'.  For this, the package `gnuserv' needs
to be installed.  The `gnuserv' package is not distributed with GNU
Emacs, but it can be retrieved from any GNU Emacs Lisp Code Directory
archive, e.g.
`ftp://ftp.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive', in the
`packages' subdirectory.  There is also a newer version around (use
archie to look for `gnuserv-2.1alpha.tar.gz').

   If `gnuserv' is installed, add the lines
     (autoload 'octave-help "octave" nil t)
     (require 'gnuserv)
     (gnuserv-start)

to your `.emacs' file.

   You can use either `plain' Emacs Info or the function `octave-help'
as your Octave info reader (for `help -i').  In the former case, set
the Octave variable `INFO_PROGRAM' to `"info-emacs-info"'.  The latter
is perhaps more attractive because it allows to look up keys in the
indices of *several* info files related to Octave (provided that the
Emacs variable `octave-help-files' is set correctly).  In this case,
set `INFO_PROGRAM' to `"info-emacs-octave-help"'.

   If you use Octave from within Emacs, it is probably best to put these
settings in the `~/.emacs_octave' startup file (or in the file named by
the Emacs variable `inferior-octave-startup-file').


File: octave.info,  Node: Installation,  Next: Trouble,  Prev: Emacs,  Up: Top

Installing Octave
*****************

   Here is the procedure for installing Octave from scratch on a Unix
system.  For instructions on how to install the binary distributions of
Octave, see *Note Binary Distributions::..

   * Run the shell script `configure'.  This will determine the features
     your system has (or doesn't have) and create a file named
     `Makefile' from each of the files named `Makefile.in'.

     Here is a summary of the configure options that are most
     frequently used when building Octave:

    `--prefix=PREFIX'
          Install Octave in subdirectories below PREFIX.  The default
          value of PREFIX is `/usr/local'.

    `--srcdir=DIR'
          Look for Octave sources in the directory DIR.

    `--with-f2c'
          Use f2c even if Fortran compiler is available.

    `--enable-dld'
          Use DLD to make Octave capable of dynamically linking
          externally compiled functions.  This only works on systems
          that have a working port of DLD.

    `--enable-lite-kernel'
          Compile smaller kernel.  This currently requires DLD so that
          Octave can load functions at run time that are not loaded at
          compile time.

    `--help'
          Print a summary of the options recognized by the configure
          script.

     See the file `INSTALL' for more information about the command line
     options used by configure.  That file also contains instructions
     for compiling in a directory other than where the source is
     located.

   * Run make.

     You will need a recent version of GNU make.  Modifying Octave's
     makefiles to work with other make programs is probably not worth
     your time.  We recommend you get and compile GNU make instead.

     For plotting, you will need to have gnuplot installed on your
     system.  Gnuplot is a command-driven interactive function plotting
     program.  Gnuplot is copyrighted, but freely distributable.  The
     `gnu' in gnuplot is a coincidence--it is not related to the GNU
     project or the FSF in any but the most peripheral sense.

     For version 2.0.1, you must have the GNU C++ compiler (gcc)
     version 2.7.2 or later to compile Octave.  You will also need
     version 2.7.1 or 2.7.2 of the GNU C++ class library (libg++).  If
     you plan to modify the parser you will also need GNU bison and
     fles.  If you modify the documentation, you will need GNU Texinfo,
     along with the patch for the makeinfo program that is distributed
     with Octave.

     GNU make, gcc, and libg++, gnuplot, bison, flex, and Texinfo are
     all available from many anonymous ftp archives.  The primary site
     is prep.ai.mit.edu, but it is often very busy.  A list of sites
     that mirror the software on prep is available by anonymous ftp
     from prep.ai.mit.edu in the file `/pub/gnu/GNUinfo/FTP', or by
     fingering fsf@prep.ai.mit.edu.

     If you don't have a Fortran compiler, or if your Fortran compiler
     doesn't work like the traditional Unix f77, you will need to have
     the Fortran to C translator f2c.  You can get f2c from any number
     of anonymous ftp archives.  The most recent version of f2c is
     always available from netlib.att.com.

     On an otherwise idle SPARCstation II, it will take somewhere
     between 60 and 90 minutes to compile everything, depending on
     whether you are compiling the Fortran libraries with f2c or using
     the Fortran compiler directly.  You will need about 50 megabytes
     of disk storage to work with (considerably less if you don't
     compile with debugging symbols).  To do that, use the command

          make CFLAGS=-O CXXFLAGS=-O LDFLAGS=

     instead of just `make'.

   * If you encounter errors while compiling Octave, first check the
     list of known problems below to see if there is a workaround or
     solution for your problem.  If not, see *Note Trouble::., for
     information about how to report bugs.

   * Once you have successfully compiled Octave, run `make install'.

     This will install a copy of octave, its libraries, and its
     documentation in the destination directory.  As distributed,
     Octave is installed in the following directories.  In the table
     below, PREFIX defaults to `/usr/local', VERSION stands for the
     current version number of the interpreter, and HOST_TYPE is the
     type of computer on which Octave is installed (for example,
     `i586-unknown-gnu').

    `PREFIX/bin'
          Octave and other binaries that people will want to run
          directly.

    `PREFIX/lib'
          Libraries like libcruft.a and liboctave.a.

    `PREFIX/share'
          Architecture-independent data files.

    `PREFIX/include/octave'
          Include files distributed with Octave.

    `PREFIX/man/man1'
          Unix-style man pages describing Octave.

    `PREFIX/info'
          Info files describing Octave.

    `PREFIX/share/octave/VERSION/m'
          Function files distributed with Octave.  This includes the
          Octave version, so that multiple versions of Octave may be
          installed at the same time.

    `PREFIX/lib/octave/VERSION/exec/HOST_TYPE'
          Executables to be run by Octave rather than the user.

    `PREFIX/lib/octave/VERSION/oct/HOST_TYPE'
          Object files that will be dynamically loaded.

    `PREFIX/share/octave/VERSION/imagelib'
          Image files that are distributed with Octave.

* Menu:

* Installation Problems::
* Binary Distributions::


File: octave.info,  Node: Installation Problems,  Next: Binary Distributions,  Prev: Installation,  Up: Installation

Installation Problems
=====================

   This section contains a list of problems (and some apparent problems
that don't really mean anything is wrong) that may show up during
installation of Octave.

   * On some SCO systems, `info' fails to compile if `HAVE_TERMIOS_H'
     is defined int `config.h'.  Simply removing the definition from
     `info/config.h' should allow it to compile.

   * If `configure' finds `dlopen', `dlsym', `dlclose', and `dlerror',
     but not the header file `dlfcn.h', you need to find the source for
     the header file and install it in the directory `usr/include'.
     This is reportedly a problem with Slackware 3.1.  For Linux/GNU
     systems, the source for `dlfcn.h' is in the `ldso' package.

   * You may need to edit some files in the gcc include subdirectory to
     add prototypes for functions there.  For example, Ultrix 4.2 needs
     proper declarations for the `signal()' and the `SIG_IGN' macro in
     the file `signal.h'.

     On some systems the `SIG_IGN' macro is defined to be something like
     this:

          #define  SIG_IGN  (void (*)())1

     when it should really be something like:

          #define  SIG_IGN  (void (*)(int))1

     to match the prototype declaration for `signal()'.

     The gcc fixincludes/fixproto script should probably fix this when
     gcc installs its modified set of header files, but I don't think
     that's been done yet.

   * There is a bug with the makeinfo program that is distributed with
     Texinfo (through version 3.9) that causes the indices in Octave's
     on-line manual to be generated incorrectly.  If you need to
     recreate the on-line documentation, you should get the makeinfo
     program that is distributed with texinfo-3.9 and apply the patch
     for makeinfo that is distributed with Octave.  See the file
     `MAKEINFO.PATCH' for more details.

   * Some of the Fortran subroutines may fail to compile with older
     versions of the Sun Fortran compiler.  If you get errors like

          zgemm.f:
          	zgemm:
          warning: unexpected parent of complex expression subtree
          zgemm.f, line 245: warning: unexpected parent of complex
            expression subtree
          warning: unexpected parent of complex expression subtree
          zgemm.f, line 304: warning: unexpected parent of complex
            expression subtree
          warning: unexpected parent of complex expression subtree
          zgemm.f, line 327: warning: unexpected parent of complex
            expression subtree
          pcc_binval: missing IR_CONV in complex op
          make[2]: *** [zgemm.o] Error 1

     when compiling the Fortran subroutines in the `libcruft'
     subdirectory, you should either upgrade your compiler or try
     compiling with optimization turned off.

   * On NeXT systems, if you get errors like this:

          /usr/tmp/cc007458.s:unknown:Undefined local symbol LBB7656
          /usr/tmp/cc007458.s:unknown:Undefined local symbol LBE7656

     when compiling `Array.cc' and `Matrix.cc', try recompiling these
     files without `-g'.

   * Some people have reported that calls to shell_cmd and the pager do
     not work on SunOS systems.  This is apparently due to having
     `G_HAVE_SYS_WAIT' defined to be 0 instead of 1 when compiling
     libg++.

   * On NeXT systems, linking to `libsys_s.a' may fail to resolve the
     following functions

          _tcgetattr
          _tcsetattr
          _tcflow

     which are part of `libposix.a'.  Unfortunately, linking Octave with
     `-posix' results in the following undefined symbols.

          .destructors_used
          .constructors_used
          _objc_msgSend
          _NXGetDefaultValue
          _NXRegisterDefaults
          .objc_class_name_NXStringTable
          .objc_class_name_NXBundle

     One kluge around this problem is to extract `termios.o' from
     `libposix.a', put it in Octave's `src' directory, and add it to
     the list of files to link together in the makefile.  Suggestions
     for better ways to solve this problem are welcome!

   * If Octave crashes immediately with a floating point exception, it
     is likely that it is failing to initialize the IEEE floating point
     values for infinity and NaN.

     If your system actually does support IEEE arithmetic, you should
     be able to fix this problem by modifying the function
     `octave_ieee_init' in the file `lo-ieee.cc' to correctly
     initialize Octave's internal infinity and NaN variables.

     If your system does not support IEEE arithmetic but Octave's
     configure script incorrectly determined that it does, you can work
     around the problem by editing the file `config.h' to not define
     `HAVE_ISINF', `HAVE_FINITE', and `HAVE_ISNAN'.

     In any case, please report this as a bug since it might be
     possible to modify Octave's configuration script to automatically
     determine the proper thing to do.

   * If you don't have NPSOL but you still want to be able to solve
     NLPs, or if you don't have QPSOL but you still want to solve QPs,
     you'll need to find replacements or order them from Stanford.  If
     you know of a freely redistributable replacement, please let us
     know--we might be interested in distributing it with Octave.

     You can get more information about NPSOL and QPSOL from

          Stanford Business Sofrtware, Inc.
          2680 Bayshore Parkway, Suite 304
          Mountain View, CA 94043
          Tel: (415) 962-8719
          Fax: (415) 962-1869

     Octave may soon support FSQP, an NLP solver from Andre Tits
     (andre@src.umd.edu) of the University of Maryland.  FSQP is
     available free of charge to academic sites, but can not be
     redistributed to third parties.


File: octave.info,  Node: Binary Distributions,  Prev: Installation Problems,  Up: Installation

Binary Distributions
====================

   This section contains instructions for creating and installing a
binary distribution.

* Menu:

* Installing Octave from a Binary Distribution::
* Creating a Binary Distribution::


File: octave.info,  Node: Installing Octave from a Binary Distribution,  Next: Creating a Binary Distribution,  Prev: Binary Distributions,  Up: Binary Distributions

Installing Octave from a Binary Distribution
--------------------------------------------

   * To install Octave from a binary distribution, execute the command

          sh ./doinstall.sh

     in the top level directory of the distribution.

     Binary distributions are normally compiled assuming that Octave
     will be installed in the following subdirectories of `/usr/local'.

    `bin'
          Octave and other binaries that people will want to run
          directly.

    `man/man1'
          Unix-style man pages describing Octave.

    `info'
          Info files describing Octave.

    `lib/octave/VERSION/m'
          Function files distributed with Octave.  This includes the
          Octave version, so that multiple versions of Octave may be
          installed at the same time.

    `lib/octave/VERSION/exec/HOST_TYPE'
          Executables to be run by Octave rather than the user.

    `lib/octave/VERSION/oct/HOST_TYPE'
          Object files that will be dynamically loaded.

    `lib/octave/VERSION/imagelib'
          Image files that are distributed with Octave.

     where VERSION stands for the current version number of the
     interpreter, and HOST_TYPE is the type of computer on which Octave
     is installed (for example, `i486-unknown-gnu').

     If these directories don't exist, the script `doinstall.sh' will
     create them for you.

     If it is not possible for you to install Octave in `/usr/local', or
     if you would prefer to install it in a different directory, you can
     specify the name of the top level directory as an argument to the
     doinstall.sh script.  For example:

          sh ./doinstall.sh /some/other/directory

     will install Octave in subdirectories of the directory
     `/some/other/directory'.


File: octave.info,  Node: Creating a Binary Distribution,  Prev: Installing Octave from a Binary Distribution,  Up: Binary Distributions

Creating a Binary Distribution
------------------------------

   Here is how to build a binary distribution for others.

   * You must build Octave in the same directory as the source.  This is
     required since the `binary-dist' targets in the makefiles will not
     work if you compile outside the source tree.

   * Use `CFLAGS=-O CXXFLAGS=-O LDFLAGS=' as arguments for Make because
     most people who get the binary distributions are probably not
     going to be interested in debugging Octave.

   * Type `make binary-dist'.  This will build everything and then pack
     it up for distribution.


File: octave.info,  Node: Trouble,  Next: Command Line Editing,  Prev: Installation,  Up: Top

Known Causes of Trouble with Octave
***********************************

   This section describes known problems that affect users of Octave.
Most of these are not Octave bugs per se--if they were, we would fix
them.  But the result for a user may be like the result of a bug.

   Some of these problems are due to bugs in other software, some are
missing features that are too much work to add, and some are places
where people's opinions differ as to what is best.

* Menu:

* Actual Bugs::                 Bugs we will fix later.
* Reporting Bugs::
* Bug Criteria::
* Bug Lists::
* Bug Reporting::
* Sending Patches::
* Service::


File: octave.info,  Node: Actual Bugs,  Next: Reporting Bugs,  Prev: Trouble,  Up: Trouble

Actual Bugs We Haven't Fixed Yet
================================

   * Output that comes directly from Fortran functions is not sent
     through the pager and may appear out of sequence with other output
     that is sent through the pager.  One way to avoid this is to force
     pending output to be flushed before calling a function that will
     produce output from within Fortran functions.  To do this, use the
     command

          fflush (stdout)

     Another possible workaround is to use the command

          page_screen_output = "false"

     to turn the pager off.

   * If you get messages like

          Input line too long

     when trying to plot many lines on one graph, you have probably
     generated a plot command that is too larger for `gnuplot''s
     fixed-length buffer for commands.  Splitting up the plot command
     doesn't help because replot is implemented in gnuplot by simply
     appending the new plotting commands to the old command line and
     then evaluating it again.

     You can demonstrate this `feature' by running gnuplot and doing
     something like

            plot sin (x), sin (x), sin (x), ... lots more ..., sin (x)

     and then

            replot sin (x), sin (x), sin (x), ... lots more ..., sin (x)

     after repeating the replot command a few times, gnuplot will give
     you an error.

     Also, it doesn't help to use backslashes to enter a plot command
     over several lines, because the limit is on the overall command
     line length, once the backslashed lines are all pasted together.

     Because of this, Octave tries to use as little of the command-line
     length as possible by using the shortest possible abbreviations for
     all the plot commands and options.  Unfortunately, the length of
     the temporary file names is probably what is taking up the most
     space on the command line.

     You can buy a little bit of command line space by setting the
     environment variable `TMPDIR' to be "." before starting Octave, or
     you can increase the maximum command line length in gnuplot by
     changing the following limits in the file plot.h in the gnuplot
     distribution and recompiling gnuplot.

          #define MAX_LINE_LEN 32768  /* originally 1024 */
          #define MAX_TOKENS 8192     /* originally 400 */

     Of course, this doesn't really fix the problem, but it does make it
     much less likely that you will run into trouble unless you are
     putting a very large number of lines on a given plot.

   A list of ideas for future enhancements is distributed with Octave.
See the file `PROJECTS' in the top level directory in the source
distribution.


File: octave.info,  Node: Reporting Bugs,  Next: Bug Criteria,  Prev: Actual Bugs,  Up: Trouble

Reporting Bugs
==============

   Your bug reports play an essential role in making Octave reliable.

   When you encounter a problem, the first thing to do is to see if it
is already known.  *Note Trouble::.  If it isn't known, then you should
report the problem.

   Reporting a bug may help you by bringing a solution to your problem,
or it may not.  In any case, the principal function of a bug report is
to help the entire community by making the next version of Octave work
better.  Bug reports are your contribution to the maintenance of Octave.

   In order for a bug report to serve its purpose, you must include the
information that makes it possible to fix the bug.

   If you have Octave working at all, the easiest way to prepare a
complete bug report is to use the Octave function `bug_report'.  When
you execute this function, Octave will prompt you for a subject and then
invoke the editor on a file that already contains all the configuration
information.  When you exit the editor, Octave will mail the bug report
for you.

* Menu:

* Bug Criteria::
* Where: Bug Lists.             Where to send your bug report.
* Reporting: Bug Reporting.     How to report a bug effectively.
* Patches: Sending Patches.     How to send a patch for Octave.


File: octave.info,  Node: Bug Criteria,  Next: Bug Lists,  Prev: Reporting Bugs,  Up: Trouble

Have You Found a Bug?
=====================

   If you are not sure whether you have found a bug, here are some
guidelines:

   * If Octave gets a fatal signal, for any input whatever, that is a
     bug.  Reliable interpreters never crash.

   * If Octave produces incorrect results, for any input whatever, that
     is a bug.

   * Some output may appear to be incorrect when it is in fact due to a
     program whose behavior is undefined, which happened by chance to
     give the desired results on another system.  For example, the
     range operator may produce different results because of
     differences in the way floating point arithmetic is handled on
     various systems.

   * If Octave produces an error message for valid input, that is a bug.

   * If Octave does not produce an error message for invalid input,
     that is a bug.  However, you should note that your idea of
     "invalid input" might be my idea of "an extension" or "support for
     traditional practice".

   * If you are an experienced user of programs like Octave, your
     suggestions for improvement are welcome in any case.

