Code covered by the BSD License  

Highlights from

4.8 | 4 ratings Rate this file 13 Downloads (last 30 days) File Size: 16.8 KB File ID: #14848 Version: 1.0




02 May 2007 (Updated )

MTRON is a Matlab wrapper for the Fortran software TRON (a large scale trust region Newton method).

| Watch this File

File Information

MTRON : A Matlab interface to the TRON package of C.-J. Lin and J. MoreƩ.

    Chih-Jen Lin and Jorge MoreĆ©, Newton's method for large
    bound-constrained optimization problems, SIAM Journal on Optimization,
    Volume 9, Number 4, pp. 1100-1127, 1999
   (as of 28 November 2006)

MTRON was written by Christoph Ortner

   TRON is a trust region method for the solution of large scale
   bound-constraint optimization problems, i.e. problems of the form
            min f(x) subject to a_j \leq x_j \leq b_j

   where f : R^n --> R^n should be twice differentiable.

   TRON works by reverse communication, i.e., the user must write the
   optimization loop and calls dtron.f at each iteration. mtron.c
   simply translates dtron.f into Matlab. Its calling convention
   is described in mtron.m. test_mtron.m is an example for using
   MTRON in this way.

   Alternatively, the interface routine itron.m may be used which is
   modeled after the optimization toolbox routine fmincon (though
   itron only supports bound-constraints)

  readme.txt : this file
  mtron.c : gateway routine
  mtron.m : helptext for using mtron.c
  itron.m : driver routine, which encapsulates the reverse communication
            principle of TRON and mtron.
  make_mtron.m : script for compiling mtron.c
  test_mtron.m : implemenation of a simple test problem (uses only mtron.c
                 and not the driver routine itron)
  test_itron.m : test problem for itron
  plap.m : definition of the test problem used in test_mtron and test_itron


This file inspired Lbfgsb (L Bfgs B) Mex Wrapper and Zero Sr1.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Tested on Linux and OS-X but should work on any system on which a Fortran77 compiler is available (and on which TRON can be compiled).
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
22 Aug 2012 Paul

Paul (view profile)

I used Stephen's command verbatim to compile on 64 bit OS X (Snow Leopard). mex complained about "assignment from incompatible pointer type" in the copy_H function of mtron.c. So in addition to Son Le's modifications to mtron.c, I also had to change

in mtron.c, line 108: mwIndex *irt, *jct;

Now it seems to work great. (Bizarrely, the code occasionally worked before the line 108 modification, but was very slow.)

15 Feb 2012 Stephen Becker

Stephen Becker (view profile)

edit: my sentence about BLAS was confusing. What I mean to say is that the TRON fortran package includes a BLAS implementation. You need BLAS, but do not use their implementation. Use your computer's BLAS library, which is (hopefully) optimized.

Comment only
15 Feb 2012 Stephen Becker

Stephen Becker (view profile)

I just got this to work on 64-bit linux too (before looking at the above comments). My fix is basically the same as the above. First, you edit the .c file to change ir and jc to mwSize. For compilation, you can do as Son Le described, or just skip the Makefile step altogether and do everything with mex (since mex will use -fPIC automatically). And you should not use the BLAS with the fortran file, since that defeats the purpose of using BLAS. If you have libblas, use it; if not, use libmwblas, which comes with Matlab. So my mex compilation was:

mex mtron.c ...
tron/src/tron/dbreakpt.f tron/src/tron/dgpstep.f tron/src/tron/dsetsp.f tron/src/tron/dtron.f ...
tron/src/tron/dcauchy.f tron/src/tron/dmid.f tron/src/tron/dspcg.f tron/src/tron/dtrpcg.f ...
tron/src/tron/dgpnrm2.f tron/src/tron/dprsrch.f tron/src/tron/dsphesd.f tron/src/tron/dtrqsol.f ...
tron/src/icf/dicf.f tron/src/icf/dsel2.f tron/src/icf/ihsort.f ...
tron/src/icf/dicfs.f tron/src/icf/dssyax.f tron/src/icf/insort.f ...
tron/src/icf/dpcg.f tron/src/icf/dstrsol.f tron/src/icf/srtdat2.f ...
tron/src/coloring/degr.f tron/src/coloring/idog.f tron/src/coloring/seq.f tron/src/coloring/slog.f ...
tron/src/coloring/dssm.f tron/src/coloring/numsrt.f tron/src/coloring/setr.f tron/src/coloring/srtdat.f ...
tron/src/coloring/ido.f tron/src/coloring/sdpt.f tron/src/coloring/slo.f ...
-lblas -lgfortran -largeArrayDims

By the way, this code was tested in the paper
They suggest that it's no longer one of the best NNLS codes.

29 Nov 2011 Son Le

Son Le (view profile)

Couple comments to make it works on x86_64:

- add -fPIC to the CFLAGS/FFLAGS of all Makefile when compiling tron.
- compile using gfortran if you have more recent GCC
- change -lg2c to "-lgfortran -largeArrayDims"
- in mtron.c:154 int dims[] => mwSize dims[]
- mtron.c:306/307 =>
mwIndex *t = mxGetJc(prhs[7]);
nnz = (t[n] + 100) * 2;

11 Jan 2011 Nicholas

In regards to memory issues and 64-bit compatibility:

The only changes that need to be made are to replace the int type declarations corresponding to ir and jc in the main routine with mwSize type declarations. Also, in the create_nfo function the int type for the dims array must be replced by an mwSize type.

Comment only
11 Jan 2011 Nicholas

Hi there,

I'm having memory issues when compiling this on a 64 bit linux machine. I was wondering what hacks needed to be done to make this code work.

Comment only
12 Sep 2008 Tron Reviewer

pretty good, and easy to use. Needed some hacking for 64bit.

Contact us