GNU Octave Wiki: Difference between revisions

From Octave
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
[http://www.octave.org GNU Octave] is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. GNU Octave is normally used through its interactive interface (CLI and GUI), but it can also be used to write non-interactive programs. The GNU Octave language is quite similar to MATLAB® so that most programs are easily portable.
The recommended way for installing Octave and Octave-Forge packages on GNU/Linux systems
is via each distribution package installation system.


This wiki is intended to supplement the [http://www.gnu.org/software/octave/doc/interpreter GNU Octave documentation]. Before adding content, please check that it is not already part of, or belongs in, the documentation.
More detailed instructions follow.


== GNU Octave FAQ ==
=Debian and Debian-based (such as Ubuntu)=


The [[FAQ]] is a list of frequently asked questions (FAQ) for GNU Octave users and a good place to start.
Either use {{Codeline|aptitude}} or {{Codeline|apt-get}}:


Answers to questions regarding [[FAQ#General|what is Octave]], [[FAQ#Licensing_issues|licensing]], [[FAQ#What.27s_new_in_Octave|new features]], [[FAQ#What_documentation_exists_for_Octave.3F|documentation]], [[FAQ#Installation_issues_and_problems|installation]], [[FAQ#Coding|coding]], [[FAQ#How_can_I_get_involved_in_Octave_development.3F|contributing to Octave]], and more, are found there.
    # aptitude install octave<version> octave<version>-doc


== Table of contents ==
where {{Codeline|<version>}} must be substituted by the appropriate string.


Below is a temporary attempt to organize the "most wanted" pages of the Wiki. A list of all pages on the wiki can be seen [[Special:AllPages|here]]. To locate something specific, try the wiki's search box, or prepend {{Codeline|<nowiki>site:http://www.octave.org/wiki/</nowiki>}} to a [https://www.google.com/search?&q=site%3Ahttp%3A%2F%2Fwww.octave.org%2Fwiki google search].
The Octave-Forge packages are spread over many Debian packages. All Octave-Forge packages will probably be found with the command:  


=== Installation Instructions for Windows, MacOS X and GNU/Linux ===
    $ aptitude search ?description\(octave-forge\)
* [[Octave for Windows]]
* [[Installing Win32 Distribution]]
* [[Octave for MacOS X]]
* [[Octave for GNU/Linux]]


=== Building Octave ===
For more details, see the [[Debian]] specific instructions page.
* [[Build from source]]
* [[Mercurial (hg) cheat sheet]]
* [[Tests|Testing Source Code]]
* [[Octave for Mac|Octave for MacOS (minimalistic)]]
* [[Create a MacOS X App Bundle Using MacPorts]]
* [[Enable large arrays: Build octave such that it can use arrays larger than 2Gb.|Building Octave to Use Large Arrays]]


=== Octave-Forge ===
=== Troubleshooting ===
* [[Octave_Forge|Octave-Forge and Installing Packages]]
* [[Creating_packages|Creating Packages]]


==== Available Packages ====
At Ubuntu, broken packages install may cause a <span color="red">error: `pkg' undefined</span> error, previously reported as [https://bugs.launchpad.net/ubuntu/+source/octave3.2/+bug/465005 bug 465005]:
* [[Dicom_package|Dicom]]
* [[Geometry_package|Geometry]]
* [[IO_package|I/O]]
* [[Java_package|Java]]
* [[Mechanics_package|Mechanics]]
* [[Instrument_control__package|Instrument control]]
* [[Sockets_package|Sockets]]
* [[Video_package|Video]]
* [[bim_package|bim]] Solve Partial Differential Equaltions with a Finite Element method
* [http://modb.oce.ulg.ac.be/mediawiki/index.php/CGI_programming_with_Octave CGI] Common Gateway Interface for Octave
* [http://modb.oce.ulg.ac.be/mediawiki/index.php/Optimal_interpolation_Fortran_module_with_Octave_interface optiminterp] Optimal interpolation
* [http://modb.oce.ulg.ac.be/mediawiki/index.php/NetCDF_toolbox_for_Octave octcdf] NetCDF package (old)
* [http://modb.oce.ulg.ac.be/mediawiki/index.php/Octave-netcdf netcdf] matlab-compatible NetCDF package
* [http://modb.oce.ulg.ac.be/mediawiki/index.php/NcArray ncArray] High-level interface of accessing a single or a collection of NetCDF files as a multi-dimensional array


=== Editors & Octave ===
...
* [[Gedit]]
Setting up octave3.2 (3.2.2-2build1) ...
* [[Emacs]]
error: `pkg' undefined near line 0 column 1
* [[Nano]]
* [[Vim]]
dpkg: error processing octave3.2 (--configure):
* [[Kate]]
  subprocess installed post-installation script returned error exit status 1
* [http://octclipse.sourceforge.net Octclipse] (Windows and GNU/Linux onlyThe Octclipse developers are seeking individuals to assist with MacOS X support.)
Processing triggers for libc-bin ...
* [https://sites.google.com/site/domainmathide/ DomainMath IDE] (Windows,GNU/Linux and Mac OS.)
  ldconfig deferred processing now taking place
Processing triggers for menu ...
Errors were encountered while processing:
  octave3.2
E: Sub-process /usr/bin/dpkg returned an error code (1)


=== Plotting tutorial ===
Fix this by complete reinstall:
All or most of the information about plotting in Octave can be found in the manual and on the internet. This information can be too scattered over different resources for a new user to find his/her way into solving a plotting problem/need. This tutorial should be considered as the 'recipe text' by examples if you consider the manual as a 'recipe ingredients only'.
* [[Recap of the hierarchy of each plot element]]
* [[The order of the commands matter sometimes]]
* [[Changing text elements (label, title)]]
* [[More control over subplots]]
* [[Enable "linestyle" functionality for Gnuplot's x11 terminal]]


=== Miscellaneous ===
sudo apt-get --purge remove octave3.2
* [[Octave Basics]] - For those just getting started.
sudo apt-get --purge remove octave3.2-common
* [[Cookbook]] - Several simple and useful examples.
sudo apt-get install octave3.2
* [[Tips and tricks]] - Guidelines to improve your coding skills.
=Ubuntu 12.04=
* [[Fortran]] - Accessing liboctave from a Fortran 2003 program.
The package can be obtained from the Software Center but the Octave package is old (3.2). The most current stable version is available through a Personal Package Archive (PPA).  You will need to add the PPA to you system. Execute the following in a terminal:
* [[Octave load]] - Use liboctave functions to load variables from a file in Octave's binary format.  
* [[Special:AllPages|All Pages]] - A list of all special pages (like recent changes to the wiki)
* [[Publications using Octave]] - A compilation of scientific publications making reference to GNU Octave (add yours!).
* [[Octave fun]] - Coding can be fun -- miscellaneous more or less funny scripts
* [[BASH and Octave]] - tips for easing use of Octave together with GNU BASH (linux)


== External Links ==
    sudo apt-add-repository ppa:octave/stable
* [http://www.gnu.org/software/octave/ Octave Homepage]
    sudo apt-get update
* [http://octave.sourceforge.net/ Octave Forge]
 
* [https://savannah.gnu.org/bugs/?group=octave GNU Octave - Bug Tracker]
If you need more information on adding a repository, visit [https://launchpad.net/~octave/+archive/stable GNU Octave Stable Releases] PPA.  You can now install from the Software Center or a terminal.
* [https://savannah.gnu.org/task/?group=octave GNU Octave - Task Tracker]
 
* [https://savannah.gnu.org/patch/?group=octave GNU Octave - Patch Tracker]
To install Octave with documentation execute the following at in a terminal:
* [https://savannah.gnu.org/hg/?group=octave GNU Octave - Mercurial Repositories]
 
* [http://planet.octave.org Planet Octave] (site summary for blogs from Octave's [http://code.google.com/soc/ GSoC] and [http://sophia.estec.esa.int/socis2013/ SoCiS] students)
    sudo apt-get install octave octave-doc octave-info octave-htmldoc
 
If you want to be able to build packages from Octave Forge, you will want liboctave-dev package:
 
    sudo apt-get install liboctave-dev
 
If you want Octave debugging symbols, use the following:
 
    sudo apt-get install octave-dbg
=Fedora=
The packages can be installed using the yum command, they are:
 
*octave
*octave-devel
*octave-forge
 
{{Codeline|octave-forge}} is recommended to all users, as it provides many extra functions. {{Codeline|octave-devel}} contains the octave headers and {{Path|mkoctfile}} script and is really only needed by users who are developing code that is to be dynamically linked to octave. {{Codeline|octave}} and {{Codeline|octave-forge}} can be installed with the command:
 
    # yum install octave-forge
 
By default, yum will most likely install blas and lapack as your matrix math libraries, but ATLAS is usually much faster. If you want to install atlas with octave, use the command
 
    # yum install octave-forge atlas
 
Note that if you are using an i386-compatible processor the base atlas package is not optimized for newer hardware. If you have newer hardware, you can get even better performance with the atlas-3dnow (AMD K6 processors), atlas-sse (Pentium III or newer), or atlas-sse2 (Pentium 4 or newer).
 
=Gentoo=
Octave is available through Gentoo's package management system, Portage:
 
    # emerge sync
    # emerge octave
    # emerge octave-forge (optional)
 
=Red Hat Enterprise=
 
Octave is available for Red Hat Enterprise Linux distributions through the [https://fedoraproject.org/wiki/EPEL EPEL] repository. This section applies to CentOS, Scientific Linux, and other Red Hat Enterprise rebuild distributions as well.
 
First, follow [https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F these instructions] to set up your system to install packages from EPEL. For example,
 
    # wget <nowiki>http://url/to/latest/epel-release-6-7.noarch.rpm</nowiki>
    # yum localinstall epel-release-6-7.noarch.rpm
 
Once the EPEL repository has been enabled, you can follow the rest of the [[#Fedora|instructions for Fedora]] to install Octave using yum.
 
Note that EPEL intentionally does not follow new releases as closely as other distributions. Consequently, the version of Octave provided by EPEL may be several months or years out of date. There are plans for the Octave maintainers to provide support and binary RPMs for enterprise GNU/Linux distributions, contact the [mailto:maintainers@octave.org maintainers mailing list] for more information.
 
=Red Hat=
 
GNU Octave is included with Red Hat. If you are still using an old version of Red Hat and want a newer version of GNU Octave, your best options are to consider updating your distribution to a recent Fedora release or compile octave from source.
 
Note that RH 7.x distributions (as well as Red Hat Enterprise Linux 2.1) have included an old version of GCC (pre 3.x). It is known that GCC 2.96 (included in RH7.3) can compile GNU Octave (as of version 2.1.57), but the resulting binary will be bad. Red Hat made available RPMs for GCC 3.1-5 through http://rhn.redhat.com (those RPMs may be available on other RPM repositories).
 
=SUSE Linux Enterprise and openSUSE=
Octave 3.6.2 is included in the science repository with SLE 11 SP2 and openSUSE 11.4, 12.1, 12.2
 
[http://download.opensuse.org/repositories/science/ OBS science]
 
For example, for openSUSE 12.2 you would do:
 
    # zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.2/ science
    # zypper refresh
    # zypper install octave octave-devel
 
for other versions change the version number in the first command accordingly.
 
2012-08-21: arpack-ng and SuiteSparse 4.0 bindings which were broken before are again functional, if you have a previous version of the rpm's installed consider to update them.
 
[[Category:GNULinux]]
 
=Arch Linux=
 
Updated Octave's version is in the extra repository. It can be installed by typing:
 
    # pacman -S octave
 
[[Category:GNULinux]]
 
----

Revision as of 10:24, 7 September 2013

The recommended way for installing Octave and Octave-Forge packages on GNU/Linux systems is via each distribution package installation system.

More detailed instructions follow.

Debian and Debian-based (such as Ubuntu)

Either use aptitude or apt-get:

   # aptitude install octave<version> octave<version>-doc

where <version> must be substituted by the appropriate string.

The Octave-Forge packages are spread over many Debian packages. All Octave-Forge packages will probably be found with the command:

   $ aptitude search ?description\(octave-forge\)

For more details, see the Debian specific instructions page.

Troubleshooting

At Ubuntu, broken packages install may cause a error: `pkg' undefined error, previously reported as bug 465005:

...
Setting up octave3.2 (3.2.2-2build1) ...
error: `pkg' undefined near line 0 column 1

dpkg: error processing octave3.2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for menu ...
Errors were encountered while processing:
 octave3.2
E: Sub-process /usr/bin/dpkg returned an error code (1)

Fix this by complete reinstall:

sudo apt-get --purge remove octave3.2
sudo apt-get --purge remove octave3.2-common
sudo apt-get install octave3.2

Ubuntu 12.04

The package can be obtained from the Software Center but the Octave package is old (3.2). The most current stable version is available through a Personal Package Archive (PPA). You will need to add the PPA to you system. Execute the following in a terminal:

   sudo apt-add-repository ppa:octave/stable
   sudo apt-get update

If you need more information on adding a repository, visit GNU Octave Stable Releases PPA. You can now install from the Software Center or a terminal.

To install Octave with documentation execute the following at in a terminal:

   sudo apt-get install octave octave-doc octave-info octave-htmldoc

If you want to be able to build packages from Octave Forge, you will want liboctave-dev package:

   sudo apt-get install liboctave-dev

If you want Octave debugging symbols, use the following:

   sudo apt-get install octave-dbg

Fedora

The packages can be installed using the yum command, they are:

  • octave
  • octave-devel
  • octave-forge

octave-forge is recommended to all users, as it provides many extra functions. octave-devel contains the octave headers and mkoctfile script and is really only needed by users who are developing code that is to be dynamically linked to octave. octave and octave-forge can be installed with the command:

   # yum install octave-forge

By default, yum will most likely install blas and lapack as your matrix math libraries, but ATLAS is usually much faster. If you want to install atlas with octave, use the command

   # yum install octave-forge atlas

Note that if you are using an i386-compatible processor the base atlas package is not optimized for newer hardware. If you have newer hardware, you can get even better performance with the atlas-3dnow (AMD K6 processors), atlas-sse (Pentium III or newer), or atlas-sse2 (Pentium 4 or newer).

Gentoo

Octave is available through Gentoo's package management system, Portage:

   # emerge sync
   # emerge octave
   # emerge octave-forge (optional)

Red Hat Enterprise

Octave is available for Red Hat Enterprise Linux distributions through the EPEL repository. This section applies to CentOS, Scientific Linux, and other Red Hat Enterprise rebuild distributions as well.

First, follow these instructions to set up your system to install packages from EPEL. For example,

   # wget http://url/to/latest/epel-release-6-7.noarch.rpm
   # yum localinstall epel-release-6-7.noarch.rpm

Once the EPEL repository has been enabled, you can follow the rest of the instructions for Fedora to install Octave using yum.

Note that EPEL intentionally does not follow new releases as closely as other distributions. Consequently, the version of Octave provided by EPEL may be several months or years out of date. There are plans for the Octave maintainers to provide support and binary RPMs for enterprise GNU/Linux distributions, contact the maintainers mailing list for more information.

Red Hat

GNU Octave is included with Red Hat. If you are still using an old version of Red Hat and want a newer version of GNU Octave, your best options are to consider updating your distribution to a recent Fedora release or compile octave from source.

Note that RH 7.x distributions (as well as Red Hat Enterprise Linux 2.1) have included an old version of GCC (pre 3.x). It is known that GCC 2.96 (included in RH7.3) can compile GNU Octave (as of version 2.1.57), but the resulting binary will be bad. Red Hat made available RPMs for GCC 3.1-5 through http://rhn.redhat.com (those RPMs may be available on other RPM repositories).

SUSE Linux Enterprise and openSUSE

Octave 3.6.2 is included in the science repository with SLE 11 SP2 and openSUSE 11.4, 12.1, 12.2

OBS science

For example, for openSUSE 12.2 you would do:

   # zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.2/ science
   # zypper refresh
   # zypper install octave octave-devel

for other versions change the version number in the first command accordingly.

2012-08-21: arpack-ng and SuiteSparse 4.0 bindings which were broken before are again functional, if you have a previous version of the rpm's installed consider to update them.

Arch Linux

Updated Octave's version is in the extra repository. It can be installed by typing:

   # pacman -S octave