0

I'm currently playing around with state space models and the book I'm using has some very useful examples.

Problem:

These examples are written in Ox, which somewhat limits its usability, particularly as I want to test out some of my models using the Interactive Brokers API, for which it's more practical to use C# / C++.

More specifically it's using examples from SsfPack which according to this article is "a library of routines for state space modelling and inference written in C and linked to Ox".

Does this mean it can be directly implemented in C or is it a better approach to write the function in Ox and then call it in C as shown in A1.4 of this document? And if it can be directly implemented, how does one go about it?

Having some experience with C and no experience with Ox, the former of these two options would be much preferable.

Any thoughts welcome!

youjustreadthis
  • 622
  • 3
  • 9
  • 24
  • Is there any reason you added the C++ tag for a C question? Are your sure you use C, not C++? They are **different** languages, pick the one you actually use! – too honest for this site Jun 28 '16 at 17:06
  • Hi @Olaf, the reason I added C++ was for the same reason that I mentioned it in the question, namely its usage in the interactive brokers API, which I hope to incorporate these models in. I do appreciate that they are different languages, but if memory serves me (might be wrong here I which case I apologise), there is a great deal of compatibility between the various variation of the C languages. – youjustreadthis Jun 28 '16 at 17:18
  • 1
    There are no "C language**s**". There is only **one** C language standardised as ISO 9899:2011. To repeat: C++ is a different language. Identical syntax/grammar does not imply identical semantics. If you compile with a C++ compiler, this is C++, **not C**. – too honest for this site Jun 28 '16 at 17:23
  • @Olaf Thanks for the clarification, I'll edit the tags accordingly. – youjustreadthis Jun 28 '16 at 17:38

1 Answers1

1

It seems that there is no official documentation for Ssfpack C routines. Conversely, the ssfpack Ox documentation is well detailed ( see 'SsfPack 3.0: Statistical Algorithms for Models in State Space Form' by Koopman and Doornik ).

If you are an experienced C developer you can observe the ox header file ssfpack.h, you'll find some "extern" declared functions that refers to dll located functions. Those functions can be used in C but you need to find by yourself the prototype of the function. This can be really tricky, maybe impossible, for functions where the number of arguments is not known/not constant.

So, you can call Ssfpack directly from C but, due to the lack of documentation, it is very difficult.

For this reason I would recommend that you write your code in Ox and then call it from C or C#. This require that you learn OX, a good starting point is the book Introduction to Ox by Doornik and Ooms (2006). Then, you need to read the Developer's manual for Ox 7 by Doornik (2012) to understand how to call Ox from C.

Malick
  • 6,252
  • 2
  • 46
  • 59