SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
frattyquant
Topic Author
Posts: 362
Joined: March 4th, 2010, 8:10 am

C# Numerical Library

March 7th, 2011, 9:07 am

Can anyone recommend a good numerical library for C#, I basically need random number generation, some linear algebra, distributions and basis optimization. I'm a newbie in C#, so ideally nothing too complicated. Thanks
 
User avatar
Govert
Posts: 103
Joined: January 28th, 2006, 10:02 am

C# Numerical Library

March 7th, 2011, 11:21 am

You might have to look at a few libraries to satisfy all your requirements. For the basic linear algebra there are many options, but as you start looking for optimization libraries the choices get more tricky.Start with Math.NET Numerics, which is free and actively under development, coming out of the merger of two older projects, dnAnalytics and Math.NET. I don't think it has any optimization stuff, but has wrappers for native LA libraries like Intel's MKL. I've used this from time to time for simple linear algebra with no problems.ALGLIB which is a long-running multi-language algorithms library, with some optimization (mainly unconstrained) and a wide range of different topics. There is good and bad from its multi-language approach: it doesn't feel like a regular .NET library, but you might use the same algorithms from different languages. Certainly worth browsing around for while.A bit more specialized, but perhaps worth a look is Meta.Numerics which is strong on special functions and statistics.You might also investigate some of the commercial options, including CenterSpace NMath which has math and stats libraries, including constrained nonlinear optimization using SQP and Extreme Optimization which is a very comprehensive and prominent .NET numerical library for many years.-GovertExcel-DNA - Free and easy .NET for Excel.
Last edited by Govert on March 6th, 2011, 11:00 pm, edited 1 time in total.
 
User avatar
frattyquant
Topic Author
Posts: 362
Joined: March 4th, 2010, 8:10 am

C# Numerical Library

March 7th, 2011, 3:25 pm

Thanks! I was considering Math.Net, and I'm going to give it a shot after your endorsement.
 
User avatar
demha
Posts: 182
Joined: January 27th, 2011, 8:01 pm

C# Numerical Library

March 7th, 2011, 11:51 pm

QuoteOriginally posted by: GovertALGLIB which is a long-running multi-language algorithms library, with some optimization (mainly unconstrained) and a wide range of different topics. There is good and bad from its multi-language approach: it doesn't feel like a regular .NET library, but you might use the same algorithms from different languages. Certainly worth browsing around for while.ALGLIB looks really interesting. I hope they open source their code generator which seems to be the key to the quality of their code base.
 
User avatar
shatinanalytics
Posts: 10
Joined: October 19th, 2010, 2:21 am

C# Numerical Library

March 24th, 2011, 11:20 am

I use NAG Fortran Mark 22 dll's in C# for all my quant tasks
 
User avatar
Cuchulainn
Posts: 62608
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

C# Numerical Library

March 24th, 2011, 11:26 am

(double post) 
Last edited by Cuchulainn on March 23rd, 2011, 11:00 pm, edited 1 time in total.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Posts: 62608
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

C# Numerical Library

March 24th, 2011, 11:33 am

QuoteOriginally posted by: shatinanalyticsI use NAG Fortran Mark 22 dll's in C# for all my quant tasksI used Fortran NAG ages ago and even then it could do lots.There is no point trying to write a full blown C# numerics library. It wil take forever to reach the same maturity level. Last but not least, is there anyone around to do it?
Last edited by Cuchulainn on March 23rd, 2011, 11:00 pm, edited 1 time in total.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
PavelG
Posts: 12
Joined: April 21st, 2011, 2:43 pm

C# Numerical Library

December 12th, 2011, 1:10 pm

I have used AlgLib for a long time for my own research in statistical arbitrage. It contains a lot of required features like linear algebra, optimization, descriptive statistics, FFT and much more. But the API of this library is not very convenient. Thus, recently I have decided to switch to FinMath. It is a commercial numerical library for .NET Framework written with emphasis on financial applications. FinMath uses Intel Math Kernel Library as a back-end for computations. It is extremely fast while providing very good and flexible object-oriented interface designed to be easily used by non-professional programmers. With FinMath I can perform principal component analysis or stepwise regression just in 1-2 lines of code! And it takes less than a second to perform such algorithms on data from whole SP500 market. Also, it's documented pretty well, all necessary information could be found on documentation page. From now on, if I need to perform quantitative research in financial it will be my first-choice.
Last edited by PavelG on December 11th, 2011, 11:00 pm, edited 1 time in total.
 
User avatar
AGatISC
Posts: 17
Joined: January 14th, 2008, 8:49 pm

C# Numerical Library

January 10th, 2012, 5:03 pm

Readers of this thread may be interested in the Microsoft "Cloud Numerics" lab that was announced today. The "Cloud Numerics" lab is a numerical and data analytics library for data scientists, quantitative analysts, and others who write C# applications in Visual Studio. More information can be found from the link above.Disclaimer: I am a member of the Cloud Numerics team at Microsoft.
Last edited by AGatISC on January 9th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
chocolatemoney
Posts: 322
Joined: October 8th, 2008, 6:50 am

C# Numerical Library

November 22nd, 2013, 8:09 am

Any experience with statfactory FCore or F# for Numerics?I am not very happy with the design of math.net - first of, the decision to have a Vector class with its weird left and right multiplication.Thanks. PS: My requirements:- quick, running on MKL. - as close as possible to matlab, with compact operators for alg. ops. and conditional slicing.- F# native, if possible
Last edited by chocolatemoney on November 21st, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62608
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

C# Numerical Library

November 22nd, 2013, 9:06 am

I have come to doubt doing serious numerics in .NET after this
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Govert
Posts: 103
Joined: January 28th, 2006, 10:02 am

C# Numerical Library

November 22nd, 2013, 9:40 am

ILNumerics is a good one for a high-performance managed implementation (like C, not like tuned MKL, though) and friendly if you're coming from MATLAB.You'd have to tell us what you think about the vector multiplication, though.-GovertExcel-DNA - Free and easy .NET for Excel
 
User avatar
chocolatemoney
Posts: 322
Joined: October 8th, 2008, 6:50 am

C# Numerical Library

November 22nd, 2013, 11:18 am

I just questioned the need of a Vector class. I come from the school of thoughts a vector is a 1xn or nx1 matrix, and I'd like to choose if I'd like to have a row or a col vector, and I rather have one single operator (*) that does the alg. multiplication where I take care of transposing, rather than having the library silently doing that for me if dimensionality checks fail. Sure, in math.net you can just work with matrices but then I need to sit and write down my own constructors for 1xn and nx1 matrices, which I I could do but I'd rather start from a clean sheet.ILNumerics is great, but I'd rather sacrifice some perf and avoid dealing with IL(IN/OUT)Array for the time being. I have tons of small matrices extracted from dataframes (Deedle: https://github.com/BlueMountainCapital/Deedle), hence it would be important for me to have the smallest overhead in the conversion from seq to the Matrix type
 
User avatar
chocolatemoney
Posts: 322
Joined: October 8th, 2008, 6:50 am

C# Numerical Library

November 22nd, 2013, 11:26 am

[.. continues from above ..]It is very important to me to have nice slicing and conditional slicing operators.I was even considering writing an ad-hoc dataframe class wrapped around a proper matrix class, rather than shifting data back and forth to the Deedle dataframe; but I am not sure if I'll have time to do that. I need to get my algorithms done as quickly as possible.
 
User avatar
Cuchulainn
Posts: 62608
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

C# Numerical Library

June 14th, 2016, 10:47 am

Here is a list of librariesI am looking for a fast one for SVD, Householder QR, as well as orthogonal polynomials.Which one is best? Math.NET vs Alglib?? QuoteMath.NET Numerics is a linear algebra, open source library written in C#. It has a robust contributor community ensuring stable releases and healthy feature support. Math.NET is used broadly in fields from science to engineering and notably finance. Popular in financial sectors, Math.NET has a wide library of mathematical functions from linear algebra to integral transforms and probability models. You can access this library from inside your algorithms by calling it in at the top of your code!
Last edited by Cuchulainn on June 13th, 2016, 10:00 pm, edited 1 time in total.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On