home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / doc / octave.i11 (.txt) < prev    next >
GNU Info File  |  2000-01-15  |  49KB  |  893 lines

  1. This is Info file octave, produced by Makeinfo-1.64 from the input file
  2. octave.tex.
  3. START-INFO-DIR-ENTRY
  4. * Octave: (octave).    Interactive language for numerical computations.
  5. END-INFO-DIR-ENTRY
  6.    Copyright (C) 1996, 1997 John W. Eaton.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  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.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions.
  17. File: octave,  Node: Coding Tips,  Next: Documentation Tips,  Prev: Style Tips,  Up: Tips
  18. Tips for Making Code Run Faster.
  19. ================================
  20.    Here are some ways of improving the execution speed of Octave
  21. programs.
  22.    * Avoid looping wherever possible.
  23.    * Use iteration rather than recursion whenever possible.  Function
  24.      calls are slow in Octave.
  25.    * Avoid resizing matrices unnecessarily.  When building a single
  26.      result matrix from a series of calculations, set the size of the
  27.      result matrix first, then insert values into it.  Write
  28.           result = zeros (big_n, big_m)
  29.           for i = over:and_over
  30.             r1 = ...
  31.             r2 = ...
  32.             result (r1, r2) = new_value ();
  33.           endfor
  34.      instead of
  35.           result = [];
  36.           for i = ever:and_ever
  37.             result = [ result, new_value() ];
  38.           endfor
  39.    * Avoid calling `eval' or `feval' whenever possible, because they
  40.      require Octave to parse input or look up the name of a function in
  41.      the symbol table.
  42.      If you are using `eval' as an exception handling mechanism and not
  43.      because you need to execute some arbitrary text, use the `try'
  44.      statement instead.  *Note The try Statement::.
  45.    * If you are calling lots of functions but none of them will need to
  46.      change during your run, set the variable
  47.      `ignore_function_time_stamp' to `"all"' so that Octave doesn't
  48.      waste a lot of time checking to see if you have updated your
  49.      function files.
  50. File: octave,  Node: Documentation Tips,  Next: Comment Tips,  Prev: Coding Tips,  Up: Tips
  51. Tips for Documentation Strings
  52. ==============================
  53.    Here are some tips for the writing of documentation strings.
  54.    * Every command, function, or variable intended for users to know
  55.      about should have a documentation string.
  56.    * An internal variable or subroutine of an Octave program might as
  57.      well have a documentation string.
  58.    * The first line of the documentation string should consist of one
  59.      or two complete sentences that stand on their own as a summary.
  60.      The documentation string can have additional lines that expand on
  61.      the details of how to use the function or variable.  The
  62.      additional lines should also be made up of complete sentences.
  63.    * For consistency, phrase the verb in the first sentence of a
  64.      documentation string as an infinitive with "to" omitted.  For
  65.      instance, use "Return the frob of A and B." in preference to
  66.      "Returns the frob of A and B
  67. "  Usually it looks good to do
  68.      likewise for the rest of the first paragraph.  Subsequent
  69.      paragraphs usually look better if they have proper subjects.
  70.    * Write documentation strings in the active voice, not the passive,
  71.      and in the present tense, not the future.  For instance, use
  72.      "Return a list containing A and B." instead of "A list containing
  73.      A and B will be returned."
  74.    * Avoid using the word "cause" (or its equivalents) unnecessarily.
  75.      Instead of, "Cause Octave to display text in boldface," write just
  76.      "Display text in boldface."
  77.    * Do not start or end a documentation string with whitespace.
  78.    * Format the documentation string so that it fits in an Emacs window
  79.      on an 80-column screen.  It is a good idea for most lines to be no
  80.      wider than 60 characters.
  81.      However, rather than simply filling the entire documentation
  82.      string, you can make it much more readable by choosing line breaks
  83.      with care.  Use blank lines between topics if the documentation
  84.      string is long.
  85.    * *Do not* indent subsequent lines of a documentation string so that
  86.      the text is lined up in the source code with the text of the first
  87.      line.  This looks nice in the source code, but looks bizarre when
  88.      users view the documentation.  Remember that the indentation
  89.      before the starting double-quote is not part of the string!
  90.    * The documentation string for a variable that is a yes-or-no flag
  91.      should start with words such as "Nonzero means...", to make it
  92.      clear that all nonzero values are equivalent and indicate
  93.      explicitly what zero and nonzero mean.
  94.    * When a function's documentation string mentions the value of an
  95.      argument of the function, use the argument name in capital letters
  96.      as if it were a name for that value.  Thus, the documentation
  97.      string of the operator `/' refers to its second argument as
  98.      `DIVISOR', because the actual argument name is `divisor'.
  99.      Also use all caps for meta-syntactic variables, such as when you
  100.      show the decomposition of a list or vector into subunits, some of
  101.      which may vary.
  102. File: octave,  Node: Comment Tips,  Next: Function Headers,  Prev: Documentation Tips,  Up: Tips
  103. Tips on Writing Comments
  104. ========================
  105.    Here are the conventions to follow when writing comments.
  106.      Comments that start with a single sharp-sign, `#', should all be
  107.      aligned to the same column on the right of the source code.  Such
  108.      comments usually explain how the code on the same line does its
  109.      job.  In the Emacs mode for Octave, the `M-;'
  110.      (`indent-for-comment') command automatically inserts such a `#' in
  111.      the right place, or aligns such a comment if it is already present.
  112.      Comments that start with two semicolons, `##', should be aligned to
  113.      the same level of indentation as the code.  Such comments usually
  114.      describe the purpose of the following lines or the state of the
  115.      program at that point.
  116. The indentation commands of the Octave mode in Emacs, such as `M-;'
  117. (`indent-for-comment') and `TAB' (`octave-indent-line') automatically
  118. indent comments according to these conventions, depending on the number
  119. of semicolons.  *Note Manipulating Comments: (emacs)Comments.
  120. File: octave,  Node: Function Headers,  Prev: Comment Tips,  Up: Tips
  121. Conventional Headers for Octave Functions
  122. =========================================
  123.    Octave has conventions for using special comments in function files
  124. to give information such as who wrote them.  This section explains these
  125. conventions.
  126.    The top of the file should contain a copyright notice, followed by a
  127. block of comments that can be used as the help text for the function.
  128. Here is an example:
  129.      ## Copyright (C) 1996, 1997 John W. Eaton
  130.      ##
  131.      ## This file is part of Octave.
  132.      ##
  133.      ## Octave is free software; you can redistribute it and/or
  134.      ## modify it under the terms of the GNU General Public
  135.      ## License as published by the Free Software Foundation;
  136.      ## either version 2, or (at your option) any later version.
  137.      ##
  138.      ## Octave is distributed in the hope that it will be useful,
  139.      ## but WITHOUT ANY WARRANTY; without even the implied
  140.      ## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  141.      ## PURPOSE.  See the GNU General Public License for more
  142.      ## details.
  143.      ##
  144.      ## You should have received a copy of the GNU General Public
  145.      ## License along with Octave; see the file COPYING.  If not,
  146.      ## write to the Free Software Foundation, 59 Temple Place -
  147.      ## Suite 330, Boston, MA 02111-1307, USA.
  148.      
  149.      ## usage: [IN, OUT, PID] = popen2 (COMMAND, ARGS)
  150.      ##
  151.      ## Start a subprocess with two-way communication.  COMMAND
  152.      ## specifies the name of the command to start.  ARGS is an
  153.      ## array of strings containing options for COMMAND.  IN and
  154.      ## OUT are the file ids of the input and streams for the
  155.      ## subprocess, and PID is the process id of the subprocess,
  156.      ## or -1 if COMMAND could not be executed.
  157.      ##
  158.      ## Example:
  159.      ##
  160.      ##  [in, out, pid] = popen2 ("sort", "-nr");
  161.      ##  fputs (in, "these\nare\nsome\nstrings\n");
  162.      ##  fclose (in);
  163.      ##  while (isstr (s = fgets (out)))
  164.      ##    fputs (stdout, s);
  165.      ##  endwhile
  166.      ##  fclose (out);
  167.    Octave uses the first block of comments in a function file that do
  168. not appear to be a copyright notice as the help text for the file.  For
  169. Octave to recognize the first comment block as a copyright notice, it
  170. must match the regular expression
  171.      ^ Copyright (C).*\n\n This file is part of Octave.
  172.      ^ Copyright (C).*\n\n This program is free softwar
  173. (after stripping the leading comment characters).  This is a fairly
  174. strict requirement, and may be relaxed somewhat in the future.
  175.    After the copyright notice and help text come several "header
  176. comment" lines, each beginning with `## HEADER-NAME:'.  For example,
  177.      ## Author: jwe
  178.      ## Keywords: subprocesses input-output
  179.      ## Maintainer: jwe
  180.    Here is a table of the conventional possibilities for HEADER-NAME:
  181. `Author'
  182.      This line states the name and net address of at least the principal
  183.      author of the library.
  184.           ## Author: John W. Eaton <jwe@bevo.che.wisc.edu>
  185. `Maintainer'
  186.      This line should contain a single name/address as in the Author
  187.      line, or an address only, or the string `jwe'.  If there is no
  188.      maintainer line, the person(s) in the Author field are presumed to
  189.      be the maintainers.  The example above is mildly bogus because the
  190.      maintainer line is redundant.
  191.      The idea behind the `Author' and `Maintainer' lines is to make
  192.      possible a function to "send mail to the maintainer" without
  193.      having to mine the name out by hand.
  194.      Be sure to surround the network address with `<...>' if you
  195.      include the person's full name as well as the network address.
  196. `Created'
  197.      This optional line gives the original creation date of the file.
  198.      For historical interest only.
  199. `Version'
  200.      If you wish to record version numbers for the individual Octave
  201.      program, put them in this line.
  202. `Adapted-By'
  203.      In this header line, place the name of the person who adapted the
  204.      library for installation (to make it fit the style conventions, for
  205.      example).
  206. `Keywords'
  207.      This line lists keywords.  Eventually, it will be used by an
  208.      apropos command to allow people will find your package when
  209.      they're looking for things by topic area.  To separate the
  210.      keywords, you can use spaces, commas, or both.
  211.    Just about every Octave function ought to have the `Author' and
  212. `Keywords' header comment lines.  Use the others if they are
  213. appropriate.  You can also put in header lines with other header
  214. names--they have no standard meanings, so they can't do any harm.
  215.    % DO NOT EDIT!  Generated automatically by munge-texi.
  216. File: octave,  Node: Trouble,  Next: Installation,  Prev: Tips,  Up: Top
  217. Known Causes of Trouble
  218. ***********************
  219.    This section describes known problems that affect users of Octave.
  220. Most of these are not Octave bugs per se--if they were, we would fix
  221. them.  But the result for a user may be like the result of a bug.
  222.    Some of these problems are due to bugs in other software, some are
  223. missing features that are too much work to add, and some are places
  224. where people's opinions differ as to what is best.
  225. * Menu:
  226. * Actual Bugs::                 Bugs we will fix later.
  227. * Reporting Bugs::
  228. * Bug Criteria::
  229. * Bug Lists::
  230. * Bug Reporting::
  231. * Sending Patches::
  232. * Service::
  233. File: octave,  Node: Actual Bugs,  Next: Reporting Bugs,  Prev: Trouble,  Up: Trouble
  234. Actual Bugs We Haven't Fixed Yet
  235. ================================
  236.    * Output that comes directly from Fortran functions is not sent
  237.      through the pager and may appear out of sequence with other output
  238.      that is sent through the pager.  One way to avoid this is to force
  239.      pending output to be flushed before calling a function that will
  240.      produce output from within Fortran functions.  To do this, use the
  241.      command
  242.           fflush (stdout)
  243.      Another possible workaround is to use the command
  244.           page_screen_output = "false"
  245.      to turn the pager off.
  246.    * If you get messages like
  247.           Input line too long
  248.      when trying to plot many lines on one graph, you have probably
  249.      generated a plot command that is too larger for `gnuplot''s
  250.      fixed-length buffer for commands.  Splitting up the plot command
  251.      doesn't help because replot is implemented in gnuplot by simply
  252.      appending the new plotting commands to the old command line and
  253.      then evaluating it again.
  254.      You can demonstrate this `feature' by running gnuplot and doing
  255.      something like
  256.             plot sin (x), sin (x), sin (x), ... lots more ..., sin (x)
  257.      and then
  258.             replot sin (x), sin (x), sin (x), ... lots more ..., sin (x)
  259.      after repeating the replot command a few times, gnuplot will give
  260.      you an error.
  261.      Also, it doesn't help to use backslashes to enter a plot command
  262.      over several lines, because the limit is on the overall command
  263.      line length, once the backslashed lines are all pasted together.
  264.      Because of this, Octave tries to use as little of the command-line
  265.      length as possible by using the shortest possible abbreviations for
  266.      all the plot commands and options.  Unfortunately, the length of
  267.      the temporary file names is probably what is taking up the most
  268.      space on the command line.
  269.      You can buy a little bit of command line space by setting the
  270.      environment variable `TMPDIR' to be "." before starting Octave, or
  271.      you can increase the maximum command line length in gnuplot by
  272.      changing the following limits in the file plot.h in the gnuplot
  273.      distribution and recompiling gnuplot.
  274.           #define MAX_LINE_LEN 32768  /* originally 1024 */
  275.           #define MAX_TOKENS 8192     /* originally 400 */
  276.      Of course, this doesn't really fix the problem, but it does make it
  277.      much less likely that you will run into trouble unless you are
  278.      putting a very large number of lines on a given plot.
  279.    A list of ideas for future enhancements is distributed with Octave.
  280. See the file `PROJECTS' in the top level directory in the source
  281. distribution.
  282. File: octave,  Node: Reporting Bugs,  Next: Bug Criteria,  Prev: Actual Bugs,  Up: Trouble
  283. Reporting Bugs
  284. ==============
  285.    Your bug reports play an essential role in making Octave reliable.
  286.    When you encounter a problem, the first thing to do is to see if it
  287. is already known.  *Note Trouble::.  If it isn't known, then you should
  288. report the problem.
  289.    Reporting a bug may help you by bringing a solution to your problem,
  290. or it may not.  In any case, the principal function of a bug report is
  291. to help the entire community by making the next version of Octave work
  292. better.  Bug reports are your contribution to the maintenance of Octave.
  293.    In order for a bug report to serve its purpose, you must include the
  294. information that makes it possible to fix the bug.
  295.    If you have Octave working at all, the easiest way to prepare a
  296. complete bug report is to use the Octave function `bug_report'.  When
  297. you execute this function, Octave will prompt you for a subject and then
  298. invoke the editor on a file that already contains all the configuration
  299. information.  When you exit the editor, Octave will mail the bug report
  300. for you.
  301. * Menu:
  302. * Bug Criteria::
  303. * Where: Bug Lists.             Where to send your bug report.
  304. * Reporting: Bug Reporting.     How to report a bug effectively.
  305. * Patches: Sending Patches.     How to send a patch for Octave.
  306. File: octave,  Node: Bug Criteria,  Next: Bug Lists,  Prev: Reporting Bugs,  Up: Trouble
  307. Have You Found a Bug?
  308. =====================
  309.    If you are not sure whether you have found a bug, here are some
  310. guidelines:
  311.    * If Octave gets a fatal signal, for any input whatever, that is a
  312.      bug.  Reliable interpreters never crash.
  313.    * If Octave produces incorrect results, for any input whatever, that
  314.      is a bug.
  315.    * Some output may appear to be incorrect when it is in fact due to a
  316.      program whose behavior is undefined, which happened by chance to
  317.      give the desired results on another system.  For example, the
  318.      range operator may produce different results because of
  319.      differences in the way floating point arithmetic is handled on
  320.      various systems.
  321.    * If Octave produces an error message for valid input, that is a bug.
  322.    * If Octave does not produce an error message for invalid input,
  323.      that is a bug.  However, you should note that your idea of
  324.      "invalid input" might be my idea of "an extension" or "support for
  325.      traditional practice".
  326.    * If you are an experienced user of programs like Octave, your
  327.      suggestions for improvement are welcome in any case.
  328. File: octave,  Node: Bug Lists,  Next: Bug Reporting,  Prev: Bug Criteria,  Up: Trouble
  329. Where to Report Bugs
  330. ====================
  331.    If you have Octave working at all, the easiest way to prepare a
  332. complete bug report is to use the Octave function `bug_report'.  When
  333. you execute this function, Octave will prompt you for a subject and then
  334. invoke the editor on a file that already contains all the configuration
  335. information.  When you exit the editor, Octave will mail the bug report
  336. for you.
  337.    If for some reason you cannot use Octave's `bug_report' function,
  338. send bug reports for Octave to (bug-octave@bevo.che.wisc.edu).
  339.    *Do not send bug reports to `help-octave'*.  Most users of Octave do
  340. not want to receive bug reports.  Those that do have asked to be on the
  341. mailing list.
  342.    As a last resort, send bug reports on paper to:
  343.      Octave Bugs c/o John W. Eaton
  344.      University of Wisconsin-Madison
  345.      Department of Chemical Engineering
  346.      1415 Engineering Drive
  347.      Madison, Wisconsin 53706  USA
  348. File: octave,  Node: Bug Reporting,  Next: Sending Patches,  Prev: Bug Lists,  Up: Trouble
  349. How to Report Bugs
  350. ==================
  351.    Send bug reports for Octave to one of the addresses listed in *Note
  352. Bug Lists::.
  353.    The fundamental principle of reporting bugs usefully is this:
  354. *report all the facts*.  If you are not sure whether to state a fact or
  355. leave it out, state it!
  356.    Often people omit facts because they think they know what causes the
  357. problem and they conclude that some details don't matter.  Thus, you
  358. might assume that the name of the variable you use in an example does
  359. not matter.  Well, probably it doesn't, but one cannot be sure.
  360. Perhaps the bug is a stray memory reference which happens to fetch from
  361. the location where that name is stored in memory; perhaps, if the name
  362. were different, the contents of that location would fool the
  363. interpreter into doing the right thing despite the bug.  Play it safe
  364. and give a specific, complete example.
  365.    Keep in mind that the purpose of a bug report is to enable someone to
  366. fix the bug if it is not known. Always write your bug reports on the
  367. assumption that the bug is not known.
  368.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  369. bell?"  This cannot help us fix a bug.  It is better to send a complete
  370. bug report to begin with.
  371.    Try to make your bug report self-contained.  If we have to ask you
  372. for more information, it is best if you include all the previous
  373. information in your response, as well as the information that was
  374. missing.
  375.    To enable someone to investigate the bug, you should include all
  376. these things:
  377.    * The version of Octave.  You can get this by noting the version
  378.      number that is printed when Octave starts, or running it with the
  379.      `-v' option.
  380.    * A complete input file that will reproduce the bug.
  381.      A single statement may not be enough of an example--the bug might
  382.      depend on other details that are missing from the single statement
  383.      where the error finally occurs.
  384.    * The command arguments you gave Octave to execute that example and
  385.      observe the bug.  To guarantee you won't omit something important,
  386.      list all the options.
  387.      If we were to try to guess the arguments, we would probably guess
  388.      wrong and then we would not encounter the bug.
  389.    * The type of machine you are using, and the operating system name
  390.      and version number.
  391.    * The command-line arguments you gave to the `configure' command when
  392.      you installed the interpreter.
  393.    * A complete list of any modifications you have made to the
  394.      interpreter source.
  395.      Be precise about these changes--show a context diff for them.
  396.    * Details of any other deviations from the standard procedure for
  397.      installing Octave.
  398.    * A description of what behavior you observe that you believe is
  399.      incorrect.  For example, "The interpreter gets a fatal signal,"
  400.      or, "The output produced at line 208 is incorrect."
  401.      Of course, if the bug is that the interpreter gets a fatal signal,
  402.      then one can't miss it.  But if the bug is incorrect output, we
  403.      might not notice unless it is glaringly wrong.
  404.      Even if the problem you experience is a fatal signal, you should
  405.      still say so explicitly.  Suppose something strange is going on,
  406.      such as, your copy of the interpreter is out of synch, or you have
  407.      encountered a bug in the C library on your system.  Your copy
  408.      might crash and the copy here would not.  If you said to expect a
  409.      crash, then when the interpreter here fails to crash, we would
  410.      know that the bug was not happening.  If you don't say to expect a
  411.      crash, then we would not know whether the bug was happening.  We
  412.      would not be able to draw any conclusion from our observations.
  413.      Often the observed symptom is incorrect output when your program
  414.      is run.  Unfortunately, this is not enough information unless the
  415.      program is short and simple.  It is very helpful if you can
  416.      include an explanation of the expected output, and why the actual
  417.      output is incorrect.
  418.    * If you wish to suggest changes to the Octave source, send them as
  419.      context diffs.  If you even discuss something in the Octave source,
  420.      refer to it by context, not by line number, because the line
  421.      numbers in the development sources probably won't match those in
  422.      your sources.
  423.    Here are some things that are not necessary:
  424.    * A description of the envelope of the bug.
  425.      Often people who encounter a bug spend a lot of time investigating
  426.      which changes to the input file will make the bug go away and
  427.      which changes will not affect it.  Such information is usually not
  428.      necessary to enable us to fix bugs in Octave, but if you can find
  429.      a simpler example to report *instead* of the original one, that is
  430.      a convenience.  Errors in the output will be easier to spot,
  431.      running under the debugger will take less time, etc. Most Octave
  432.      bugs involve just one function, so the most straightforward way to
  433.      simplify an example is to delete all the function definitions
  434.      except the one in which the bug occurs.
  435.      However, simplification is not vital; if you don't want to do
  436.      this, report the bug anyway and send the entire test case you used.
  437.    * A patch for the bug.  Patches can be helpful, but if you find a
  438.      bug, you should report it, even if you cannot send a fix for the
  439.      problem.
  440. File: octave,  Node: Sending Patches,  Next: Service,  Prev: Bug Reporting,  Up: Trouble
  441. Sending Patches for Octave
  442. ==========================
  443.    If you would like to write bug fixes or improvements for Octave,
  444. that is very helpful.  When you send your changes, please follow these
  445. guidelines to avoid causing extra work for us in studying the patches.
  446.    If you don't follow these guidelines, your information might still be
  447. useful, but using it will take extra work.  Maintaining Octave is a lot
  448. of work in the best of circumstances, and we can't keep up unless you do
  449. your best to help.
  450.    * Send an explanation with your changes of what problem they fix or
  451.      what improvement they bring about.  For a bug fix, just include a
  452.      copy of the bug report, and explain why the change fixes the bug.
  453.    * Always include a proper bug report for the problem you think you
  454.      have fixed.  We need to convince ourselves that the change is
  455.      right before installing it.  Even if it is right, we might have
  456.      trouble judging it if we don't have a way to reproduce the problem.
  457.    * Include all the comments that are appropriate to help people
  458.      reading the source in the future understand why this change was
  459.      needed.
  460.    * Don't mix together changes made for different reasons.  Send them
  461.      *individually*.
  462.      If you make two changes for separate reasons, then we might not
  463.      want to install them both.  We might want to install just one.
  464.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  465.      for us to install reliably.  More than that, they make it hard for
  466.      us to study the diffs to decide whether we want to install them.
  467.      Unidiff format is better than contextless diffs, but not as easy
  468.      to read as `-c' format.
  469.      If you have GNU diff, use `diff -cp', which shows the name of the
  470.      function that each change occurs in.
  471.    * Write the change log entries for your changes.
  472.      Read the `ChangeLog' file to see what sorts of information to put
  473.      in, and to learn the style that we use.  The purpose of the change
  474.      log is to show people where to find what was changed.  So you need
  475.      to be specific about what functions you changed; in large
  476.      functions, it's often helpful to indicate where within the
  477.      function the change was made.
  478.      On the other hand, once you have shown people where to find the
  479.      change, you need not explain its purpose. Thus, if you add a new
  480.      function, all you need to say about it is that it is new.  If you
  481.      feel that the purpose needs explaining, it probably does--but the
  482.      explanation will be much more useful if you put it in comments in
  483.      the code.
  484.      If you would like your name to appear in the header line for who
  485.      made the change, send us the header line.
  486. File: octave,  Node: Service,  Prev: Sending Patches,  Up: Trouble
  487. How To Get Help with Octave
  488. ===========================
  489.    The mailing list (help-octave@bevo.che.wisc.edu) exists for the
  490. discussion of matters related to using and installing Octave.  If would
  491. like to join the discussion, please send a short note to
  492. (help-octave*-request*@bevo.che.wisc.edu).
  493.    *Please do not* send requests to be added or removed from the
  494. mailing list, or other administrative trivia to the list itself.
  495.    If you think you have found a bug in the installation procedure,
  496. however, you should send a complete bug report for the problem to
  497. (bug-octave@bevo.che.wisc.edu).  *Note Bug Reporting:: for information
  498. that will help you to submit a useful report.
  499.    % DO NOT EDIT!  Generated automatically by munge-texi.
  500. File: octave,  Node: Installation,  Next: Emacs,  Prev: Trouble,  Up: Top
  501. Installing Octave
  502. *****************
  503.    Here is the procedure for installing Octave from scratch on a Unix
  504. system.  For instructions on how to install the binary distributions of
  505. Octave, see *Note Binary Distributions::.
  506.    * Run the shell script `configure'.  This will determine the features
  507.      your system has (or doesn't have) and create a file named
  508.      `Makefile' from each of the files named `Makefile.in'.
  509.      Here is a summary of the configure options that are most
  510.      frequently used when building Octave:
  511.     `--prefix=PREFIX'
  512.           Install Octave in subdirectories below PREFIX.  The default
  513.           value of PREFIX is `/usr/local'.
  514.     `--srcdir=DIR'
  515.           Look for Octave sources in the directory DIR.
  516.     `--with-f2c'
  517.           Use `f2c' even if a Fortran compiler is available.
  518.     `--with-g77'
  519.           Use `g77' to compile Fortran code.
  520.     `--enable-shared'
  521.           Create shared libraries.  If you are planning to use
  522.           `--enable-lite-kernelel' or the dynamic loading features, you
  523.           will probably want to use this option.  It will make your
  524.           `.oct' files much smaller and on some systems it may be
  525.           necessary to build shared libraries in order to use
  526.           dynamically linked functions.
  527.           You may also want to build a shared version of `libstdc++',
  528.           if your system doesn't already have one.  Note that a patch
  529.           is needed to build shared versions of version 2.7.2 of
  530.           `libstdc++' on the HP-PA architecture.  You can find the
  531.           patch at
  532.           (ftp://ftp.cygnus.com/pub/g++/libg++-2.7.2-hppa-gcc-fix).
  533.     `--enable-dl'
  534.           Use `dlopen' and friends to make Octave capable of dynamically
  535.           linking externally compiled functions.  This only works on
  536.           systems that actually have these functions.  If you plan on
  537.           using this feature, you should probably also use
  538.           `--enable-shared' to reduce the size of your `.oct' files.
  539.     `--enable-shl'
  540.           Use `shl_load' and friends to make Octave capable of
  541.           dynamically linking externally compiled functions.  This only
  542.           works on systems that actually have these functions (only
  543.           HP-UX systems).  If you plan on using this feature, you
  544.           should probably also use `--enable-shared' to reduce the size
  545.           of your `.oct' files.
  546.     `--enable-lite-kernel'
  547.           Compile smaller kernel.  This currently requires the dynamic
  548.           linking functions `dlopen' or `shl_load' and friends so that
  549.           Octave can load functions at run time that are not loaded at
  550.           compile time.
  551.     `--help'
  552.           Print a summary of the options recognized by the configure
  553.           script.
  554.      See the file `INSTALL' for more information about the command line
  555.      options used by configure.  That file also contains instructions
  556.      for compiling in a directory other than where the source is
  557.      located.
  558.    * Run make.
  559.      You will need a recent version of GNU Make.  Modifying Octave's
  560.      makefiles to work with other make programs is probably not worth
  561.      your time.  We recommend you get and compile GNU Make instead.
  562.      For plotting, you will need to have gnuplot installed on your
  563.      system.  Gnuplot is a command-driven interactive function plotting
  564.      program.  Gnuplot is copyrighted, but freely distributable.  The
  565.      `gnu' in gnuplot is a coincidence--it is not related to the GNU
  566.      project or the FSF in any but the most peripheral sense.
  567.      To compile Octave, you will need a recent version of GNU Make.  You
  568.      will also need `g++' 2.7.2 or later.  Version 2.8.0 or `egcs'
  569.      1.0.x should work.  Later versions may work, but C++ is still
  570.      evolving, so don't be too surprised if you run into some trouble.
  571.      It is no longer necessary to have `libg++', but you do need to have
  572.      the GNU implementation of `libstdc++'.  If you are using `g++'
  573.      2.7.2, `libstdc++' is distributed along with `libg++', but for
  574.      later versions, `libstdc++' is distributed separately.  For
  575.      `egcs', `libstdc++' is included with the compiler distribution.
  576.      If you plan to modify the parser you will also need GNU `bison' and
  577.      `flex'.  If you modify the documentation, you will need GNU
  578.      Texinfo, along with the patch for the `makeinfo' program that is
  579.      distributed with Octave.
  580.      GNU Make, `gcc', and `libstdc++', `gnuplot', `bison', `flex', and
  581.      Texinfo are all available from many anonymous ftp archives.  The
  582.      primary site is (ftp.gnu.org), but it is often very busy.  A list
  583.      of sites that mirror the software on (ftp.gnu.org) is available by
  584.      anonymous ftp from (ftp://ftp.gnu.org/pub/gnu/GNUinfo/FTP).
  585.      If you don't have a Fortran compiler, or if your Fortran compiler
  586.      doesn't work like the traditional Unix f77, you will need to have
  587.      the Fortran to C translator `f2c'.  You can get `f2c' from any
  588.      number of anonymous ftp archives.  The most recent version of `f2c'
  589.      is always available from (netlib.att.com).
  590.      On an otherwise idle Pentium 133 running Linux, it will take
  591.      somewhere between 1-1/2 to 3 hours to compile everything,
  592.      depending on whether you are building shared libraries.  You will
  593.      need about 100 megabytes of disk storage to work with
  594.      (considerably less if you don't compile with debugging symbols).
  595.      To do that, use the command
  596.           make CFLAGS=-O CXXFLAGS=-O LDFLAGS=
  597.      instead of just `make'.
  598.    * If you encounter errors while compiling Octave, first check the
  599.      list of known problems below to see if there is a workaround or
  600.      solution for your problem.  If not, see *Note Trouble::, for
  601.      information about how to report bugs.
  602.    * Once you have successfully compiled Octave, run `make install'.
  603.      This will install a copy of octave, its libraries, and its
  604.      documentation in the destination directory.  As distributed,
  605.      Octave is installed in the following directories.  In the table
  606.      below, PREFIX defaults to `/usr/local', VERSION stands for the
  607.      current version number of the interpreter, and ARCH is the type of
  608.      computer on which Octave is installed (for example,
  609.      `i586-unknown-gnu').
  610.     `PREFIX/bin'
  611.           Octave and other binaries that people will want to run
  612.           directly.
  613.     `PREFIX/lib'
  614.           Libraries like libcruft.a and liboctave.a.
  615.     `PREFIX/share'
  616.           Architecture-independent data files.
  617.     `PREFIX/include/octave'
  618.           Include files distributed with Octave.
  619.     `PREFIX/man/man1'
  620.           Unix-style man pages describing Octave.
  621.     `PREFIX/info'
  622.           Info files describing Octave.
  623.     `PREFIX/share/octave/VERSION/m'
  624.           Function files distributed with Octave.  This includes the
  625.           Octave version, so that multiple versions of Octave may be
  626.           installed at the same time.
  627.     `PREFIX/lib/octave/VERSION/exec/ARCH'
  628.           Executables to be run by Octave rather than the user.
  629.     `PREFIX/lib/octave/VERSION/oct/ARCH'
  630.           Object files that will be dynamically loaded.
  631.     `PREFIX/share/octave/VERSION/imagelib'
  632.           Image files that are distributed with Octave.
  633. * Menu:
  634. * Installation Problems::
  635. * Binary Distributions::
  636. File: octave,  Node: Installation Problems,  Next: Binary Distributions,  Prev: Installation,  Up: Installation
  637. Installation Problems
  638. =====================
  639.    This section contains a list of problems (and some apparent problems
  640. that don't really mean anything is wrong) that may show up during
  641. installation of Octave.
  642.    * On some SCO systems, `info' fails to compile if `HAVE_TERMIOS_H'
  643.      is defined int `config.h'.  Simply removing the definition from
  644.      `info/config.h' should allow it to compile.
  645.    * If `configure' finds `dlopen', `dlsym', `dlclose', and `dlerror',
  646.      but not the header file `dlfcn.h', you need to find the source for
  647.      the header file and install it in the directory `usr/include'.
  648.      This is reportedly a problem with Slackware 3.1.  For Linux/GNU
  649.      systems, the source for `dlfcn.h' is in the `ldso' package.
  650.    * Building `.oct' files doesn't work.
  651.      You should probably have a shared version of `libstdc++'.  A patch
  652.      is needed to build shared versions of version 2.7.2 of `libstdc++'
  653.      on the HP-PA architecture.  You can find the patch at
  654.      (ftp://ftp.cygnus.com/pub/g++/libg++-2.7.2-hppa-gcc-fix).
  655.    * On FreeBSD systems Octave may hang while initializing some internal
  656.      constants.  The fix appears to be to use
  657.           options      GPL_MATH_EMULATE
  658.      rather than
  659.           options      MATH_EMULATE
  660.      in the kernel configuration files (typically found in the directory
  661.      `/sys/i386/conf'.  After making this change, you'll need to rebuild
  662.      the kernel, install it, and reboot.
  663.    * If you encounter errors like
  664.           passing `void (*)()' as argument 2 of
  665.             `octave_set_signal_handler(int, void (*)(int))'
  666.      or
  667.           warning: ANSI C++ prohibits conversion from `(int)' to `(...)'
  668.      while compiling `sighandlers.cc', you may need to edit some files
  669.      in the `gcc' include subdirectory to add proper prototypes for
  670.      functions there.  For example, Ultrix 4.2 needs proper
  671.      declarations for the `signal' function and the `SIG_IGN' macro in
  672.      the file `signal.h'.
  673.      On some systems the `SIG_IGN' macro is defined to be something like
  674.      this:
  675.           #define  SIG_IGN  (void (*)())1
  676.      when it should really be something like:
  677.           #define  SIG_IGN  (void (*)(int))1
  678.      to match the prototype declaration for the `signal' function.  This
  679.      change should also be made for the `SIG_DFL' and `SIG_ERR'
  680.      symbols. It may be necessary to change the definitions in
  681.      `sys/signal.h' as well.
  682.      The `gcc' `fixincludes' and `fixproto' scripts should probably fix
  683.      these problems when `gcc' installs its modified set of header
  684.      files, but I don't think that's been done yet.
  685.      *You should not change the files in `/usr/include'*.  You can find
  686.      the `gcc' include directory tree by running the command
  687.           gcc -print-libgcc-file-name
  688.      The directory of `gcc' include files normally begins in the same
  689.      directory that contains the file `libgcc.a'.
  690.    * Some of the Fortran subroutines may fail to compile with older
  691.      versions of the Sun Fortran compiler.  If you get errors like
  692.           zgemm.f:
  693.               zgemm:
  694.           warning: unexpected parent of complex expression subtree
  695.           zgemm.f, line 245: warning: unexpected parent of complex
  696.             expression subtree
  697.           warning: unexpected parent of complex expression subtree
  698.           zgemm.f, line 304: warning: unexpected parent of complex
  699.             expression subtree
  700.           warning: unexpected parent of complex expression subtree
  701.           zgemm.f, line 327: warning: unexpected parent of complex
  702.             expression subtree
  703.           pcc_binval: missing IR_CONV in complex op
  704.           make[2]: *** [zgemm.o] Error 1
  705.      when compiling the Fortran subroutines in the `libcruft'
  706.      subdirectory, you should either upgrade your compiler or try
  707.      compiling with optimization turned off.
  708.    * On NeXT systems, if you get errors like this:
  709.           /usr/tmp/cc007458.s:unknown:Undefined local symbol LBB7656
  710.           /usr/tmp/cc007458.s:unknown:Undefined local symbol LBE7656
  711.      when compiling `Array.cc' and `Matrix.cc', try recompiling these
  712.      files without `-g'.
  713.    * Some people have reported that calls to shell_cmd and the pager do
  714.      not work on SunOS systems.  This is apparently due to having
  715.      `G_HAVE_SYS_WAIT' defined to be 0 instead of 1 when compiling
  716.      `libg++'.
  717.    * On NeXT systems, linking to `libsys_s.a' may fail to resolve the
  718.      following functions
  719.           _tcgetattr
  720.           _tcsetattr
  721.           _tcflow
  722.      which are part of `libposix.a'.  Unfortunately, linking Octave with
  723.      `-posix' results in the following undefined symbols.
  724.           .destructors_used
  725.           .constructors_used
  726.           _objc_msgSend
  727.           _NXGetDefaultValue
  728.           _NXRegisterDefaults
  729.           .objc_class_name_NXStringTable
  730.           .objc_class_name_NXBundle
  731.      One kluge around this problem is to extract `termios.o' from
  732.      `libposix.a', put it in Octave's `src' directory, and add it to
  733.      the list of files to link together in the makefile.  Suggestions
  734.      for better ways to solve this problem are welcome!
  735.    * If Octave crashes immediately with a floating point exception, it
  736.      is likely that it is failing to initialize the IEEE floating point
  737.      values for infinity and NaN.
  738.      If your system actually does support IEEE arithmetic, you should
  739.      be able to fix this problem by modifying the function
  740.      `octave_ieee_init' in the file `lo-ieee.cc' to correctly
  741.      initialize Octave's internal infinity and NaN variables.
  742.      If your system does not support IEEE arithmetic but Octave's
  743.      configure script incorrectly determined that it does, you can work
  744.      around the problem by editing the file `config.h' to not define
  745.      `HAVE_ISINF', `HAVE_FINITE', and `HAVE_ISNAN'.
  746.      In any case, please report this as a bug since it might be
  747.      possible to modify Octave's configuration script to automatically
  748.      determine the proper thing to do.
  749.    * After installing the binary distribution of Octave in an alternate
  750.      directory, the Emacs command `run-octave' doesn't work.  Emacs
  751.      hangs in `accept-process-output' in `inferior-octave-startup'.
  752.      This seems to be a problem with executing a shell script using the
  753.      comint package.  You can avoid the problem by changing the way
  754.      Octave is installed to eliminate the need for the shell script.
  755.      You can either compile and install Octave using the source
  756.      distribution, reinstall the binary distribution in the default
  757.      directory, or copy the commands in the octave shell script wrapper
  758.      to your shell startup files (and the shell startup files for
  759.      anyone else who is using Octave) and then rename the file
  760.      `octave.bin' to be `octave'.
  761. File: octave,  Node: Binary Distributions,  Prev: Installation Problems,  Up: Installation
  762. Binary Distributions
  763. ====================
  764.    Although Octave is not very difficult to build from its sources, it
  765. is a relatively large program that does require a significant amount of
  766. time and disk space to compile and install.  Because of this, many
  767. people want to be able to obtain binary distributions so they can start
  768. using Octave immediately, without having to bother with the details of
  769. compiling it first.  This is understandable, so I try to maintain a
  770. current collection of binary distributions at
  771. (ftp://ftp.che.wisc.edu/pub/octave/BINARIES).
  772.    Please understand, however, that there is only a limited amount of
  773. time available to devote to making binaries, so binaries may not be
  774. immediately available for some platforms.  (Please contact
  775. (bug-octave@bevo.che.wisc.edu) if you are interested in helping make a
  776. binary distribution available for your system.)
  777.    Also, binary distributions are limited to static binaries that do not
  778. support dynamic linking.  For earlier versions of Octave, I tried
  779. distributing dynamically linked binaries but that proved to be too much
  780. trouble to support.  If you want to have a copy of Octave that includes
  781. all the features described in this manual, you will have to build it
  782. from the sources yourself, or find someone else who is willing to do it
  783. for you.
  784. * Menu:
  785. * Installing Octave from a Binary Distribution::
  786. * Creating a Binary Distribution::
  787. File: octave,  Node: Installing Octave from a Binary Distribution,  Next: Creating a Binary Distribution,  Prev: Binary Distributions,  Up: Binary Distributions
  788. Installing Octave from a Binary Distribution
  789. --------------------------------------------
  790.    To install Octave from a binary distribution, execute the command
  791.      sh ./install-octave
  792. in the top level directory of the distribution.
  793.    Binary distributions are normally compiled assuming that Octave will
  794. be installed in the following subdirectories of `/usr/local'.
  795. `bin'
  796.      Octave and other binaries that people will want to run directly.
  797. `lib'
  798.      Shared libraries that Octave needs in order to run.  These files
  799.      are not included if you are installing a statically linked version
  800.      of Octave.
  801. `man/man1'
  802.      Unix-style man pages describing Octave.
  803. `info'
  804.      Info files describing Octave.
  805. `share/octave/VERSION/m'
  806.      Function files distributed with Octave.  This includes the Octave
  807.      version, so that multiple versions of Octave may be installed at
  808.      the same time.
  809. `libexec/octave/VERSION/exec/ARCH'
  810.      Executables to be run by Octave rather than the user.
  811. `libexec/octave/VERSION/oct/ARCH'
  812.      Object files that will be dynamically loaded.
  813. `share/octave/VERSION/imagelib'
  814.      Image files that are distributed with Octave.
  815. where VERSION stands for the current version number of the interpreter,
  816. and ARCH is the type of computer on which Octave is installed (for
  817. example, `i486-pc-os/2').
  818.    If these directories don't exist, the script `install-octave' will
  819. create them for you.  The installation script also creates the following
  820. subdirectories of `/usr/local' that are intended for locally installed
  821. functions:
  822. `share/octave/site/m'
  823.      Locally installed M-files.
  824. `libexec/octave/site/exec/ARCH'
  825.      Locally installed binaries intended to be run by Octave rather
  826.      than by the user.
  827. `libexec/octave/site/octave/ARCH'
  828.      Local object files that will be dynamically linked.
  829.    If it is not possible for you to install Octave in `/usr/local', or
  830. if you would prefer to install it in a different directory, you can
  831. specify the name of the top level directory as an argument to the
  832. `install-octave' script.  For example:
  833.      sh ./install-octave /some/other/directory
  834. will install Octave in subdirectories of the directory
  835. `/some/other/directory'.
  836. File: octave,  Node: Creating a Binary Distribution,  Prev: Installing Octave from a Binary Distribution,  Up: Binary Distributions
  837. Creating a Binary Distribution
  838. ------------------------------
  839.    Here is how to build a binary distribution for others to use.  If you
  840. want to make a binary distribution for your system available along with
  841. the Octave sources and binaries on (ftp.che.wisc.edu), please follow
  842. this procedure.  For directions explaining how to make the binary
  843. available on the ftp site, please contact
  844. (bug-octave@bevo.che.wisc.edu).
  845.    * Unpack the source distribution:
  846.           gunzip -c octave-2.1.23.tar.gz | tar xf -
  847.    * Change your current directory to the top-level directory of the
  848.      source distribution:
  849.           cd octave-2.1.23
  850.    * Make the binary distribution:
  851.           make binary-dist
  852.      This will create a compressed tar file ready for distribution.  It
  853.      will contain statically linked binaries and have a name like
  854.      `octave-2.1.23-i486-pc-os/2.tar.gz'
  855.    % DO NOT EDIT!  Generated automatically by munge-texi.
  856. File: octave,  Node: Emacs,  Next: Grammar,  Prev: Installation,  Up: Top
  857. Emacs Octave Support
  858. ********************
  859.    The development of Octave code can greatly be facilitated using Emacs
  860. with Octave mode, a major mode for editing Octave files which can e.g.
  861. automatically indent the code, do some of the typing (with Abbrev mode)
  862. and show keywords, comments, strings, etc. in different faces (with
  863. Font-lock mode on devices that support it).
  864.    It is also possible to run Octave from within Emacs, either by
  865. directly entering commands at the prompt in a buffer in Inferior Octave
  866. mode, or by interacting with Octave from within a file with Octave
  867. code.  This is useful in particular for debugging Octave code.
  868.    Finally, you can convince Octave to use the Emacs info reader for
  869. `help -i'.
  870.    All functionality is provided by the Emacs Lisp package EOS (for
  871. "Emacs Octave Support").  This chapter describes how to set up and use
  872. this package.
  873.    Please contact <Kurt.Hornik@ci.tuwien.ac.at> if you have any
  874. questions or suggestions on using EOS.
  875. * Menu:
  876. * Installing EOS::
  877. * Using Octave Mode::
  878. * Running Octave From Within Emacs::
  879. * Using the Emacs Info Reader for Octave::
  880. File: octave,  Node: Installing EOS,  Next: Using Octave Mode,  Prev: Emacs,  Up: Emacs
  881. Installing EOS
  882. ==============
  883.    The Emacs package EOS consists of the three files `octave-mod.el',
  884. `octave-inf.el', and `octave-hlp.el'.  These files, or better yet their
  885. byte-compiled versions, should be somewhere in your Emacs load-path.
  886.    If you have GNU Emacs with a version number at least as high as
  887. 19.35, you are all set up, because EOS is respectively will be part of
  888. GNU Emacs as of version 19.35.
  889.    Otherwise, copy the three files from the `emacs' subdirectory of the
  890. Octave distribution to a place where Emacs can find them (this depends
  891. on how your Emacs was installed).  Byte-compile them for speed if you
  892. want.
  893.