Differences between revisions 3 and 10 (spanning 7 versions)
Revision 3 as of 2008-05-26 10:27:08
Size: 3077
Comment:
Revision 10 as of 2008-06-09 09:49:04
Size: 5408
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
Octave is a free clone of Matlab, running under both Linux and Windows. Octave is a free clone of Matlab, running under Linux, Windows and MacOS.
Line 11: Line 11:
Ressources: It normally runs in a command window, and displays graphics in separate windows (using Gnuplot).

Some ressources:
Line 16: Line 18:
 * On the compatibility between Octave and Matlab:
   * List of [http://www.gnu.org/software/octave/FAQ.html#MATLAB-compatibility differences between Octave and Matlab]
   * List of [http://wiki.octave.org/wiki.pl?MissingMatlabFunctions missing Matlab functions] in Octave
   * More on [http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility Matlab/Octave compatibility]

Note that a graphical frontend for Octave is available (see [http://www.unige.ch/math/folks/loisel/www.math.mcgill.ca/loisel/octave-workshop/ Octave workshop]), but it is not at all necessary for running Dynare.
Line 35: Line 43:
=== Dynare === [http://wiki.octave.org/wiki.pl?CategoryInstall More installation instructions] can be found on Octave Wiki.
Line 37: Line 45:
If you don't already have a subversion copy of the whole Dynare tree, you should type (under Linux or under Cygwin prompt, assuming you have installed the {{{subversion}}} package): === Dynare for Octave ===

If you don't already have a subversion copy of the whole Dynare tree, you should type (under Linux or Cygwin prompt, assuming you have installed the {{{subversion}}} package):
Line 42: Line 52:
Don't forget to update regularly your working copy, using {{{svn update}}}.
Line 53: Line 64:
Then, from Octave, add the path to {{{dynare_v4_octave}}} using the {{{addpath}}} command, as you would under Matlab. It is possible to autoexecute this command at each Octave start by adding it to the {{{.octaverc}}} startup file (under Linux, this file should be put in the home directory; under Windows, it should be put at the root of the user home under {{{Documents and Settings}}}). Then, from Octave, add the path to {{{dynare_v4_octave}}} using the {{{addpath}}} command, as you would under Matlab:
{{{
addpath REPLACE_WITH_RIGHT_PATH/dynare_v4_octave/matlab
}}}
It is possible to autoexecute this command at each Octave start by adding it to the {{{.octaverc}}} startup file (under Linux, this file should be put in the home directory; under Windows, it should be put at the root of the user home under {{{Documents and Settings}}}).
Line 55: Line 70:
At first glance, Octave doesn't accept short syntax when typing {{{dynare}}} command (need to investigate that issue). In other words, to run Dynare on {{{ramst.mod}}}, you need to type: Unless you tell it to do otherwise, Octave won't accept the short syntax when typing {{{dynare}}} command. In other words, to run Dynare on {{{ramst.mod}}}, you need to type:
Line 64: Line 79:
== List of issues between Matlab and Octave == However, you can force Octave to accept the short syntax by typing the following (or by adding it to your {{{.octaverc}}}):
{{{
mark_as_command dynare
}}}


== Main changes between Matlab and Octave versions of Dynare ==
Line 67: Line 88:
 * Ajustments were obviously necessary where {{{version()}}} function is called
 * Generalized eigenvalues are not implemented as a primitive (i.e. {{{eig(A,B)}}} doesn't exist in Octave). This implied a change in {{{dr1.m}}}
 * Adjustments were obviously necessary where {{{version()}}} function is called
 * '''Generalized eigenvalues:''' {{{eig(A,B)}}} doesn't exist in Octave. But a call to {{{lambda = qz(A,B)}}} does the same job. Implied a change in {{{dr1.m}}}
 * '''QZ decomposition''': {{{[AA,BB,Q,Z] = qz(A,B)}}} works under Octave, but the convention for {{{Q}}} is different. We have {{{AA = Q*A*Z}}} under Matlab and {{{AA = Q'*A*Z}}} under Octave. Implied changes in {{{gensylv/sylvester3.m}}} and {{{qz/mjdgges.m}}}
 * '''Reciprocal condition number''': {{{rcond(A)}}} doesn't exist under Octave. For the moment, the workaround is to create a {{{rcond.m}}} M-file which does {{{1/cond(A,1)}}}. The {{{rcond()}}} function should be available in the next major release of Octave, see [http://www.cae.wisc.edu/pipermail/octave-maintainers/2008-May/007332.html this post] and its reply.
 * Saving graphics under Octave works differently ({{{saveas()}}} doesn't exist)
 * Creation of PDF files is not supported (through {{{print -dpdf}}}). This comes from the fact that PDF support in GNUPlot is non-free, and therefore not available under Debian or Windows package. See [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=248426 Debian bug #248426]
Line 73: Line 98:
 * Simple stochastic simulation should work
 * Graphics display is correct but not very nice when many plots on the same figure
 * Graphics saving on filesystem is disabled for the moment

Dynare for Octave

Porting of Dynare to Octave is under progress. Development is done using Octave version 3.0.

About Octave

Octave is a free clone of Matlab, running under Linux, Windows and MacOS.

It normally runs in a command window, and displays graphics in separate windows (using Gnuplot).

Some ressources:

Note that a graphical frontend for Octave is available (see [http://www.unige.ch/math/folks/loisel/www.math.mcgill.ca/loisel/octave-workshop/ Octave workshop]), but it is not at all necessary for running Dynare.

Development of Dynare for Octave

A specific subversion branch has been created under branches/dynare_v4_octave. Note that this branch is supposed to work on both Matlab and Octave (using tests to differentiate between the two when necessary). Please report any failure to run under Matlab.

It is possible to view the differences between Matlab and Octave versions of Dynare by issuing:

svn diff http://www.cepremap.cnrs.fr/svn/dynare_v4 http://www.cepremap.cnrs.fr/svn/branches/dynare_v4_octave

Note: be aware that recent changes to Matlab version of Dynare may not have been yet merged into the Octave branch, and may thus appear as spurious differences.

Installing Dynare for Octave

Octave

Under Debian "Lenny", install package octave3.0

For Windows, the Cygwin package is quite outdated. You should rather download [http://sourceforge.net/project/showfiles.php?group_id=2888&package_id=40078 precompiled binaries from Octave Forge].

[http://wiki.octave.org/wiki.pl?CategoryInstall More installation instructions] can be found on Octave Wiki.

Dynare for Octave

If you don't already have a subversion copy of the whole Dynare tree, you should type (under Linux or Cygwin prompt, assuming you have installed the subversion package):

svn checkout http://www.cepremap.cnrs.fr/svn/branches/dynare_v4_octave

Don't forget to update regularly your working copy, using svn update.

Running Dynare for Octave

First, you should run Octave.

Under Linux, at the prompt, just type:

octave

Under Windows, you should have a shortcut already installed in your Start menu.

Then, from Octave, add the path to dynare_v4_octave using the addpath command, as you would under Matlab:

addpath REPLACE_WITH_RIGHT_PATH/dynare_v4_octave/matlab

It is possible to autoexecute this command at each Octave start by adding it to the .octaverc startup file (under Linux, this file should be put in the home directory; under Windows, it should be put at the root of the user home under Documents and Settings).

Unless you tell it to do otherwise, Octave won't accept the short syntax when typing dynare command. In other words, to run Dynare on ramst.mod, you need to type:

dynare('ramst')

rather than:

dynare ramst

However, you can force Octave to accept the short syntax by typing the following (or by adding it to your .octaverc):

mark_as_command dynare

Main changes between Matlab and Octave versions of Dynare

  • Warning handling is different between Matlab and Octave, and necessitated some adjustments.
  • Adjustments were obviously necessary where version() function is called

  • Generalized eigenvalues: eig(A,B) doesn't exist in Octave. But a call to lambda = qz(A,B) does the same job. Implied a change in dr1.m

  • QZ decomposition: [AA,BB,Q,Z] = qz(A,B) works under Octave, but the convention for Q is different. We have AA = Q*A*Z under Matlab and AA = Q'*A*Z under Octave. Implied changes in gensylv/sylvester3.m and qz/mjdgges.m

  • Reciprocal condition number: rcond(A) doesn't exist under Octave. For the moment, the workaround is to create a rcond.m M-file which does 1/cond(A,1). The rcond() function should be available in the next major release of Octave, see [http://www.cae.wisc.edu/pipermail/octave-maintainers/2008-May/007332.html this post] and its reply.

  • Saving graphics under Octave works differently (saveas() doesn't exist)

  • Creation of PDF files is not supported (through print -dpdf). This comes from the fact that PDF support in GNUPlot is non-free, and therefore not available under Debian or Windows package. See [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=248426 Debian bug #248426]

Current status of development

  • Simple deterministic models should work
  • Simple stochastic simulation should work
  • Graphics display is correct but not very nice when many plots on the same figure
  • Graphics saving on filesystem is disabled for the moment

DynareWiki: OctaveCompatibility (last edited 2012-10-08 11:47:00 by SébastienVillemot)