48

I have started a bounty for this question

...because I really want the community's input. I can (and have) looked at several languages / frameworks and think 'well, this will probably work okay' -- but I would really appreciate advice that's based specifically on the problem I face, and especially from anyone with experience integrating / using what you recommend.


I work on scientific analysis software. It provides a lot of tools for mathematical transformation of data. One tool allows the user to enter in their own equation, which is run over the data set (a large 2D or 3D matrix of values) and evaluated.

This tool has a graphical equation editor, which internally builds an object-oriented expression tree with a different object for each operation (there would be an instance of the Logarithm class, for example, which is the node in the tree for adding calculating a logarithm of a value to a base; it has two children which are its inputs.) A screenshot of part of it:

enter image description here

You can see the tree it's building on the left, and a few of many (fifty?) potential operations in the menu on the right.

This has a few downsides:

  • A graphical editor becomes clumsy for complex equations
  • There are some operations that are difficult to represent graphically, such as creating large matrices (the kernel for a n x n convolution for example)
  • It only allows equations: there is no branching or other logic

It was neat when it was much simpler, but not any more, for the kind of stuff our users want to be able to do with it. If I wrote it now I'd do it quite differently - and this is my chance :)

I would like to give user something more powerful, and let them write code - script or compiled - that can perform much more advanced operations. I am seeking SO's advice for what technology this should use or the best approach to take towards it.

The rest of this question is quite long - I'm sorry. I've tried to describe the problem in detail. Thanks in advance for reading it :)

Important constraints:

  • Our math operates on large matrices. In the above equation, V1 represents the input (one of potentially many) and is 2D or 3D, and each dimension can be large: on the order of thousands or hundreds of thousands. (We rarely calculate all of this at once, just slices / segments. But if the answer involves something which requires marshalling the data, be aware size and speed of this is a consideration.)

  • The operations we provide allow you to write, say, 2 x V, which multiplies every element in V by 2. The result is another matrix the same size. In other words, a scripting or programming language which includes standard math primitives isn't enough: we need to be able to control what primitives are available, or how they are implemented.

    These operations can be complex: the input can be as simple as a number (2, 5.3, pi) or as complex as a 1, 2 or 3-dimensional matrix, which contains numerical, boolean or complex (paired values) data. My current thinking is a language powerful enough to which we can expose our data types as classes and can implement standard operators. A simple evaluator won't be enough.

    • Rather than just writing operations that are evaluated iteratively on one or more inputs to provide an output, as currently (which is implementable easily through an expression evaluator), I'd like the user to be able to: provide outputs of different sizes to the inputs; to call other functions; etc. For the host program, it would be useful to be able to ask the user's code what part or slice of the inputs will be required to evaluate a slice or part of the output. I think exposing some part of our classes and using an OO language is probably the best way to achieve these points.
  • Our audience is primarily research scientists who either are not used to coding, or are probably used to a language like Matlab or R.

  • We use Embarcadero C++ Builder 2010 for development, with small amounts of Delphi. This may restrict what we can make use of - just because something's C++, say, doesn't mean it will work if it's only been coded against VC++ or GCC. It also has to be suitable for use with commercial software.

  • Our software currently has a COM interface, and part of the application can be automated with our app being the out-of-process COM server. We could add COM interfaces to some internal objects, or make a second COM framework specifically for this, if required.

  • The 'tools', including this one, are being migrated to a multithreaded framework. The end solution needs to be able to be executed in any thread, and multiple instances of it in many threads at once. This may affect a hosted language runtime - Python 2.x, for example, has a global lock.

  • It would be great to use a language that comes with libraries for math or scientific use.

  • Backwards compatibility with the old expression tool is not important. This is version 2: clean slate!

Current ideas:

  • RemObjects Pascal Script and DWScript are languages easily bindable to TObject-derived classes. I don't know if it is possible to provide operator overloading.
  • Hosting the .Net runtime, and loading C# (say) based DLLs as plugins. I rather like this idea: I've seen this done where the host program provides a syntax highlighter, debugging, etc. I gather it was a huge amount of coding, though. It would enable the use of IronPython and F# too.
    • RemObjects Hydra looks like an interesting way of achieving this. Unfotunately it advertises itself for Delphi, not C++ Builder; I'm investigating compatibility.
  • Hosting something like Python, which is doable from RAD Studio
  • Providing a BPL interface, and letting users code directly against our program if they buy a copy of RAD Studio (ie, provide a plugin interface, and expose classes through interfaces; maybe require plugins be compiled with a binary-compatible version of our IDE)
  • ...

Thanks for your input! I appreciate all answers even if they aren't quite perfect - I can research, I am just after pointers on where to go, and opinions (please, opinions with reasons included in the answer :p) on how to approach it or what might be suitable. Every answer, no matter how short, will be appreciated. But if you recommend something in detail rather than just "use language X" I'll be very interested in reading it :)

Cheers,

David

Updates:

The following have been recommended so far:

  • Python: 2.6 has a global lock, that sounds like a game-killer. 3 (apparently) doesn't yet have wide support from useful libraries. It sounds to me (and I know I'm an outsider to the Python community) like it's fragmenting a bit - is it really safe to use?

  • Lua: doesn't seem to be directly OO, but provides "meta-mechanisms for implementing features, instead of providing a host of features directly in the language". That sounds very cool from a programmer point of view, but this isn't targeted at programmers wanting cool stuff to play around with. I'm not sure how well it would work given the target audience - I think a language which provides more basics built in would be better.

  • MS script / ActiveScript. We already provide an external COM interface which our users use to automate our software, usually in VBScript. However, I would like a more powerful (and, frankly, better designed) language than VBS, and I don't think JScript is suited either. I am also uncertain of what issues there might be marshalling data over COM - we have a lot of data, often very specifically typed, so speed and keeping those types are important.

  • Lisp: I hadn't even thought of that language, but I know it has lots of fans.

  • Hosting .Net plugins: not mentioned by anyone. Is this not a good idea? You get C#, F#, Python... Does it have the same marshalling issues COM might? (Does hosting the CLR work through COM?)

A couple of clarifications: by "matrix", I mean matrix in the Matlab variable sense, ie a huge table of values - not, say, a 4x4 transformation matrix as you might use for 3D software. It's data collected over time, thousands and thousands of values often many times a second. We're also not after a computer algebra system, but something where users can write full plugins and write their own math - although the system having the ability to handle complex math, like a computer algebra system can, would be useful. I would take 'full language' over 'algebra' though if the two don't mix, to allow complex branches / paths in user code, as well as an OO interface.

Community
  • 1
  • 1
David
  • 13,360
  • 7
  • 66
  • 130
  • 1
    to be honest, sounds alot like matlab: http://www.mathworks.com/products/matlab/ – Stijn Sanders Jun 01 '11 at 08:28
  • @Stijn Sanders: Yes... I've tried to describe it generally without getting into domain-specific areas, but this particular component I guess would be similar. The product as a whole does far more though and this is a small portion of it :) Some users use Matlab, and it'd be nice if we provided enough functionality they didn't have to. – David Jun 02 '11 at 00:01
  • anybody know how wolfram alpha was built? maybe that could help? :) – corroded Jun 03 '11 at 09:21
  • If you need a mini matlab, maybe wxMaxima is a good base for you ... as I say in my answer. – Warren P Jun 08 '11 at 10:02
  • About "hosting .Net plugins": you'll have to use COM to speak with them, as far as I've seen such solutions. But you'll need visual studio to write seem. A bit oversized IMHO. Better use a script engine like python and a Delphi written IDE, embedded in your app. – Arnaud Bouchez Jun 11 '11 at 08:29
  • Just curious, what scripting language are you leaning towards? – ezpresso Jun 23 '11 at 11:28
  • @ezpresso: at the moment, either Python or a hosted .Net runtime. I haven't had time since I asked this question to investigate further (and might not for a while, unfortunately.) I'm leaning towards .Net since users could use several languages (including Python) and plugins will end up compiled, not just interpreted. It has a huge useful library too. The languages are also all quite common (especially compared to something like Lua) which will hopefully make learning them easier for users new to it all. – David Jun 27 '11 at 01:20

12 Answers12

18

According to your needs, here are some guidelines:

  • Make a distinction between language and library - you can have mathematical languages (like MATLAB) or mathematical libraries called from an high-level language (like Python);
  • The language (or library) should be designed by mathematicians, for mathematicians;
  • The used language should be an existing one (do not reinvent the wheel);
  • You should be able to share the script content with existing software;
  • You should not start such a big complex project (math scripting) from scratch.

So I guess it could reduce the candidate list:

  • JavaScript was not designed (not used) for such usage;
  • Delphi scripts (DWS or PascalScript) were made mostly for automation, not calculation (and are not widely used);
  • I don't know why you are talking about using Delphi IDE in the customer application, but you should not use Delphi IDE for such proprietary development: a primitive custom IDE will be more productive than a full RAD;
  • Lua should perhaps be considered: you can make whatever you want with this script engine - but there is not a huge community of mathematicians using Lua, unlike Python...

In the Open Source world, you could find a lot of very interesting solutions. See http://blog.interlinked.org/science/open_source_math_programs.html

I guess that Octave could be considered. It's simple, powerful, mature, well known, used by a lot of software, and cross platform.

As far as I know, you can call Octave library from C/C++ code. It could be done from Delphi IMHO, after translation of the associated .h files.

But be aware of the GPL licence. If your software is proprietary, it could be impossible to distribute Octave as a part of your software. But you may call the Octave library or any other GPL stuff (like Python) from your software, if you make a clear distinction between your software and the GPL software.

Embedding Python could be a good solution. This language can be called from Delphi, and you should have a good architecture, without the need of calling directly some C libraries like Octave. Python could be your main gate to all other calculation libraries, from your Delphi application. For instance, Octave can be called from some Python libraries. And you can also use Python scripts to automate your own application. And you have some Python IDE in Delphi around. The Open Source license of every component being safe, of course. The more I think about it, the more I like this latter solution...

Just my two cents. :)

w5m
  • 2,286
  • 3
  • 34
  • 46
Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • Thanks @A. Bouchez! Sounds like Python is good. Do you have any experience using it, or binding classes to it, etc? Are there any open-source licensing issues? How easy is it to hook in to debug it, so we can give users a primitive dev environment? Re the Delphi IDE, the cost of it is small compared to the cost of our software, so if they wanted to develop we could say 'use this IDE', provide a plugin template, and they'd get something full-featured. – David Jun 02 '11 at 00:00
  • I did use it several years ago, and it worked as expected, but I'm definitively no expert here - there are several related questions in SO. About license, contact your company lawyer: there is no place of "personal guess" here. About IDE, see http://code.google.com/p/pyscripter (released under a MIT license). Using Delphi IDE is oversized IMHO for your purpose. – Arnaud Bouchez Jun 03 '11 at 06:02
  • 1
    'Lua', not 'LUA'. :-) http://www.lua.org/about.html – Roddy Jun 03 '11 at 09:32
  • The [Octave website](http://www.gnu.org/software/octave/license.html) mentions that the project is licensed under the GPL (as in your answer), not the LGPL. For the purposes of the GPL, and unlike the LGPL, linking counts as a modification. So unless Octave makes an explicit exception, linking to it puts a requirement on the license of your software. – Luc Danton Jun 03 '11 at 09:40
  • @Luc You can use a GPL program from a proprietary program, as soon as it's clearly stated and understood by the user. See http://www.gnu.org/licenses/gpl-faq.html#GPLInProprietarySystem So all python-related stuff could be called from your software, but not part of your software. Just like if you run a proprietary software under Linux. – Arnaud Bouchez Jun 03 '11 at 13:10
  • @A.Bouchez I specifically find your phrasing 'you can call Octave library from C/C++ code' suggestive of linking. – Luc Danton Jun 03 '11 at 13:38
  • @Luc That's right. I therefore edited the text in order to be less confusing. AFAIK, late binding is allowed by the GPL, otherwise you shouldn't use any proprietary software using the glib, e.g. under Linux. ;) – Arnaud Bouchez Jun 03 '11 at 14:51
  • @A. Bouchez: This is the highest voted answer and the bounty period is over... enjoy your extra +150! Python looks a good thing to investigate, too (one of the other answers below also talks about it.) – David Jun 10 '11 at 11:26
  • Argh. @A. Bouchez, half has been awarded to another answer. This has happened to me before: I waited the bounty period out to give time for more answers (people were still answering this today) and... I have emailed the SO tea to help resolve it. (And I consider the current bounty behaviour broken.) – David Jun 10 '11 at 11:43
  • @David No problem, I hope you'll find yourself your way with python in your SW! – Arnaud Bouchez Jun 10 '11 at 11:49
  • @A. Bouchez: the answer is to start another bounty and award that in two days' time. I've just done that, so in a couple of days... :) – David Jun 14 '11 at 00:22
  • @David A false fix hidden behind a true workaround trick mask... seems familiar in our SW world... :) – Arnaud Bouchez Jun 14 '11 at 05:57
  • @A. Bouchez: Agreed :) I posted [a meta question to change it](http://meta.stackexchange.com/questions/95149/could-we-add-a-short-period-when-a-bounty-expires-when-it-can-still-be-manually-a). In the meantime, I just awarded you the second bounty. Thanks! – David Jun 15 '11 at 01:07
  • @A. Bouchez: hah. And it got closed. Feel like commenting, if you happen to agree the behaviour is broken? – David Jun 15 '11 at 03:23
  • @David I'm not sure I'm quite familiar with the SO policy and all those issues. Thanks for the 2nd bounty, in all cases! – Arnaud Bouchez Jun 16 '11 at 14:27
7

No definitive answer, but a few other suggestions:-

  • Have a look at the LMD Innovative ScriptPack, which supports native Pascal scripting, and also ActiveScripting-based languages. Caveat : I use a lot of the LMD tools and components, but I haven't personally used Scriptpack.

  • LMD also have am IDE-Tools package, which can really simplify the task of making a simple custom 'RAD' tool if you need to go that route

  • Another vote for Lua. I've used Lua as a script language in C++Builder2010 apps, and it works well. You can leverage the C++Builder/Delphi RTTI to help the integration between Lua script and your C++ code.

Re. Lua: We have a product which for many years had an ultrasimple 'homebrew' scripting system within it. No loops, conditionals or procedures - just a sequence of parameterized commands. We wanted to extend this to something more powerful, and picking a third-party solution seemed a lot less pain than reinventing the wheel. Primary reasons for choosing Lua for this were:-

  • Fast
  • Published books available (Programming in Lua)
  • Written in C
  • Directly embeddable within our project via static linking
  • MIT License
  • C++ Code can call invoke Lua code and access Lua variables
  • Lua code can call C++ functions
  • Small deployment footprint. Lua and it's standard libraries added under 200K to our .EXE, before compression.

I'm sure other languages could have been equally good, but it was the 'lightweight' nature of Lua that tipped it for me.

Roddy
  • 66,617
  • 42
  • 165
  • 277
  • Thanks @Roddy. A fully-native compiled script language sounds good! And their IDE tools also look useful. I don't know much about Lua: what is it about the language that makes you recommend it? – David Jun 05 '11 at 23:57
  • @David M : updated answer :-) – Roddy Jun 06 '11 at 09:40
5

I like many of the answers there and, well, I am a biased Delphi nerd :) but I would suggest you to use a combination: RO Pascal Script+ ESBPCS for VCL.

I don't know if this sounds like you - but I would give it a go.

From the website, I extracted this link about the matrix non visual part of the library. There are many more, you might want to give that a go!

Andrea Raimondi
  • 527
  • 8
  • 30
  • Hi @Andrea - thanks for your answer. I think ESBPCS is probably targeted at much smaller matrices than ours... also perhaps a slightly different use of the term 'matrix'. We basically mean large grids (if it was in Excel) or tables of numbers, not matrices used for transformations or 'standard' matrix math. – David Jun 06 '11 at 00:00
  • Hi David, I have no idea what your exact requirements are... possibly the best way to find out is asking them :) – Andrea Raimondi Jun 06 '11 at 07:56
5

With Python, you get NumPy and SciPy "for free". Yes, there's GIL, but it's only active when your Python interpreter is running multiple threads. I believe you can run multiple Python hosts in separate threads without problem (haven't tried, thought).

Also, there are things like multiprocessing.

Python 3 is still catching on, NumPy started support Python 3 in version 1.5.0, and SciPy started support in version 0.9.0. Also, the GIL is still with Python 3, althought it's been redone so it should be better. Also NumPy releases the lock during operations.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Harriv
  • 6,029
  • 6
  • 44
  • 76
  • NumPy and SciPy look very useful. That's exactly the sort of library I was hoping to find - you should have more than the one upvote I can give you :) I think multiple Python hosts in separate threads may be the way to go to avoid the GIL. – David Jun 10 '11 at 03:01
  • Checkout also matplotlib, plotting library recommended by SciPy: http://matplotlib.sourceforge.net/ – Harriv Jun 10 '11 at 07:09
4

We've been using the Microsoft script automation (active scripting) quite successfully. Basically you have to implement a host which will run the scripts. Scripts can be written in any language that are installed on the current machine. We are using JavaScript for our scripts but you are not limited to this. There are a lot of script implementation out there (even python).

From your side you'll have to provide a framework for the script to run in. Not simple but with basic COM understanding it is not hard either. There are implementations made for Delphi. There are some resources here: http://www.torry.net/pages.php?id=280 but you can find resources all over the web.

Good luck!

r4w8173
  • 598
  • 6
  • 15
  • thanks for the answer. I think I have been hoping for something more complex or closely integrated than MS scripting - we actually already support that for external automation of our software. I'm not sure how suitable it really is (especially the default languages, JScript and VBScript) for using our internal classes, passing large amounts of data around (they're late-bound, aren't they?) etc. Thanks though, and I will look into it! – David Jun 06 '11 at 00:04
4

I would suggest Lua. It is one of the most used scripting-languages, there are plenty of tools such as debuggers, editors with syntax highlighting etc, a lot of people have used it, it's one of the fastest scripting-languages that you can easily plug into a c/c++ engine. It's really easy to extend C-functions into it (specifically if you're using LuaJIT plus FFI). There is no really good way of multithreading in lua, but you can easily run multiple instances of lua in separate threads in order to run multiple scripts.

Simon
  • 773
  • 3
  • 11
  • Hi @Simon! Thanks for the answer - and also for specifically addressing multithreading :) One of the other answers also recommended Lua. I don't know much about it: is it easy to read / write if you're not used to programming? Can you create / use classes? You say you can extend C functions into it, but how easy is it to expose a C++ class to give an OO interface? – David Jun 06 '11 at 00:02
  • 2
    Regardless of what scripting language you pick, you can most likely use [SWIG](http://swig.org/) to expose C++ classes to it. (SWIG supports Python, TCL. Lua, etc.) – Nemo Jun 06 '11 at 04:17
  • @David M: Lua is quite easy to use. I wouldn't say that the programming language is syntactically difficult so learning it would probably quite simple. You can use classes, there's a few wrappers around to help you for that (check on lua.org, they are a lot better than me on describing these kind of things)... although personally I prefer exposing things to lua through a c-similar interface. (Or through FFI - http://luajit.org/ext_ffi.html). – Simon Jun 06 '11 at 11:03
  • @Nemo, Thanks for the SWIG suggestion - interesting for me too! – Roddy Jun 06 '11 at 13:06
4

Because you need a mathematics targeted scripting language, may I recommend you to take a look at Common Lisp. It is a dialect of the LISP, which was originally developed as a conventional mathematical notation for computer programs. The computer algebra systems like Maxima and Axiom are written in Common Lisp. The most notable Common List implementation is ECL, which is released under LGPL license. Of course there are many other open source implementations out there.

Also there is GNU Guile interpreter for Scheme programming language (a dialect of Lisp). Their site states that

Guile is an efficient virtual machine that executes a portable instruction set generated by its optimizing compiler, and integrates very easily with C and C++ application code. In addition to Scheme, Guile includes compiler front-ends for ECMAScript and Emacs Lisp (support for Lua is underway)...

However, I have never used this library myself, so I can't guarantee how easy it would actually be to embed it into your application.

ezpresso
  • 7,896
  • 13
  • 62
  • 94
  • I hadn't even thought of Lisp! Interestingly, another reply also mentioned Maxima... we're not so much after computer algebra as a full language, but Lisp is an intriguing possibility. We do need something that can be included with commercial (non-OS) software though. Still, thanks for the reply, I'll look into it! – David Jun 09 '11 at 00:17
  • @David, Under the terms of the LGPL, you can use the library in a commercial product! That's why ECL is a good alternative. – ezpresso Jun 09 '11 at 07:04
4

Nobody mentioned PaxCompiler which can compile Pascal, Javascript and Basic into native code and can easily be setup to access objects in your Delphi projects. It has many advantages:

  1. Compiled code will run faster than interpreted one
  2. It provides 3 different programming languages so that almost any developer can feel at home
  3. As a Delphi developer, you have access to the source code and it is tightly integrated with your project
  4. The price is very interesting

The disadvantages and challenges for a popular project are:

  1. Make sure the 3 languages are treated equally: from my tests, it feels like JavaScript is behind in terms of bundled samples
  2. If you choose to bundle all the 3 programming languages, you might want to provide almost all your samples in all languages and you'll have to be comfortable with supporting all three of them
jonjbar
  • 3,896
  • 1
  • 25
  • 46
  • Thanks, @John! I'm not sure Javascript or VBScript are well suited to math / scentific programming, so I'd be happy to throw them away and just support Pascal. Do you have any experience using it? The [FAQ worries me](http://paxcompiler.com/faq.htm), it looks like it's missing some features (Manually binding to overloaded virtual functions requires a lot of rigamarole, for example.) – David Jun 16 '11 at 06:52
  • 1
    I'm not sure I grasp what a language needs to be well suited to math / scientific programming and what differentiates Pascal from JS or VB on that point but that's your call. Regarding PaxCompiler, my advise would be to try it as it is really good. I was like you though and I was scared about the web-site / support but when I contacted them via e-mail I received fast and good answers. I'm currently developing an application based on it and so far, no problems: with latest version of Delphi you can let whole objects be accessible from script with a few lines of code thanks to RTTI. – jonjbar Jun 16 '11 at 11:38
3

I suggest that you look into the wx (C++) based GUI wrapper around the classic open source math program called Maxima, which is called wxMaxima on Windows. It is GPL licensed, however, and not LGPL, so derived works would also have to be open sourced.

You should be able to use this application and its algebra engine, and perhaps you could write your own Delphi wrapper for this C++ UI around the MACSYMA/MAXIMA (LISP) engine. The source code to their system includes a few things you might want to also wrap and provide as a service:

  1. A way to encode math equations into a display format, from the user-entered format, which is well defined and which can then be documented.

  2. A simple "language" spec which you could use to compose your "WYSIWYG equation" tools from.

Maxima can handle plots, matrices, linear algebra and basic calculations, and the engine is solid.

Since you're already doing a lot of things in C++, I would consider doing your WHOLE APPLICATION using wxWidgets, with wxMaxima as a base. I am not sure if you can do wx + VCL hybrids in C++Builder, but you should certainly try it out. If you can't, then I would say make the main application in VC++ with wxWidgets and make plugins in Delphi for it (as DLLs).

enter image description here

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • P: interesting answer, thanks! I haven't come across this before. Its ability to draw graphs etc is also potentially useful. (Btw, writing the whole application in wxWidgets might be good for future cross-platform compatibility, but... the app has a fifteen-year-old codebase, hundreds of thousands of lines of code, and is very entrenched in the VCL. Maybe for our next version :p) – David Jun 09 '11 at 00:15
  • Are you sure it has a "C++ based engine"? Wikipedia thinks it's [written in Common Lisp](http://en.wikipedia.org/wiki/Maxima_%28software%29). – David Jun 09 '11 at 00:25
  • Thanks for the correction - updated my answer to make it clearer that wxMAXIMA means GUI/UI-layer which in C++, but the underlying MAXIMA/MACSYMA engine is LISP. I hadn't noticed the LISP part! – Warren P Jun 09 '11 at 14:17
3

My ideas:

  1. Call Mathematica via its API (C, Java, C#), but I'm afraid that might be too slow for you http://reference.wolfram.com/mathematica/guide/MathLinkAPI.html

  2. Generate F# with http://fsharppowerpack.codeplex.com/ and its fslex, fsyacc. See also: How can evaluate an expression stored as a string in F#, Tim Robinson building a LISP compiler in F#

Community
  • 1
  • 1
oleschri
  • 2,012
  • 11
  • 21
  • Interesting. I think you're right about Mathematica's speed, but's cool to be able to generate F# code like that! – David Jun 10 '11 at 04:01
  • If you build a LISP compiler in F#, you could then run the MACSYMA/MAXIMA lisp engine through it, and end up with an F# algebra/math engine. – Warren P Jun 10 '11 at 21:08
3

You mentioned you audience is probably used to R. You should look at integrating your product with R, either as a R Extension or calling R from your product. See Writing R Extensions. That way you can leverage R's power and your users familiarity with R.

crefird
  • 1,590
  • 11
  • 17
  • R would potentially be very handy. I haven't used it much and have no idea of its speed with large quantities of data. Unfortunately it's GPL, which I think means we can't link to it (as we could with the LGPL?) – David Jun 10 '11 at 04:05
3

GIL on python should not be a showstopper as its existance does not mean your application could not do multi thread. It is true you cannot use all CPU core available on the system but again, this would only affect if most of your code were written in python. Your application would host python code right? and those script would intensively call math routines available in host application. This means there were still many wayout to release and hold the GIL on your application to minimize its side effect and you'll be just fine.

Jaimy Azle
  • 138
  • 2
  • 4
  • If I understand you correctly, do you mean the GIL is only held when executing Python code, and is released when executing C library or callback code? – David Jun 10 '11 at 11:27
  • correct, you can release and hold the GIL just before and after peforming task in native code (either in C or Delphi). – Jaimy Azle Jun 10 '11 at 16:31