Math.NET Numericshttps://mathnetnumerics.codeplex.com/project/feeds/rssMath.NET Numerics is an open source numerical library for the .NET Framework and Mono.New Post: Excel functions: PPMT,IPMT,PMT,CUMIPMT,CUMPRINChttp://mathnetnumerics.codeplex.com/discussions/542382<div style="line-height: normal;">They are not currently supported, but we happily accept contributions.
<br />
<br />
In the meantime <a href="https://github.com/fsprojects/ExcelFinancialFunctions" rel="nofollow">this</a> might be useful.
<br />
<br />
Thanks,
<br />
Christoph<br />
</div>cdrnetWed, 16 Apr 2014 08:46:13 GMTNew Post: Excel functions: PPMT,IPMT,PMT,CUMIPMT,CUMPRINC 20140416084613ANew Post: Excel functions: PPMT,IPMT,PMT,CUMIPMT,CUMPRINChttp://mathnetnumerics.codeplex.com/discussions/542382<div style="line-height: normal;">Dear Team,
<br />
<br />
We want to our application to support list of excel functions. Among those I could find that below functions are available in Math.Net library.
<br />
<em>NormInv,NormDist,NormSDist,NormSInv,BetaDist,BetaInv,</em>
<br />
<br />
I am unable to find any equivalent for following excel function:
<br />
PPMT,IPMT,PMT,CUMIPMT,CUMPRINC
<br />
<br />
Could you please let me know if Math.Net supports these functions?
<br />
<br />
Thanks
<br />
Shyam<br />
</div>shyampundkarWed, 16 Apr 2014 07:47:14 GMTNew Post: Excel functions: PPMT,IPMT,PMT,CUMIPMT,CUMPRINC 20140416074714ASource code checked in, #ad351778037037c05be65bbb5e0d71953fc7ff32http://mathnetnumerics.codeplex.com/SourceControl/changeset/ad351778037037c05be65bbb5e0d71953fc7ff32LA: drop F# Matrix.frobenius function Christoph RueggMon, 14 Apr 2014 02:20:46 GMTSource code checked in, #ad351778037037c05be65bbb5e0d71953fc7ff32 20140414022046ASource code checked in, #60bf40dcc0afc2b959afbfa913b7cef4d5e5a947http://mathnetnumerics.codeplex.com/SourceControl/changeset/60bf40dcc0afc2b959afbfa913b7cef4d5e5a947LA: iterative solver: delegate stop criterion, e.g. for interactive iteration Christoph RueggMon, 14 Apr 2014 02:13:21 GMTSource code checked in, #60bf40dcc0afc2b959afbfa913b7cef4d5e5a947 20140414021321ASource code checked in, #38fea05dcfa9cf772dabb555f87ed02aa43b23ffhttp://mathnetnumerics.codeplex.com/SourceControl/changeset/38fea05dcfa9cf772dabb555f87ed02aa43b23ffLA: make non-arithmetic instance members available as functions in F# Christoph RueggMon, 14 Apr 2014 02:05:07 GMTSource code checked in, #38fea05dcfa9cf772dabb555f87ed02aa43b23ff 20140414020507ANew Post: Bisection Rootshttp://mathnetnumerics.codeplex.com/discussions/542137<div style="line-height: normal;">I don't know recent VB very well, but the following seems to work in LinqPad:<br />
<pre><code>Dim f As Func(Of Double, Double) = Function(x) 2*x^2 - 2*x - 2
Bisection.FindRoot(f, 0, 2) ' 1.61803398874989
Bisection.FindRoot(f, -2, 0) ' -0.618033988749895</code></pre>
Thanks,
<br />
Christoph<br />
</div>cdrnetSun, 13 Apr 2014 19:16:35 GMTNew Post: Bisection Roots 20140413071635PNew Post: Bisection Rootshttp://mathnetnumerics.codeplex.com/discussions/542137<div style="line-height: normal;">Hi! I have a polynomial function from which I'd like to calculate the roots. Can anyone show me an example of such? I figured that I have to create a funtion of System.Func(Of Double, Double) type, but I have no clues about the way of doing that. A quick example with be very much appreciated.
<br />
<br />
Thanks in advance,
<br />
Nuno<br />
</div>ngasparSun, 13 Apr 2014 17:55:52 GMTNew Post: Bisection Roots 20140413055552PNew Post: Are units interesting?http://mathnetnumerics.codeplex.com/discussions/541697<div style="line-height: normal;">Yeah, very similar but for C# (nothing fancy).<br />
<br />
Sample:<br />
<pre><code>var av1 = new AngleUnitValue(90, AngleUnit.Degrees);
var av2 = new AngleUnitValue(Math.PI, AngleUnit.Radians);
var sum = av1 + av2;
Assert.AreEqual(270, sum.DegreesValue, 1E-6);</code></pre>
Names err on the poor/verbose side.<br />
</div>Johan20DWed, 09 Apr 2014 10:19:58 GMTNew Post: Are units interesting? 20140409101958ANew Post: Are units interesting?http://mathnetnumerics.codeplex.com/discussions/541697<div style="line-height: normal;">With units you're referring to <a href="http://msdn.microsoft.com/en-us/library/dd233243.aspx" rel="nofollow">F# Units of Measure</a> or something in this direction?<br />
</div>cdrnetWed, 09 Apr 2014 10:12:17 GMTNew Post: Are units interesting? 20140409101217ANew Post: Are units interesting?http://mathnetnumerics.codeplex.com/discussions/541697<div style="line-height: normal;">I often find that I want units, have written some stuff that I can make a pull request of if anyone is interested.<br />
</div>Johan20DWed, 09 Apr 2014 09:28:11 GMTNew Post: Are units interesting? 20140409092811ANew Post: MKL is even slowerhttp://mathnetnumerics.codeplex.com/discussions/541599<div style="line-height: normal;">Note that you're benchmarking a routine that takes roughly 100ns (1s = 1'000'000'000ns). For such short operations at some point the p/invoke and marshaling overhead to call from managed code into native code will dominate the timing entirely. If you only need short operations like this (as opposed to, say, large matrix multiplications or decompositions) then you may indeed end up with better performance with the managed provider.<br />
<br />
Also, your code still includes the first call (which includes JIT, MKL init etc) which will dominate the average for both providers. A small modification testing the same thing but measuring the first call separately (as Init) typically shows results like this on my machine for MKL:<br />
<pre><code>Intel MKL (x64; revision 4)
Create Data: 00:00:00.0127491s
Init: 2363400.000ns
A: 101.825ns
A: 102.201ns
A: 102.026ns
A: 101.821ns
A: 102.509ns</code></pre>
And for managed:<br />
<pre><code>Managed
Create Data: 00:00:00.0128457s
Init: 1948500.000ns
A: 168.284ns
A: 167.912ns
A: 168.293ns
A: 168.173ns
A: 168.143ns</code></pre>
Code:<br />
<pre><code>const int N = 100000;
Control.UseManaged();
//Control.UseNativeMKL();
Console.WriteLine(Control.LinearAlgebraProvider.ToString());
var w = Stopwatch.StartNew();
var uniform = new ContinuousUniform(-0.5, 0.5)
var a = Vector<double>.Build.Random(100, uniform);
var b = Vector<double>.Build.Random(100, uniform);
Console.WriteLine("Create Data: {0}s", w.Elapsed);
// we accumulate the results to make sure the compiler does not optimize it away.
w.Restart();
double x = a*b;
Console.WriteLine("Init: {0:0.000}ns", (w.Elapsed.TotalMilliseconds*1000*1000));
for (int k = 0; k < 5; k++)
{
w.Restart();
for (int i = 0; i < N; i++)
{
x += a*b;
}
Console.WriteLine("A: {0:0.000}ns", (w.Elapsed.TotalMilliseconds*1000*1000)/N);
}
Console.WriteLine(x);</code></pre>
Does this clarify things? Or do you see very different numbers in your setup?<br />
<br />
Thanks,<br />
Christoph<br />
</div>cdrnetWed, 09 Apr 2014 08:33:50 GMTNew Post: MKL is even slower 20140409083350ANew Post: MKL is even slowerhttp://mathnetnumerics.codeplex.com/discussions/541599<div style="line-height: normal;">I've thought about this too. So I changed my code to <br />
<pre><code>Control.LinearAlgebraProvider = new MklLinearAlgebraProvider();
ContinuousUniform uniform = new ContinuousUniform(-0.5, 0.5);
DenseVector a = DenseVector.CreateRandom(100, uniform);
DenseVector b = DenseVector.CreateRandom(100, uniform);
Stopwatch watch = new Stopwatch();
watch.Start();
for (int i = 0; i < 100000; i++) {
var c = a * b;
}
watch.Stop();
Console.WriteLine(watch.Elapsed);
</code></pre>
Still, MKL is much slower, according to the console output.
<br />
Is there anything else to be done rather than <code>Control.LinearAlgebraProvider = new MklLinearAlgebraProvider()</code>? E.g., configuring my CPU with some Intel tools?<br />
</div>YuhuanWed, 09 Apr 2014 03:19:24 GMTNew Post: MKL is even slower 20140409031924ANew Post: c# interactivehttp://mathnetnumerics.codeplex.com/discussions/540296<div style="line-height: normal;">That looks very handy indeed, thanks for pointing this out!<br />
</div>cdrnetTue, 08 Apr 2014 21:42:03 GMTNew Post: c# interactive 20140408094203PNew Post: Extract multiply element from a matrix efficientlyhttp://mathnetnumerics.codeplex.com/discussions/541534<div style="line-height: normal;">A feature like this has actually been suggested some time ago in <a href="https://github.com/mathnet/mathnet-numerics/issues/45" rel="nofollow">issue #45</a>, including code. In the meantime you could use a loop using matrix.Storage.CopySubMatrixTo.<br />
</div>cdrnetTue, 08 Apr 2014 21:41:26 GMTNew Post: Extract multiply element from a matrix efficiently 20140408094126PNew Post: MKL is even slowerhttp://mathnetnumerics.codeplex.com/discussions/541599<div style="line-height: normal;">MKL is slower on the first call (especially since this is not an expensive operation itself) but is faster afterwards, at least if the dataset is large enough.<br />
<br />
A quick benchmark on my machine (which is not useful for anything beyond demonstrating this):<br />
<br />
Repeating 100 times avg, 4 rounds, len=10'000:<br />
Managed: 0.0368ms, 0.0169ms, 0.0168ms, 0.0168ms<br />
MKL: 0.0515ms, 0.0071ms, 0.0080ms, 0.0078ms<br />
<br />
Repeating 100 times avg, 4 rounds, len=1'000'000:<br />
Managed: 2.3922ms, 2.0536ms, 2.2833ms, 2.4194ms<br />
MKL: 0.1852ms, 0.1513ms, 0.1555ms, 0.1680ms<br />
<br />
Thanks,<br />
Christoph<br />
</div>cdrnetTue, 08 Apr 2014 14:20:43 GMTNew Post: MKL is even slower 20140408022043PNew Post: MKL is even slowerhttp://mathnetnumerics.codeplex.com/discussions/541599<div style="line-height: normal;">I tested MLK with the following simple code<br />
<pre><code>Control.LinearAlgebraProvider = new MklLinearAlgebraProvider();
ContinuousUniform uniform = new ContinuousUniform(-0.5, 0.5);
DenseVector a = DenseVector.CreateRandom(10000, uniform);
DenseVector b = DenseVector.CreateRandom(10000, uniform);
Stopwatch watch = new Stopwatch();
watch.Start();
var c = a * b;
watch.Stop();
Console.WriteLine(watch.Elapsed);
</code></pre>
I ran the code above first, and the result on the console is 00:00:01.0080696. Then I commented the provider setting line (the first line above) out, and the result on the console is 00:00:00.0021271.<br />
<br />
Both runs are in Release mode.<br />
<br />
Why is my code slower with MKL set?<br />
</div>YuhuanTue, 08 Apr 2014 13:35:32 GMTNew Post: MKL is even slower 20140408013532PNew Post: Find Min and Max element in matrix?http://mathnetnumerics.codeplex.com/discussions/541540<div style="line-height: normal;">I was under the impression we had added Minimum/Maximum routines a while back, but apparently that was only for vectors. You can use <code>Enumerate</code> however, which is fairly efficient in v3:<br />
<pre><code>m.Enumerate().Max()
m.Enumerate().Min()
</code></pre>
Thanks,
<br />
Christoph<br />
</div>cdrnetTue, 08 Apr 2014 07:45:05 GMTNew Post: Find Min and Max element in matrix? 20140408074505ANew Post: Find Min and Max element in matrix?http://mathnetnumerics.codeplex.com/discussions/541540<div style="line-height: normal;">Hi,
<br />
<br />
I want to find the max value and minimum value within a matrix. Is there any way to do that without for loops?
<br />
<br />
Thanks<br />
</div>coolzaiMon, 07 Apr 2014 22:01:26 GMTNew Post: Find Min and Max element in matrix? 20140407100126PNew Post: Extract multiply element from a matrix efficientlyhttp://mathnetnumerics.codeplex.com/discussions/541534<div style="line-height: normal;">Hi,
<br />
I was wondering is there an efficient way to extract multiply element from a matrix efficiently?
<br />
<br />
For example,
<br />
I have a index vector idx = [0, 1, 3, 5] and have a matrix rho 8x8.
<br />
<br />
How can I get a new matrix which are composed from rho matrix with idx number [0,0], [0,1], [0.3], [0,5], [1,1], [1,3], .... etc...
<br />
<br />
<br />
Thanks<br />
</div>coolzaiMon, 07 Apr 2014 20:13:28 GMTNew Post: Extract multiply element from a matrix efficiently 20140407081328PNew Post: 3.0 roadmaphttp://mathnetnumerics.codeplex.com/discussions/456821<div style="line-height: normal;">Done.<br />
</div>cdrnetThu, 27 Mar 2014 11:52:45 GMTNew Post: 3.0 roadmap 20140327115245A