home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / octave.info-7 < prev    next >
Encoding:
GNU Info File  |  1996-10-12  |  49.2 KB  |  1,412 lines

  1. This is Info file octave.info, produced by Makeinfo-1.64 from the input
  2. file octave.texi.
  3.  
  4.    Copyright (C) 1993, 1994, 1995 John W. Eaton.
  5.  
  6.    Permission is granted to make and distribute verbatim copies of this
  7. manual provided the copyright notice and this permission notice are
  8. preserved on all copies.
  9.  
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.  
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions.
  18.  
  19. 
  20. File: octave.info,  Node: Rearranging Matrices,  Prev: Finding Elements and Checking Conditions,  Up: Matrix Manipulation
  21.  
  22. Rearranging Matrices
  23. ====================
  24.  
  25.    The function `fliplr' reverses the order of the columns in a matrix,
  26. and `flipud' reverses the order of the rows.  For example,
  27.  
  28.      octave:13> fliplr ([1, 2; 3, 4])
  29.      ans =
  30.      
  31.        2  1
  32.        4  3
  33.      
  34.      octave:13> flipud ([1, 2; 3, 4])
  35.      ans =
  36.      
  37.        3  4
  38.        1  2
  39.  
  40.    The function `rot90 (A, N)' rotates a matrix counterclockwise in
  41. 90-degree increments.  The second argument is optional, and specifies
  42. how many 90-degree rotations are to be applied (the default value is
  43. 1).  Negative values of N rotate the matrix in a clockwise direction.
  44. For example,
  45.  
  46.      rot90 ([1, 2; 3, 4], -1)
  47.      ans =
  48.      
  49.        3  1
  50.        4  2
  51.  
  52. rotates the given matrix clockwise by 90 degrees.  The following are all
  53. equivalent statements:
  54.  
  55.      rot90 ([1, 2; 3, 4], -1)
  56.      rot90 ([1, 2; 3, 4], 3)
  57.      rot90 ([1, 2; 3, 4], 7)
  58.  
  59.    The function `reshape (A, M, N)' returns a matrix with M rows and N
  60. columns whose elements are taken from the matrix A.  To decide how to
  61. order the elements, Octave pretends that the elements of a matrix are
  62. stored in column-major order (like Fortran arrays are stored).
  63.  
  64.    For example,
  65.  
  66.      octave:13> reshape ([1, 2, 3, 4], 2, 2)
  67.      ans =
  68.      
  69.        1  3
  70.        2  4
  71.  
  72.    If the variable `do_fortran_indexing' is `"true"', the `reshape'
  73. function is equivalent to
  74.  
  75.      retval = zeros (m, n);
  76.      retval (:) = a;
  77.  
  78. but it is somewhat less cryptic to use `reshape' instead of the colon
  79. operator.  Note that the total number of elements in the original
  80. matrix must match the total number of elements in the new matrix.
  81.  
  82.    The function `sort' can be used to arrange the elements of a vector
  83. in increasing order.  For matrices, `sort' orders the elements in each
  84. column.
  85.  
  86.    For example,
  87.  
  88.      octave:13> sort (rand (4))
  89.      ans =
  90.      
  91.        0.065359  0.039391  0.376076  0.384298
  92.        0.111486  0.140872  0.418035  0.824459
  93.        0.269991  0.274446  0.421374  0.938918
  94.        0.580030  0.975784  0.562145  0.954964
  95.  
  96.    The `sort' function may also be used to produce a matrix containing
  97. the original row indices of the elements in the sorted matrix.  For
  98. example,
  99.  
  100.      s =
  101.      
  102.        0.051724  0.485904  0.253614  0.348008
  103.        0.391608  0.526686  0.536952  0.600317
  104.        0.733534  0.545522  0.691719  0.636974
  105.        0.986353  0.976130  0.868598  0.713884
  106.      
  107.      i =
  108.      
  109.        2  4  2  3
  110.        4  1  3  4
  111.        1  2  4  1
  112.        3  3  1  2
  113.  
  114. These values may be used to recover the original matrix from the sorted
  115. version.  For example,
  116.  
  117.  
  118.    The `sort' function does not allow sort keys to be specified, so it
  119. can't be used to order the rows of a matrix according to the values of
  120. the elements in various columns(1) in a single call.  Using the second
  121. output, however, it is possible to sort all rows based on the values in
  122. a given column.  Here's an example that sorts the rows of a matrix
  123. based on the values in the third column.
  124.  
  125.      octave:13> a = rand (4)
  126.      a =
  127.      
  128.        0.080606  0.453558  0.835597  0.437013
  129.        0.277233  0.625541  0.447317  0.952203
  130.        0.569785  0.528797  0.319433  0.747698
  131.        0.385467  0.124427  0.883673  0.226632
  132.      
  133.      octave:14> [s, i] = sort (a (:, 3));
  134.      octave:15> a (i, :)
  135.      ans =
  136.      
  137.        0.569785  0.528797  0.319433  0.747698
  138.        0.277233  0.625541  0.447317  0.952203
  139.        0.080606  0.453558  0.835597  0.437013
  140.        0.385467  0.124427  0.883673  0.226632
  141.  
  142.    The functions `triu (A, K)' and `tril (A, K)' extract the upper or
  143. lower triangular part of the matrix A, and set all other elements to
  144. zero.  The second argument is optional, and specifies how many
  145. diagonals above or below the main diagonal should also be set to zero.
  146.  
  147.    The default value of K is zero, so that `triu' and `tril' normally
  148. include the main diagonal as part of the result matrix.
  149.  
  150.    If the value of K is negative, additional elements above (for
  151. `tril') or below (for `triu') the main diagonal are also selected.
  152.  
  153.    The absolute value of K must not be greater than the number of sub-
  154. or super-diagonals.
  155.  
  156.    For example,
  157.      octave:13> tril (rand (4), 1)
  158.      ans =
  159.      
  160.        0.00000  0.00000  0.00000  0.00000
  161.        0.09012  0.00000  0.00000  0.00000
  162.        0.01215  0.34768  0.00000  0.00000
  163.        0.00302  0.69518  0.91940  0.00000
  164.  
  165. forms a lower triangular matrix from a random 4 by 4 matrix, omitting
  166. the main diagonal, and
  167.  
  168.      octave:13> tril (rand (4), -1)
  169.      ans =
  170.      
  171.        0.06170  0.51396  0.00000  0.00000
  172.        0.96199  0.11986  0.35714  0.00000
  173.        0.16185  0.61442  0.79343  0.52029
  174.        0.68016  0.48835  0.63609  0.72113
  175.  
  176. forms a lower triangular matrix from a random 4 by 4 matrix, including
  177. the main diagonal and the first super-diagonal.
  178.  
  179.    ---------- Footnotes ----------
  180.  
  181.    (1)  For example, to first sort based on the values in column 1, and
  182. then, for any values that are repeated in column 1, sort based on the
  183. values found in column 2, etc.
  184.  
  185. 
  186. File: octave.info,  Node: String Functions,  Next: System Utilities,  Prev: Matrix Manipulation,  Up: Top
  187.  
  188. String Functions
  189. ****************
  190.  
  191.    Octave currently has a limited ability to work with strings.
  192.  
  193.    The function `strcmp (S1, S2)' compares two strings, returning 1 if
  194. they are the same, and 0 otherwise.
  195.  
  196.    *Note: For compatibility with MATLAB, Octave's strcmp function
  197. returns 1 if the strings are equal, and 0 otherwise.  This is just the
  198. opposite of the corresponding C library function.*
  199.  
  200.    The functions `int2str' and `num2str' convert a numeric argument to
  201. a string.  These functions are not very flexible, but are provided for
  202. compatibility with MATLAB.  For better control over the results, use
  203. `sprintf' (*note Formatted Output::.).
  204.  
  205.    The function `setstr' can be used to convert a vector to a string.
  206. Each element of the vector is converted to the corresponding ASCII
  207. character.  For example,
  208.  
  209.      setstr ([97, 98, 99])
  210.  
  211. creates the string
  212.  
  213.      abc
  214.  
  215.    The function `undo_string_escapes (STRING)' converts special
  216. characters in strings back to their escaped forms.  For example, the
  217. expression
  218.  
  219.      bell = "\a";
  220.  
  221. assigns the value of the alert character (control-g, ASCII code 7) to
  222. the string variable BELL.  If this string is printed, the system will
  223. ring the terminal bell (if it is possible).  This is normally the
  224. desired outcome.  However, sometimes it is useful to be able to print
  225. the original representation of the string, with the special characters
  226. replaced by their escape sequences.  For example,
  227.  
  228.      octave:13> undo_string_escapes (bell)
  229.      ans = \a
  230.  
  231. replaces the unprintable alert character with its printable
  232. representation.  *Note String Constants::, for a description of string
  233. escapes.
  234.  
  235. 
  236. File: octave.info,  Node: System Utilities,  Next: Command History Functions,  Prev: String Functions,  Up: Top
  237.  
  238. System Utilities
  239. ****************
  240.  
  241.    This chapter describes the functions that are available to allow you
  242. to get information about what is happening outside of Octave, while it
  243. is still running, and use this information in your program.  For
  244. example, you can get information about environment variables, the
  245. current time, and even start other programs from the Octave prompt.
  246.  
  247. * Menu:
  248.  
  249. * Timing Utilities::
  250. * Interacting with the OS::
  251. * System Information::
  252. * Other Functions::
  253.  
  254. 
  255. File: octave.info,  Node: Timing Utilities,  Next: Interacting with the OS,  Prev: System Utilities,  Up: System Utilities
  256.  
  257. Timing Utilities
  258. ================
  259.  
  260.    The function `clock' returns a vector containing the current year,
  261. month (1-12), day (1-31), hour (0-23), minute (0-59) and second (0-60).
  262. For example,
  263.  
  264.      octave:13> clock
  265.      ans =
  266.      
  267.        1993     8    20     4    56     1
  268.  
  269.    The function clock is more accurate on systems that have the
  270. `gettimeofday' function.
  271.  
  272.    To get the date as a character string in the form DD-MMM-YY, use the
  273. command `date'.  For example,
  274.  
  275.      octave:13> date
  276.      ans = 20-Aug-93
  277.  
  278.    Octave also has functions for computing time intervals and CPU time
  279. used.  The functions `tic' and `toc' can be used to set and check a
  280. wall-clock timer.  For example,
  281.  
  282.      tic ();
  283.      # many computations later...
  284.      elapsed_time = toc ();
  285.  
  286. will set the variable `elapsed_time' to the number of seconds since the
  287. most recent call to the function `tic'.
  288.  
  289.    The function `etime' provides another way to get elapsed wall-clock
  290. time by returning the difference (in seconds) between two time values
  291. returned from `clock'.  For example:
  292.  
  293.      t0 = clock ();
  294.      # many computations later...
  295.      elapsed_time = etime (clock (), t0);
  296.  
  297. will set the variable `elapsed_time' to the number of seconds since the
  298. variable `t0' was set.
  299.  
  300.    The function `cputime' allows you to obtain information about the
  301. amount of CPU time your Octave session is using.  For example,
  302.  
  303.      [total, user, system] = cputime ();
  304.  
  305. returns the CPU time used by your Octave session.  The first output is
  306. the total time spent executing your process and is equal to the sum of
  307. second and third outputs, which are the number of CPU seconds spent
  308. executing in user mode and the number of CPU seconds spent executing in
  309. system mode, respectively.
  310.  
  311.    Finally, Octave's function `is_leap_year' returns 1 if the given
  312. year is a leap year and 0 otherwise.  If no arguments are provided,
  313. `is_leap_year' will use the current year.  For example,
  314.  
  315.      octave:13> is_leap_year (2000)
  316.      ans = 1
  317.  
  318. Contrary to what many people who post misinformation to Usenet
  319. apparently believe, Octave knows that the year 2000 will be a leap year.
  320.  
  321. 
  322. File: octave.info,  Node: Interacting with the OS,  Next: System Information,  Prev: Timing Utilities,  Up: System Utilities
  323.  
  324. Interacting with the OS
  325. =======================
  326.  
  327.    You can execute any shell command using the function `system (CMD,
  328. FLAG)'.  The second argument is optional.  If it is present, the output
  329. of the command is returned by `system' as a string.  If it is not
  330. supplied, any output from the command is printed, with the standard
  331. output filtered through the pager.  For example,
  332.  
  333.      users = system ("finger", 1)
  334.  
  335. places the output of the command `finger' in the variable `users'.
  336.  
  337.    If you want to execute a shell command and have it behave as if it
  338. were typed directly from the shell prompt, you may need to specify extra
  339. arguments for the command.  For example, to get `bash' to behave as an
  340. interactive shell, you can type
  341.  
  342.      system ("bash -i >/dev/tty");
  343.  
  344.    The first argument, `-i', tells `bash' to behave as an interactive
  345. shell, and the redirection of the standard output stream prevents any
  346. output produced by `bash' from being sent back to Octave, where it
  347. would be buffered until Octave displays another prompt.
  348.  
  349.    The `system' function can return two values.  The first is any
  350. output from the command that was written to the standard output stream,
  351. and the second is the output status of the command.  For example,
  352.  
  353.      [output, status] = system ("echo foo; exit 2");
  354.  
  355. will set the variable `output' to the string `foo', and the variable
  356. `status' to the integer `2'.
  357.  
  358.    The name `shell_cmd' exists for compatibility with earlier versions
  359. of Octave.
  360.  
  361.    You can find the values of environment variables using the function
  362. `getenv'.  For example,
  363.  
  364.      getenv ("PATH")
  365.  
  366. returns a string containing the value of your path.
  367.  
  368.    The functions `clc', and `home' clear your terminal screen and move
  369. the cursor to the upper left corner.
  370.  
  371.    You can change the current working directory using the `cd' command.
  372. Tilde expansion is performed on the path.  For example,
  373.  
  374.      cd ~/octave
  375.  
  376. Changes the current working directory to `~/octave'.  If the directory
  377. does not exist, an error message is printed and the working directory
  378. is not changed.
  379.  
  380.    The name `chdir' is an alias for `cd'.
  381.  
  382.    The command `pwd' prints the current working directory.
  383.  
  384.    The functions `dir' and `ls' list directory contents.  For example,
  385.  
  386.      octave:13> ls -l
  387.      total 12
  388.      -rw-r--r--   1 jwe      users        4488 Aug 19 04:02 foo.m
  389.      -rw-r--r--   1 jwe      users        1315 Aug 17 23:14 bar.m
  390.  
  391.    The `dir' and `ls' commands are implemented by calling your system's
  392. directory listing command, so the available options may vary from
  393. system to system.
  394.  
  395. 
  396. File: octave.info,  Node: System Information,  Next: Other Functions,  Prev: Interacting with the OS,  Up: System Utilities
  397.  
  398. System Information
  399. ==================
  400.  
  401.    If possible, `computer' prints a string of the form CPU-VENDOR-OS
  402. that identifies the kind of computer Octave is running on.  For example,
  403.  
  404.      octave:13> computer
  405.      sparc-sun-sunos4.1.2
  406.  
  407.    The function `isieee' returns 1 if your computer claims to conform
  408. to the IEEE standard for floating point calculations.
  409.  
  410.    The function `version' returns Octave's version number as a string.
  411. This is also the value of the built-in variable `OCTAVE_VERSION'.
  412. *Note Built-in Variables::.
  413.  
  414. 
  415. File: octave.info,  Node: Other Functions,  Prev: System Information,  Up: System Utilities
  416.  
  417. Other Functions
  418. ===============
  419.  
  420.    The function `pause' allows you to suspend the execution of a
  421. program.  If invoked without any arguments, Octave waits until you type
  422. a character.  With a numeric argument, it pauses for the given number of
  423. seconds.  For example, the following statement prints a message and then
  424. waits 5 seconds before clearing the screen.
  425.  
  426.      fprintf (stderr, "wait please...\n"), pause (5), clc
  427.  
  428. 
  429. File: octave.info,  Node: Command History Functions,  Next: Help,  Prev: System Utilities,  Up: Top
  430.  
  431. Command History Functions
  432. *************************
  433.  
  434.    Octave provides three functions for viewing, editing, and re-running
  435. chunks of commands from the history list.
  436.  
  437.    The function `history' displays a list of commands that you have
  438. executed.  It also allows you to write the current history to a file for
  439. safe keeping, and to replace the history list with the commands stored
  440. in a named file.  Valid arguments are:
  441.  
  442. `-w file'
  443.      Write the current history to the named file.  If the name is
  444.      omitted, use the default history file (normally `~/.octave_hist').
  445.  
  446. `-r file'
  447.      Read the named file, replacing the current history list with its
  448.      contents.  If the name is omitted, use the default history file
  449.      (normally `~/.octave_hist').
  450.  
  451. `N'
  452.      Only display the most recent `N' lines of history.
  453.  
  454. `-q'
  455.      Don't number the displayed lines of history.  This is useful for
  456.      cutting and pasting commands if you are using the X Window System.
  457.  
  458.    For example, to display the five most recent commands that you have
  459. typed without displaying line numbers, use the command `history -q 5'.
  460.  
  461.    The function `edit_history' allows you to edit a block of commands
  462. from the history list using the editor named by the environment
  463. variable `EDITOR', or the default editor (normally `vi').  It is often
  464. more convenient to use `edit_history' to define functions rather than
  465. attempting to enter them directly on the command line.  By default, the
  466. block of commands is executed as soon as you exit the editor.  To avoid
  467. executing any commands, simply delete all the lines from the buffer
  468. before exiting the editor.
  469.  
  470.    The `edit_history' command takes two optional arguments specifying
  471. the history numbers of first and last commands to edit.  For example,
  472. the command
  473.  
  474.      edit_history 13
  475.  
  476. extracts all the commands from the 13th through the last in the history
  477. list.  The command
  478.  
  479.      edit_history 13 169
  480.  
  481. only extracts commands 13 through 169.  Specifying a larger number for
  482. the first command than the last command reverses the list of commands
  483. before placing them in the buffer to be edited.  If both arguments are
  484. omitted, the previous command in the history list is used.
  485.  
  486.    The command `run_history' is like `edit_history', except that the
  487. editor is not invoked, and the commands are simply executed as they
  488. appear in the history list.
  489.  
  490.    The `diary' command allows you to create a list of all commands
  491. *and* the output they produce, mixed together just as you see them on
  492. your terminal.
  493.  
  494.    For example, the command
  495.  
  496.      diary on
  497.  
  498. tells Octave to start recording your session in a file called `diary'
  499. in your current working directory.  To give Octave the name of the file
  500. write to, use the a command like
  501.  
  502.      diary my-diary.txt
  503.  
  504. Then Octave will write all of your commands to the file `my-diary.txt'.
  505.  
  506.    To stop recording your session, use the command
  507.  
  508.      diary off
  509.  
  510. Without any arguments, `diary' toggles the current diary state.
  511.  
  512. 
  513. File: octave.info,  Node: Help,  Next: Programming Utilities,  Prev: Command History Functions,  Up: Top
  514.  
  515. Help
  516. ****
  517.  
  518.    Octave's `help' command can be used to print brief usage-style
  519. messages, or to display information directly from an on-line version of
  520. the printed manual, using the GNU Info browser.  If invoked without any
  521. arguments, `help' prints a list of all the available operators,
  522. functions, and built-in variables.  If the first argument is `-i', the
  523. `help' command searches the index of the on-line version of this manual
  524. for the given topics.
  525.  
  526.    For example, the command
  527.  
  528.      help help
  529.  
  530. prints a short message describing the `help' command, and
  531.  
  532.      help -i help
  533.  
  534. starts the GNU Info browser at this node in the on-line version of the
  535. manual.
  536.  
  537.    *Note Using Info::, for complete details about how to use the GNU
  538. Info browser to read the on-line version of the manual.
  539.  
  540. 
  541. File: octave.info,  Node: Programming Utilities,  Next: Amusements,  Prev: Help,  Up: Top
  542.  
  543. Programming Utilities
  544. *********************
  545.  
  546. * Menu:
  547.  
  548. * Evaluating Strings as Commands::
  549. * Miscellaneous Utilities::
  550.  
  551. 
  552. File: octave.info,  Node: Evaluating Strings as Commands,  Next: Miscellaneous Utilities,  Prev: Programming Utilities,  Up: Programming Utilities
  553.  
  554. Evaluating Strings as Commands
  555. ==============================
  556.  
  557.    It is often useful to evaluate a string as if it were an Octave
  558. program, or use a string as the name of a function to call.  These
  559. functions are necessary in order to evaluate commands that are not
  560. known until run time, or to write functions that will need to call
  561. user-supplied functions.
  562.  
  563.    The function `eval (COMMAND)' parses COMMAND and evaluates it as if
  564. it were an Octave program, returning the last value computed.  The
  565. COMMAND is evaluated in the current context, so any results remain
  566. available after `eval' returns.  For example,
  567.  
  568.      octave:13> a
  569.      error: `a' undefined
  570.      octave:14> eval ("a = 13")
  571.      a = 13
  572.      ans = 13
  573.      octave:15> a
  574.      a = 13
  575.  
  576.    In this case, two values are printed:  one for the expression that
  577. was evaluated, and one for the value returned from `eval'.  Just as
  578. with any other expression, you can turn printing off by ending the
  579. expression in a semicolon.  For example,
  580.  
  581.      octave:13> a
  582.      error: `a' undefined
  583.      octave:14> eval ("a = 13;")
  584.      ans = 13
  585.      octave:15> a
  586.      a = 13
  587.  
  588.    The function `feval (NAME, ...)' can be used to evaluate the
  589. function named NAME.  Any arguments after the first are passed on to
  590. the named function.  For example,
  591.  
  592.      octave:12> feval ("acos", -1)
  593.      ans = 3.1416
  594.  
  595. calls the function `acos' with the argument `-1'.
  596.  
  597.    The function `feval' is necessary in order to be able to write
  598. functions that call user-supplied functions, because Octave does not
  599. have a way to declare a pointer to a function (like C) or to declare a
  600. special kind of variable that can be used to hold the name of a function
  601. (like `EXTERNAL' in Fortran).  Instead, you must refer to functions by
  602. name, and use `feval' to call them.
  603.  
  604.    For example, here is a simple-minded function for finding the root
  605. of a function of one variable:
  606.  
  607.      function result = newtroot (fname, x)
  608.      
  609.      # usage: newtroot (fname, x)
  610.      #
  611.      #   fname : a string naming a function f(x).
  612.      #   x     : initial guess
  613.      
  614.        delta = tol = sqrt (eps);
  615.        maxit = 200;
  616.        fx = feval (fname, x);
  617.        for i = 1:maxit
  618.          if (abs (fx) < tol)
  619.            result = x;
  620.            return;
  621.          else
  622.            fx_new = feval (fname, x + delta);
  623.            deriv = (fx_new - fx) / delta;
  624.            x = x - fx / deriv;
  625.            fx = fx_new;
  626.          endif
  627.        endfor
  628.      
  629.        result = x;
  630.      
  631.      endfunction
  632.  
  633.    Note that this is only meant to be an example of calling
  634. user-supplied functions and should not be taken too seriously.  In
  635. addition to using a more robust algorithm, any serious code would check
  636. the number and type of all the arguments, ensure that the supplied
  637. function really was a function, etc.
  638.  
  639. 
  640. File: octave.info,  Node: Miscellaneous Utilities,  Prev: Evaluating Strings as Commands,  Up: Programming Utilities
  641.  
  642. Miscellaneous Utilities
  643. =======================
  644.  
  645.    The following functions allow you to determine the size of a
  646. variable or expression, find out whether a variable exists, print error
  647. messages, or delete variable names from the symbol table.
  648.  
  649. `columns (A)'
  650.      Return the number of columns of A.
  651.  
  652. `rows (A)'
  653.      Return the number of rows of A.
  654.  
  655. `length (A)'
  656.      Return the number of rows of A or the number of columns of A,
  657.      whichever is larger.
  658.  
  659. `size (A [, N])'
  660.      Return the number rows and columns of A.
  661.  
  662.      With one input argument and one output argument, the result is
  663.      returned in a 2 element row vector.  If there are two output
  664.      arguments, the number of rows is assigned to the first, and the
  665.      number of columns to the second.  For example,
  666.  
  667.           octave:13> size ([1, 2; 3, 4; 5, 6])
  668.           ans =
  669.           
  670.             3  2
  671.           
  672.           octave:14> [nr, nc] = size ([1, 2; 3, 4; 5, 6])
  673.           nr = 3
  674.           
  675.           nc = 2
  676.  
  677.      If given a second argument of either 1 or 2, `size' will return
  678.      only the row or column dimension.  For example
  679.  
  680.           octave:15> size ([1, 2; 3, 4; 5, 6], 2)
  681.           ans = 2
  682.  
  683.      returns the number of columns in the given matrix.
  684.  
  685. `is_global (A)'
  686.      Return 1 if A is globally visible.  Otherwise, return 0.
  687.  
  688. `is_matrix (A)'
  689.      Return 1 if A is a matrix.  Otherwise, return 0.
  690.  
  691. `is_vector (A)'
  692.      Return 1 if A is a vector.  Otherwise, return 0.
  693.  
  694. `is_scalar (A)'
  695.      Return 1 if A is a scalar.  Otherwise, return 0.
  696.  
  697. `is_square (X)'
  698.      If X is a square matrix, then return the dimension of X.
  699.      Otherwise, return 0.
  700.  
  701. `is_symmetric (X, TOL)'
  702.      If X is symmetric within the tolerance specified by TOL, then
  703.      return the dimension of X.  Otherwise, return 0.  If TOL is
  704.      omitted, use a tolerance equal to the machine precision.
  705.  
  706. `isstr (A)'
  707.      Return 1 if A is a string.  Otherwise, return 0.
  708.  
  709. `isempty (A)'
  710.      Return 1 if A is an empty matrix (either the number of rows, or
  711.      the number of columns, or both are zero).  Otherwise, return 0.
  712.  
  713. `clear PATTERN ...'
  714.      Delete the names matching the given patterns from the symbol
  715.      table.  The pattern may contain the following special characters:
  716.     `?'
  717.           Match any single character.
  718.  
  719.     `*'
  720.           Match zero or more characters.
  721.  
  722.     `[ LIST ]'
  723.           Match the list of characters specified by LIST.  If the first
  724.           character is `!' or `^', match all characters except those
  725.           specified by LIST.  For example, the pattern `[a-zA-Z]' will
  726.           match all lower and upper case alphabetic characters.
  727.  
  728.      For example, the command
  729.  
  730.           clear foo b*r
  731.  
  732.      clears the name `foo' and all names that begin with the letter `b'
  733.      and end with the letter `r'.
  734.  
  735.      If `clear' is called without any arguments, all user-defined
  736.      variables (local and global) are cleared from the symbol table.  If
  737.      `clear' is called with at least one argument, only the visible
  738.      names matching the arguments are cleared.  For example, suppose
  739.      you have defined a function `foo', and then hidden it by
  740.      performing the assignment `foo = 2'.  Executing the command `clear
  741.      foo' once will clear the variable definition and restore the
  742.      definition of `foo' as a function.  Executing `clear foo' a second
  743.      time will clear the function definition.
  744.  
  745.      This command may not be used within a function body.
  746.  
  747. `who OPTIONS PATTERN ...'
  748.      List currently defined symbols matching the given patterns.  The
  749.      following are valid options.  They may be shortened to one
  750.      character but may not be combined.
  751.  
  752.     `-all'
  753.           List all currently defined symbols.
  754.  
  755.     `-builtins'
  756.           List built-in variables and functions.  This includes all
  757.           currently compiled function files, but does not include all
  758.           function files that are in the `LOADPATH'.
  759.  
  760.     `-functions'
  761.           List user-defined functions.
  762.  
  763.     `-long'
  764.           Print a long listing including the type and dimensions of any
  765.           symbols.  The symbols in the first column of output indicate
  766.           whether it is possible to redefine the symbol, and whether it
  767.           is possible for it to be cleared.
  768.  
  769.     `-variables'
  770.           List user-defined variables.
  771.  
  772.      Valid patterns are the same as described for the `clear' command
  773.      above.  If no patterns are supplied, all symbols from the given
  774.      category are listed.  By default, only user defined functions and
  775.      variables visible in the local scope are displayed.
  776.  
  777.      The command `whos' is equivalent to `who -long'.
  778.  
  779. `exist (NAME)'
  780.      Return 1 if the name exists as a variable, and 2 if the name (after
  781.      appending `.m') is a function file in the path.  Otherwise, return
  782.      0.
  783.  
  784. `error (MSG)'
  785.      Print the message MSG, prefixed by the string `error: ', and set
  786.      Octave's internal error state such that control will return to the
  787.      top level without evaluating any more commands.  This is useful for
  788.      aborting from functions.
  789.  
  790.      If MSG does not end with a new line character, Octave will print a
  791.      traceback of all the function calls leading to the error.  For
  792.      example,
  793.  
  794.           function f () g () end
  795.           function g () h () end
  796.           function h () nargin == 1 || error ("nargin != 1"); end
  797.           f ()
  798.           error: nargin != 1
  799.           error: evaluating index expression near line 1, column 30
  800.           error: evaluating binary operator `||' near line 1, column 27
  801.           error: called from `h'
  802.           error: called from `g'
  803.           error: called from `f'
  804.  
  805.      produces a list of messages that can help you to quickly locate the
  806.      exact location of the error.
  807.  
  808.      If MSG ends in a new line character, Octave will only print MSG
  809.      and will not display any traceback messages as it returns control
  810.      to the top level.  For example, modifying the error message in the
  811.      previous example to end in a new line causes Octave to only print
  812.      a single message:
  813.  
  814.           function h () nargin == 1 || error ("nargin != 1\n"); end
  815.           f ()
  816.           error: nargin != 1
  817.  
  818. `warning (MSG)'
  819.      Print the message MSG prefixed by the string `warning: '.
  820.  
  821. `usage (MSG)'
  822.      Print the message MSG, prefixed by the string `usage: ', and set
  823.      Octave's internal error state such that control will return to the
  824.      top level without evaluating any more commands.  This is useful for
  825.      aborting from functions.
  826.  
  827.      After `usage' is evaluated, Octave will print a traceback of all
  828.      the function calls leading to the usage message.
  829.  
  830. `perror (NAME, NUM)'
  831.      Print the error message for function NAME corresponding to the
  832.      error number NUM.  This function is intended to be used to print
  833.      useful error messages for those functions that return numeric error
  834.      codes.
  835.  
  836. `menu (TITLE, OPT1, ...)'
  837.      Print a title string followed by a series of options.  Each option
  838.      will be printed along with a number.  The return value is the
  839.      number of the option selected by the user.  This function is
  840.      useful for interactive programs.  There is no limit to the number
  841.      of options that may be passed in, but it may be confusing to
  842.      present more than will fit easily on one screen.
  843.  
  844. `document SYMBOL TEXT'
  845.      Set the documentation string for SYMBOL to TEXT.
  846.  
  847. `file_in_path (PATH, FILE)'
  848.      Return the absolute name name of FILE if it can be found in PATH.
  849.      The value of PATH should be a colon-separated list of directories
  850.      in the format described for the built-in variable `LOADPATH'.
  851.  
  852.      If the file cannot be found in the path, an empty matrix is
  853.      returned.  For example,
  854.  
  855.           octave:13> file_in_path (LOADPATH, "nargchk.m")
  856.           ans = /usr/local/lib/octave/1.1.0/m/general/nargchk.m
  857.  
  858. `nargchk (NARGIN_MIN, NARGIN_MAX, N)'
  859.      If N is in the range NARGIN_MIN through NARGIN_MAX inclusive,
  860.      return the empty matrix.  Otherwise, return a message indicating
  861.      whether N is too large or too small.
  862.  
  863.      This is useful for checking to see that the number of arguments
  864.      supplied to a function is within an acceptable range.
  865.  
  866. `octave_tmp_file_name'
  867.      Return a unique temporary file name.
  868.  
  869.      Since the named file is not opened, by `octave_tmp_file_name', it
  870.      is possible (though relatively unlikely) that it will not be
  871.      available by the time your program attempts to open it.
  872.  
  873. `type NAME ...'
  874.      Display the definition of each NAME that refers to a function.
  875.  
  876.      Currently, Octave can only display functions that can be compiled
  877.      cleanly, because it uses its internal representation of the
  878.      function to recreate the program text.
  879.  
  880.      Comments are not displayed because Octave's currently discards
  881.      them as it converts the text of a function file to its internal
  882.      representation.  This problem may be fixed in a future release.
  883.  
  884. `which NAME ...'
  885.      Display the type of each NAME.  If NAME is defined from a function
  886.      file, the full name of the file is also displayed.
  887.  
  888. 
  889. File: octave.info,  Node: Amusements,  Next: Installation,  Prev: Programming Utilities,  Up: Top
  890.  
  891. Amusements
  892. **********
  893.  
  894.    Octave cannot promise that you will actually win the lotto, but it
  895. can pick your numbers for you.  The function `texas_lotto' will select
  896. six numbers between 1 and 50.
  897.  
  898.    The function `list_primes (N)' uses a brute-force algorithm to
  899. compute the first N primes.
  900.  
  901.    Other amusing functions include `casesen', `flops', `sombrero',
  902. `exit', and `quit'.
  903.  
  904. 
  905. File: octave.info,  Node: Installation,  Next: Trouble,  Prev: Amusements,  Up: Top
  906.  
  907. Installing Octave
  908. *****************
  909.  
  910.    Here is the procedure for installing Octave from scratch on a Unix
  911. system.  For instructions on how to install the binary distributions of
  912. Octave, see *Note Binary Distributions::.
  913.  
  914.    * Run the shell script `configure'.  This will determine the features
  915.      your system has (or doesn't have) and create a file named Makefile
  916.      from each of the files named Makefile.in.
  917.  
  918.      Here is a summary of the configure options that are most
  919.      frequently used when building Octave:
  920.  
  921.     `--prefix=PREFIX'
  922.           Install Octave in subdirectories below PREFIX.  The default
  923.           value of PREFIX is `/usr/local'.
  924.  
  925.     `--srcdir=DIR'
  926.           Look for Octave sources in the directory DIR.
  927.  
  928.     `--with-f2c'
  929.           Use f2c even if Fortran compiler is available.
  930.  
  931.     `--enable-dld'
  932.           Use DLD to make Octave capable of dynamically linking
  933.           externally compiled functions.  This only works on systems
  934.           that have a working port of DLD.
  935.  
  936.     `--enable-lite-kernel'
  937.           Compile smaller kernel.  This currently requires DLD so that
  938.           Octave can load functions at run time that are not loaded at
  939.           compile time.
  940.  
  941.     `--help'
  942.           Print a summary of the options recognized by the configure
  943.           script.
  944.  
  945.      See the file INSTALL for more information about the command line
  946.      options used by configure.  That file also contains instructions
  947.      for compiling in a directory other than where the source is
  948.      located.
  949.  
  950.    * Run make.
  951.  
  952.      You will need a recent version of GNU make.  Modifying Octave's
  953.      Makefiles to work with other make programs is probably not worth
  954.      your time.  We recommend you get and compile GNU make instead.
  955.  
  956.      For plotting, you will need to have gnuplot installed on your
  957.      system.  Gnuplot is a command-driven interactive function plotting
  958.      program.  Gnuplot is copyrighted, but freely distributable.  The
  959.      `gnu' in gnuplot is a coincidence--it is not related to the GNU
  960.      project or the FSF in any but the most peripheral sense.
  961.  
  962.      For version 1.1.1, you must have the GNU C++ compiler (gcc)
  963.      version 2.6.3 or later to compile Octave.  You will also need
  964.      version 2.6.1 of the GNU C++ class library (libg++).  If you plan
  965.      to modify the parser you will also need GNU bison and fles.  If
  966.      you modify the documentation, you will need GNU Texinfo, along
  967.      with the patch for the makeinfo program that is distributed with
  968.      Octave.
  969.  
  970.      GNU make, gcc, and libg++, gnuplot, bison, flex, and Texinfo are
  971.      all available from many anonymous ftp archives, including
  972.      ftp.che.utexas.edu, ftp.uu.net, prep.ai.mit.edu, and
  973.      wuarchive.wustl.edu.
  974.  
  975.      If you don't have a Fortran compiler, or if your Fortran compiler
  976.      doesn't work like the traditional Unix f77, you will need to have
  977.      the Fortran to C translator f2c.  You can get f2c from any number
  978.      of anonymous ftp archives.  The most recent version of f2c is
  979.      always available from research.att.com.
  980.  
  981.      On an otherwise idle SPARCstation II, it will take somewhere
  982.      between 60 and 90 minutes to compile everything, depending on
  983.      whether you are compiling the Fortran libraries with f2c or using
  984.      the Fortran compiler directly.  You will need about 50 megabytes
  985.      of disk storage to work with (considerably less if you don't
  986.      compile with debugging symbols).  To do that, use the command
  987.  
  988.           make CFLAGS=-O CXXFLAGS=-O LDFLAGS=
  989.  
  990.      instead of just `make'.
  991.  
  992.    * If you encounter errors while compiling Octave, first check the
  993.      list of known problems below to see if there is a workaround or
  994.      solution for your problem.  If not, see *Note Trouble::, for
  995.      information about how to report bugs.
  996.  
  997.    * Once you have successfully compiled Octave, run `make install'.
  998.  
  999.      This will install a copy of octave, its libraries, and its
  1000.      documentation in the destination directory.  As distributed,
  1001.      Octave is installed in the following directories:
  1002.  
  1003.     `PREFIX/bin'
  1004.           Octave and other binaries that people will want to run
  1005.           directly.
  1006.  
  1007.     `PREFIX/lib'
  1008.           Libraries like libcruft.a and liboctave.a.
  1009.  
  1010.     `PREFIX/include/octave'
  1011.           Include files distributed with Octave.
  1012.  
  1013.     `PREFIX/man/man1'
  1014.           Unix-style man pages describing Octave.
  1015.  
  1016.     `PREFIX/info'
  1017.           Info files describing Octave.
  1018.  
  1019.     `PREFIX/lib/octave/VERSION/m'
  1020.           Function files distributed with Octave.  This includes the
  1021.           Octave version, so that multiple versions of Octave may be
  1022.           installed at the same time.
  1023.  
  1024.     `PREFIX/lib/octave/VERSION/exec/HOST_TYPE'
  1025.           Executables to be run by Octave rather than the user.
  1026.  
  1027.     `PREFIX/lib/octave/VERSION/oct/HOST_TYPE'
  1028.           Object files that will be dynamically loaded.
  1029.  
  1030.     `PREFIX/lib/octave/VERSION/imagelib'
  1031.           Image files that are distributed with Octave.
  1032.  
  1033.      where PREFIX defaults to `/usr/local', VERSION stands for the
  1034.      current version number of the interpreter, and HOST_TYPE is the
  1035.      type of computer on which Octave is installed (for example,
  1036.      `i486-unknown-gnu').
  1037.  
  1038. * Menu:
  1039.  
  1040. * Installation Problems::
  1041. * Binary Distributions::
  1042.  
  1043. 
  1044. File: octave.info,  Node: Installation Problems,  Next: Binary Distributions,  Prev: Installation,  Up: Installation
  1045.  
  1046. Installation Problems
  1047. =====================
  1048.  
  1049.    This section contains a list of problems (and some apparent problems
  1050. that don't really mean anything is wrong) that may show up during
  1051. installation of Octave.
  1052.  
  1053.    * On AIX (and possibly other) systems, GCC 2.6.2 generates invalid
  1054.      assembly code when compiling some parts of Octave.  On AIX
  1055.      systems, it is possible to get a working binary by not using the
  1056.      compiler flag `-fno-implicit-templates'.  You can specify this as
  1057.      an option to make by using a command like
  1058.  
  1059.           make NO_IMPLICIT_TEMPLATES=
  1060.  
  1061.    * You may need to edit some files in the gcc include subdirectory to
  1062.      add prototypes for functions there.  For example, Ultrix 4.2 needs
  1063.      proper declarations for the `signal()' and the `SIG_IGN' macro in
  1064.      the file `signal.h'.
  1065.  
  1066.      On some systems the `SIG_IGN' macro is defined to be something like
  1067.      this:
  1068.  
  1069.           #define  SIG_IGN  (void (*)())1
  1070.  
  1071.      when it should really be something like:
  1072.  
  1073.           #define  SIG_IGN  (void (*)(int))1
  1074.  
  1075.      to match the prototype declaration for `signal()'.
  1076.  
  1077.      The gcc fixincludes/fixproto script should probably fix this when
  1078.      gcc installs its modified set of header files, but I don't think
  1079.      that's been done yet.
  1080.  
  1081.    * There is a bug with the makeinfo program that is distributed with
  1082.      texinfo-3.1 that causes the indices in Octave's on-line manual to
  1083.      be generated incorrectly.  If you need to recreate the on-line
  1084.      documentation, you should get the makeinfo program that is
  1085.      distributed with texinfo-3.1 and apply the patch for makeinfo that
  1086.      is distributed with Octave.  See the file MAKEINFO.PATCH for more
  1087.      details.
  1088.  
  1089.    * If you don't have NPSOL but you still want to be able to solve
  1090.      NLPs, or if you don't have QPSOL but you still want to solve QPs,
  1091.      you'll need to find replacements or order them from Stanford.  If
  1092.      you know of a freely redistributable replacement, please let us
  1093.      know--we might be interested in distributing it with Octave.
  1094.  
  1095.      You can get more information about NPSOL and QPSOL from
  1096.  
  1097.           Stanford University
  1098.           Office of Technology Licensing
  1099.           857 Serra Street
  1100.           Stanford CA 94305-6225
  1101.           Tel: (415) 723-0651
  1102.           Fax: (415) 725-7295
  1103.  
  1104.      Octave may soon support FSQP, an NLP solver from Andre Tits
  1105.      (andre@src.umd.edu) of the University of Maryland.  FSQP is
  1106.      available free of charge to academic sites, but can not be
  1107.      redistributed to third parties.
  1108.  
  1109.    * Some of the Fortran subroutines may fail to compile with older
  1110.      versions of the Sun Fortran compiler.  If you get errors like
  1111.  
  1112.           zgemm.f:
  1113.               zgemm:
  1114.           warning: unexpected parent of complex expression subtree
  1115.           zgemm.f, line 245: warning: unexpected parent of complex expression subtree
  1116.           warning: unexpected parent of complex expression subtree
  1117.           zgemm.f, line 304: warning: unexpected parent of complex expression subtree
  1118.           warning: unexpected parent of complex expression subtree
  1119.           zgemm.f, line 327: warning: unexpected parent of complex expression subtree
  1120.           pcc_binval: missing IR_CONV in complex op
  1121.           make[2]: *** [zgemm.o] Error 1
  1122.  
  1123.      when compiling the Fortran subroutines in the `libcruft'
  1124.      subdirectory, you should either upgrade your compiler or try
  1125.      compiling with optimization turned off.
  1126.  
  1127.    * On NeXT systems, if you get errors like this:
  1128.  
  1129.           /usr/tmp/cc007458.s:unknown:Undefined local symbol LBB7656
  1130.           /usr/tmp/cc007458.s:unknown:Undefined local symbol LBE7656
  1131.  
  1132.      when compiling `Array.cc' and `Matrix.cc', try recompiling these
  1133.      files without `-g'.
  1134.  
  1135.    * Some people have reported that calls to shell_cmd and the pager do
  1136.      not work on SunOS systems.  This is apparently due to having
  1137.      `G_HAVE_SYS_WAIT' defined to be 0 instead of 1 when compiling
  1138.      libg++.
  1139.  
  1140.    * On NeXT systems, linking to `libsys_s.a' may fail to resolve the
  1141.      following functions
  1142.  
  1143.           _tcgetattr
  1144.           _tcsetattr
  1145.           _tcflow
  1146.  
  1147.      which are part of `libposix.a'.  Unfortunately, linking Octave with
  1148.      `-posix' results in the following undefined symbols.
  1149.  
  1150.           .destructors_used
  1151.           .constructors_used
  1152.           _objc_msgSend
  1153.           _NXGetDefaultValue
  1154.           _NXRegisterDefaults
  1155.           .objc_class_name_NXStringTable
  1156.           .objc_class_name_NXBundle
  1157.  
  1158.      One kludge around this problem is to extract `termios.o' from
  1159.      `libposix.a', put it in Octave's `src' directory, and add it to
  1160.      the list of files to link together in the Makefile.  Suggestions
  1161.      for better ways to solve this problem are welcome!
  1162.  
  1163.    * With g++ 2.6.3 (and possibly other 2.6.x versions) on some Intel
  1164.      x86 systems, compiling `Array-d.cc' fails with the messages like
  1165.  
  1166.           as: /tmp/cc005254.s:4057: Local symbol LBB103 never defined.
  1167.           as: /tmp/cc005254.s:4057: Local symbol LBE103 never defined.
  1168.  
  1169.      A possible workaround for this is to compile without `-g'.
  1170.  
  1171.    * If Octave crashes immediately with a floating point exception, it
  1172.      is likely that it is failing to initialize the IEEE floating point
  1173.      values for infinity and NaN.
  1174.  
  1175.      If your system actually does support IEEE arithmetic, you should
  1176.      be able to fix this problem by modifying the function
  1177.      `octave_ieee_init' in the file `sysdep.cc' to correctly initialize
  1178.      Octave's internal infinity and NaN variables.
  1179.  
  1180.      If your system does not support IEEE arithmetic but Octave's
  1181.      configure script incorrectly determined that it does, you can work
  1182.      around the problem by editing the file `config.h' to not define
  1183.      `HAVE_ISINF', `HAVE_FINITE', and `HAVE_ISNAN'.
  1184.  
  1185.      In any case, please report this as a bug since it might be
  1186.      possible to modify Octave's configuration script to automatically
  1187.      determine the proper thing to do.
  1188.  
  1189. 
  1190. File: octave.info,  Node: Binary Distributions,  Prev: Installation Problems,  Up: Installation
  1191.  
  1192. Binary Distributions
  1193. ====================
  1194.  
  1195.    This section contains instructions for creating and installing a
  1196. binary distribution.
  1197.  
  1198. * Menu:
  1199.  
  1200. * Installing Octave from a Binary Distribution::
  1201. * Creating a Binary Distribution::
  1202.  
  1203. 
  1204. File: octave.info,  Node: Installing Octave from a Binary Distribution,  Next: Creating a Binary Distribution,  Prev: Binary Distributions,  Up: Binary Distributions
  1205.  
  1206. Installing Octave from a Binary Distribution
  1207. --------------------------------------------
  1208.  
  1209.    * To install Octave from a binary distribution, execute the command
  1210.  
  1211.           sh ./doinstall.sh
  1212.  
  1213.      in the top level directory of the distribution.
  1214.  
  1215.      Binary distributions are normally compiled assuming that Octave
  1216.      will be installed in the following subdirectories of `/usr/local'.
  1217.  
  1218.     `bin'
  1219.           Octave and other binaries that people will want to run
  1220.           directly.
  1221.  
  1222.     `man/man1'
  1223.           Unix-style man pages describing Octave.
  1224.  
  1225.     `info'
  1226.           Info files describing Octave.
  1227.  
  1228.     `lib/octave/VERSION/m'
  1229.           Function files distributed with Octave.  This includes the
  1230.           Octave version, so that multiple versions of Octave may be
  1231.           installed at the same time.
  1232.  
  1233.     `lib/octave/VERSION/exec/HOST_TYPE'
  1234.           Executables to be run by Octave rather than the user.
  1235.  
  1236.     `lib/octave/VERSION/imagelib'
  1237.           Image files that are distributed with Octave.
  1238.  
  1239.      where VERSION stands for the current version number of the
  1240.      interpreter, and HOST_TYPE is the type of computer on which Octave
  1241.      is installed (for example, `i486-unknown-gnu').
  1242.  
  1243.      If these directories don't exist, the script `doinstall.sh' will
  1244.      create them for you.
  1245.  
  1246.      If this is possible for you to install Octave in `/usr/local', or
  1247.      if you would prefer to install it in a different directory, you can
  1248.      specify the name of the top level directory as an argument to the
  1249.      doinstall.sh script.  For example:
  1250.  
  1251.           sh ./doinstall.sh /some/other/directory
  1252.  
  1253.      Octave will then be installed in subdirectories of the directory
  1254.      `/some/other/directory'
  1255.  
  1256. 
  1257. File: octave.info,  Node: Creating a Binary Distribution,  Prev: Installing Octave from a Binary Distribution,  Up: Binary Distributions
  1258.  
  1259. Creating a Binary Distribution
  1260. ------------------------------
  1261.  
  1262.    Here is how to build a binary distribution for others.
  1263.  
  1264.    * Build Octave in the same directory as the source.  This is required
  1265.      since the `binary-dist' targets in the Makefiles will not work if
  1266.      you compile outside the source tree.
  1267.  
  1268.    * Use `CFLAGS=-O CXXFLAGS=-O LDFLAGS=' as arguments for Make because
  1269.      most people who get the binary distributions are probably not
  1270.      going to be interested in debugging Octave.
  1271.  
  1272.    * Type `make binary-dist'.  This will build everything and then pack
  1273.      it up for distribution.
  1274.  
  1275. 
  1276. File: octave.info,  Node: Trouble,  Next: Command Line Editing,  Prev: Installation,  Up: Top
  1277.  
  1278. Known Causes of Trouble with Octave
  1279. ***********************************
  1280.  
  1281.    This section describes known problems that affect users of Octave.
  1282. Most of these are not Octave bugs per se--if they were, we would fix
  1283. them.  But the result for a user may be like the result of a bug.
  1284.  
  1285.    Some of these problems are due to bugs in other software, some are
  1286. missing features that are too much work to add, and some are places
  1287. where people's opinions differ as to what is best.
  1288.  
  1289. * Menu:
  1290.  
  1291. * Actual Bugs::                 Bugs we will fix later.
  1292. * Reporting Bugs::
  1293. * Bug Criteria::
  1294. * Bug Lists::
  1295. * Bug Reporting::
  1296. * Sending Patches::
  1297. * Service::
  1298.  
  1299. 
  1300. File: octave.info,  Node: Actual Bugs,  Next: Reporting Bugs,  Prev: Trouble,  Up: Trouble
  1301.  
  1302. Actual Bugs We Haven't Fixed Yet
  1303. ================================
  1304.  
  1305.    * Output that comes directly from Fortran functions is not sent
  1306.      through the pager and may appear out of sequence with other output
  1307.      that is sent through the pager.  One way to avoid this is to force
  1308.      pending output to be flushed before calling a function that will
  1309.      produce output from within Fortran functions.  To do this, use the
  1310.      command
  1311.  
  1312.           fflush (stdout)
  1313.  
  1314.      Another possible workaround is to use the command
  1315.  
  1316.           page_screen_output = "false"
  1317.  
  1318.      to turn the pager off.
  1319.  
  1320.    * Control-C doesn't work properly in the pager on DEC Alpha systems
  1321.      running OSF/1 3.0.
  1322.  
  1323.      This appears to be a bug in the OSF/1 3.0 Bourne shell.  The
  1324.      problem doesn't appear on systems running OSF/1 1.3.
  1325.  
  1326.    * If you get messages like
  1327.  
  1328.           Input line too long
  1329.  
  1330.      when trying to plot many lines on one graph, you have probably
  1331.      generated a plot command that is too larger for `gnuplot''s
  1332.      fixed-length buffer for commands.  Splitting up the plot command
  1333.      doesn't help because replot is implemented in gnuplot by simply
  1334.      appending the new plotting commands to the old command line and
  1335.      then evaluating it again.
  1336.  
  1337.      You can demonstrate this `feature' by running gnuplot and doing
  1338.      something like
  1339.  
  1340.             plot sin (x), sin (x), sin (x), ... lots more ..., sin (x)
  1341.  
  1342.      and then
  1343.  
  1344.             replot sin (x), sin (x), sin (x), ... lots more ..., sin (x)
  1345.  
  1346.      after repeating the replot command a few times, gnuplot will give
  1347.      you an error.
  1348.  
  1349.      Also, it doesn't help to use backslashes to enter a plot command
  1350.      over several lines, because the limit is on the overall command
  1351.      line length, once the backslashed lines are all pasted together.
  1352.  
  1353.      Because of this, Octave tries to use as little of the command-line
  1354.      length as possible by using the shortest possible abbreviations for
  1355.      all the plot commands and options.  Unfortunately, the length of
  1356.      the temporary file names is probably what is taking up the most
  1357.      space on the command line.
  1358.  
  1359.      You can buy a little bit of command line space by setting the
  1360.      environment variable `TMPDIR' to be "." before starting Octave, or
  1361.      you can increase the maximum command line length in gnuplot by
  1362.      changing the following limits in the file plot.h in the gnuplot
  1363.      distribution and recompiling gnuplot.
  1364.  
  1365.           #define MAX_LINE_LEN 32768  /* originally 1024 */
  1366.           #define MAX_TOKENS 8192     /* originally 400 */
  1367.  
  1368.      Of course, this doesn't really fix the problem, but it does make it
  1369.      much less likely that you will run into trouble unless you are
  1370.      putting a very large number of lines on a given plot.
  1371.  
  1372.    * String handling could use some work.
  1373.  
  1374.    A list of ideas for future enhancements is distributed with Octave.
  1375. See the file `PROJECTS' in the top level directory in the source
  1376. distribution.
  1377.  
  1378. 
  1379. File: octave.info,  Node: Reporting Bugs,  Next: Bug Criteria,  Prev: Actual Bugs,  Up: Trouble
  1380.  
  1381. Reporting Bugs
  1382. ==============
  1383.  
  1384.    Your bug reports play an essential role in making Octave reliable.
  1385.  
  1386.    When you encounter a problem, the first thing to do is to see if it
  1387. is already known.  *Note Trouble::.  If it isn't known, then you should
  1388. report the problem.
  1389.  
  1390.    Reporting a bug may help you by bringing a solution to your problem,
  1391. or it may not.  In any case, the principal function of a bug report is
  1392. to help the entire community by making the next version of Octave work
  1393. better.  Bug reports are your contribution to the maintenance of Octave.
  1394.  
  1395.    In order for a bug report to serve its purpose, you must include the
  1396. information that makes it possible to fix the bug.
  1397.  
  1398.    If you have Octave working at all, the easiest way to prepare a
  1399. complete bug report is to use the Octave function `bug_report'.  When
  1400. you execute this function, Octave will prompt you for a subject and then
  1401. invoke the editor on a file that already contains all the configuration
  1402. information.  When you exit the editor, Octave will mail the bug report
  1403. for you.
  1404.  
  1405. * Menu:
  1406.  
  1407. * Bug Criteria::
  1408. * Where: Bug Lists.             Where to send your bug report.
  1409. * Reporting: Bug Reporting.     How to report a bug effectively.
  1410. * Patches: Sending Patches.     How to send a patch for Octave.
  1411.  
  1412.