[R-sig-finance] Constrained Log-Likelihood with SQP Solver

Andrew Piskorski atp at piskorski.com
Fri Dec 16 14:38:02 CET 2005

On Fri, Dec 16, 2005 at 08:45:34AM +0000, Max wrote:

> I would be interested to hear why you suspect that they would
> implement this algorithm in Fortran or C, btw - wouldn't it be
> easier to implement/ integrate with the various languages at a
> higher level?

For the same reason that AFAIK nearly all real-world numerical
libraries are written in either C or Fortran - for speed.  (I suppose
there are probably some such kicking around in compiled Lisp or other
atypical languages, but they seem few and far between.)

C is also often chosen for libraries simply because any other language
you'd care about integrates easily with C (by necessity), but
integration with other languages doesn't even enter into it here.  The
original poster seemed to be talking about 2 or even 3 orders of
magnitude difference in performance, and being quite unhappy with the
slow runtimes he's seeing now.  That's more than enough speedup to
justify the added hassle and pain of writing C code.

Of course, I don't know whether R functions he was using were well
implemented or not; I was asssuming they are.  But a good C version is
likely to be much faster than R anyway.

C (and to a lesser extent Fortran, for numerial stuff) are an
omnipresent fact of programming life, especially for lower level
libraries.  You don't have to like it, but that's the way it is.

I know next to nothing about Ox.  If it is in fact as high level and
nice to use as R, but much faster, then that's interesting.  Of course
Ox (like K, another reputedly high performance vector-oriented
language), is closed source, which makes me less interested in
investigating it.  I do kind of wonder how fast A+ is, though.


Andrew Piskorski <atp at piskorski.com>

More information about the R-sig-finance mailing list