Group Abstract Group Abstract

Message Boards Message Boards

Setup NetLink with SsfPack (a .dll) for use in State Space Time Series?

Posted 9 years ago

I have recently been doing work in the field of State Space Time Series. Mathematica does not have a lot of built in tools for working in this area. There is a well known package that is available, SsfPack, that should help bridge that gap. I am having trouble getting that package to work within Mathematica.

You can read about the package here and download here. Inside the zip is a starting guide and use guide.

The site states, "SsfPack is a suite of C routines for carrying out computations involving the statistical analysis of time series models in state space form." It then states, "SsfPack is primarily developed as a module for the object-oriented matrix programming language Ox. The library is written in C, which greatly improves execution speed compared to a direct Ox implementation."

This would make me think that it is a program written in C that should work with Library link.

In the zip file there is a couple headers (.h files) as well as a couple .dll files.

I have tried

Needs["NETLink`"]
kalfil=DefineDLLFunction["KalmanFil", filepath, "long", {"long"}]
During evaluation of In[4]:= LinkOpen::linke: Could not find MathLink executable.
During evaluation of In[4]:= InstallNET::fail: A link to the .NET runtime could not be established.
During evaluation of In[4]:= DefineDLLFunction::netlink: DefineDLLFunction cannot operate because InstallNET[] failed to launch the .NET runtime.
$Failed

I think having this package available to Mathematica users would really help. Maybe it only works with the Ox programming language? Thank you.

POSTED BY: Ray Troy
3 Replies

Ray,

I see from the Developers Manual that it is possible to call OX functions from C (or Java or several other languages). Since SSFPack is essentially an OX function written in C, you can follow that guideline to call the SSFPack routines from Mathematica. Java might be easier to integrate into Mathematica (especially if you do not know C). To answer your question about functions, you only need one function to interface Mathematica to the external dll.

Another viable option is to call OX routines from the command line. The manual discusses how you can do this. Since you know OX, maybe you should write some small OX programs and call them from Mathematica (with the Run related functions) and read back the results. This will not win the "coding excellence" award but should work as long as the calling overhead does not kill you on your application. In fact, you can use Mathematica's extensive templating functions to write the OX code for you on demand with your data in place and read back the results. This involves no coding outside of Mathematica and OX. for Template Documentation start here. Alternatively you can transfer data between OX and Mathematica by reading and writing files. (I am not familiar with OX or SSFPack so I really can't advise you as to which is better)

I think that given your situation, this might be your best approach. Are there many calls to the SSFPack routines or is it just a few?

If you want to talk this over, contact me through my user profile and we can set up a call.

I hope this helps.

POSTED BY: Neil Singer
POSTED BY: Neil Singer
POSTED BY: Ray Troy
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard