Differences between revisions 1 and 74 (spanning 73 versions)
Revision 1 as of 2008-05-23 16:39:00
Size: 1667
Comment:
Revision 74 as of 2012-10-08 11:47:00
Size: 3444
Comment: Remove obsolete stuff
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Dynare for Octave = ## page was renamed from DynareOctave
#language en
Line 3: Line 4:
Porting of Dynare to [http://www.octave.org Octave] is under progress. Development is done using Octave version 3.0 (now available in Debian Testing aka "Lenny"). Main differences between MATLAB and Octave which are dealt with by Dynare:
Line 5: Line 6:
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 and running Dynare for Octave ==

Under Debian "Lenny", install package {{{octave3.0}}}.

At the prompt, type:
{{{
octave
}}}

Then add 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}}} init file.

== List of issues between Matlab and Octave ==

 * Warning handling is different between Matlab and Octave, and necessitated some adjustments.
 * 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}}}

== Current status of development ==

 * Simple deterministic models should work
 * '''Generalized eigenvalues:''' {{{eig(A,B)}}} doesn't exist in Octave. A call to {{{lambda = qz(A,B)}}} does the same job, except that it doesn't return infinite eigenvalues, so we can't use it. 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 a change in {{{gensylv/sylvester3.m}}}
   * Octave is only able to compute real QZ, while MATLAB can do both complex and real, and does complex by default. As a consequence, {{{qz/mjdgges.m}}} is implemented differently for Octave and MATLAB: under MATLAB we compute the complex decomposition, and use Sims' code for reordering the eigenvalues; under Octave, we use the native reordered QZ, but as a consequence the criterium is de facto always 1.0
 * '''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/(norm(A,1)*norm(inv(A), 1))}}}. The {{{rcond()}}} function is now available in Octave 3.2.
 * '''Saving data on the filesystem''':
   * Octave can read and write Matlab's MAT format. A call to {{{default_save_options('-mat')}}} was added in {{{dynare.m}}} to make Dynare for Octave create MAT files
   * But {{{save()}}} and {{{load()}}} under Octave don't assume the {{{.mat}}} extension. Need to explicitly add them
 * '''Saving graphics on the filesystem''':
   * Saving graphics with {{{saveas()}}} don't work, since it uses a Matlab specific format
   * 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/Ubuntu or Windows package. See [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=248426|Debian bug #248426]]
   * Creation of EPS files works (though file extension is not automatically added by Octave, contrary to Matlab)
 * '''Warning handling''' is different between Matlab and Octave, and necessitated some adjustments
 * Adjustments were obviously necessary where {{{version()}}} function is called
 * The operator {{{&}}} under MATLAB is buggy: it doesn't execute its second argument if the first is false, when used in an {{{if}}} statement. This behaviour should be restricted to {{{&&}}}. This also applies to {{{|}}} and {{{||}}}. Implied a change in {{{mh_optimal_bandwith.m}}}, since this file expects the buggy behaviour
 * {{{waitbar()}}} exists under Octave, but is text-only and is not very flexible. Replaced by calls to {{{printf()}}} in {{{random_walk_metropolis_hastings.m}}}
 * {{{mkdir()}}} works slightly differently under Octave: it won't simultaneously create several depths of subdirectories. Implied a change in {{{CheckPath.m}}}
 * {{{setdiff()}}} doesn't return a second argument under Octave. Implied a workaround in {{{dynare_estimation.m}}} and {{{dynare_estimation_init.m}}}
 * {{{ordeig()}}} doesn't exist under Octave (nor on MATLAB < 7.0.1). Use {{{my_ordeig()}}} instead.
 * '''Case sensitivity''' : under GNU/Linux, calls to Octave functions and variables are case sensitive. So non preprocessed instructions at the end of modfiles should be written with lowercase.

Main differences between MATLAB and Octave which are dealt with by Dynare:

  • Generalized eigenvalues: eig(A,B) doesn't exist in Octave. A call to lambda = qz(A,B) does the same job, except that it doesn't return infinite eigenvalues, so we can't use it. 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 a change in gensylv/sylvester3.m

    • Octave is only able to compute real QZ, while MATLAB can do both complex and real, and does complex by default. As a consequence, qz/mjdgges.m is implemented differently for Octave and MATLAB: under MATLAB we compute the complex decomposition, and use Sims' code for reordering the eigenvalues; under Octave, we use the native reordered QZ, but as a consequence the criterium is de facto always 1.0

  • 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/(norm(A,1)*norm(inv(A), 1)). The rcond() function is now available in Octave 3.2.

  • Saving data on the filesystem:

    • Octave can read and write Matlab's MAT format. A call to default_save_options('-mat') was added in dynare.m to make Dynare for Octave create MAT files

    • But save() and load() under Octave don't assume the .mat extension. Need to explicitly add them

  • Saving graphics on the filesystem:

    • Saving graphics with saveas() don't work, since it uses a Matlab specific format

    • 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/Ubuntu or Windows package. See Debian bug #248426

    • Creation of EPS files works (though file extension is not automatically added by Octave, contrary to Matlab)
  • Warning handling is different between Matlab and Octave, and necessitated some adjustments

  • Adjustments were obviously necessary where version() function is called

  • The operator & under MATLAB is buggy: it doesn't execute its second argument if the first is false, when used in an if statement. This behaviour should be restricted to &&. This also applies to | and ||. Implied a change in mh_optimal_bandwith.m, since this file expects the buggy behaviour

  • waitbar() exists under Octave, but is text-only and is not very flexible. Replaced by calls to printf() in random_walk_metropolis_hastings.m

  • mkdir() works slightly differently under Octave: it won't simultaneously create several depths of subdirectories. Implied a change in CheckPath.m

  • setdiff() doesn't return a second argument under Octave. Implied a workaround in dynare_estimation.m and dynare_estimation_init.m

  • ordeig() doesn't exist under Octave (nor on MATLAB < 7.0.1). Use my_ordeig() instead.

  • Case sensitivity : under GNU/Linux, calls to Octave functions and variables are case sensitive. So non preprocessed instructions at the end of modfiles should be written with lowercase.

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