Quantcast
Channel: Math.NET Numerics
Viewing all 971 articles
Browse latest View live

New Post: EigenValue Decomposition - method failing

$
0
0
Playing around with the convergence criteria again didn't lead anywhere and I couldn't spot the difference between the two sets of code (ours and the the other JAMA port). Reading some comments on HQR2 suggest that there are just some matrices that it doesn't work with but I couldn't figure out what conditions cause it to fail.

MKL seems to handle the 650 matrix fine (and was quite quick). I'll add the LAPACK routine geev to the native wrapper and perhaps that will work for you.

New Post: EigenValue Decomposition - method failing

$
0
0
That would be great thanks, it might be enough to work for any other ones i will be throwing at it too.

New Post: Does MathNet.Numerics support extrapolation?

$
0
0
I've got the CubicSplineInterpolation working just fine doing interpolation. Now I'm trying to get extrapolation working but I don't see this supported in any of the relation functions. Am I missing something or is there another package which handles this?

Thanks in advance.

New Post: linear optimization solver

$
0
0
Hi,
Is there any linear optimization solver included in the math.net Numerics library (like linprog in Matlab)?

Thanks

Guillaume

New Post: Does MathNet.Numerics support extrapolation?

$
0
0
Technically all the interpolation algorithms support extrapolation to values outside of the sample set range. Just be aware that it follows along exactly the same interpolated high-order function, so there is a high risk of producing garbage. Depending on your scenario, some form of regression may help to reduce the order in such cases.

Thanks,
Christoph

New Post: linear optimization solver

$
0
0
Hi Guillaume

No, not yet. There is finally some work for non-linear optimization in the pipeline, but not yet for any convex optimization (like LP).

You may want to give the MS solver foundation a trial: http://archive.msdn.microsoft.com/solverfoundation

Of course in case you come up with something yourself or find some existing .Net code, we'd be interested to hear about it!

Thanks,
Christoph

New Post: Does MathNet.Numerics support extrapolation?

$
0
0
Thanks for the reply. That's great news, this is a nice package.

Last question: Is it required that the 2 input vectors (eg. samplePoints and sampleValues inputs to _CubicSplineInterpolation()_) -- be monotonic? Or does this depend on which spline implementation I choose? I thought I remembered from college that splines require the two input vectors to be monotonically increasing or decreasing but I wasn't sure if that's specific to which Spline method is used or if this was a general rule for all splines. Ideally I would like an implementation that works with non-monotonic inputs too for robustness.

Thanks for the response,

Alex

New Post: Does MathNet.Numerics support extrapolation?

$
0
0
To my understanding, all our interpolation algorithms expect the samples to be sorted ascendingly by the sample point, although I'd have to check the specific algorithm if needed. The sample points thus do have to be strictly monotonically increasing, but there is no restriction on the sample values.

I fact, even if the sample values were monotonic, the resulting function could still be non-monotonic. Note that there is an adaption if there is a requirement that the resulting function be monotonic, i.e. a monotonic spline. A simple way to achieve this, provided the sample values are in fact monotonic, is to modify the spline derivatives (e.g. computed using CubicSplineInterpolation.EvaluateSplineDerivatives) to all have the same sign and feed them directly into a cubic hermite spline instead.

Thanks,
Christoph

New Post: Using Matrix types in VB

$
0
0
Hi,

I have a bit of a problem understanding how best to use some of the matrix methods in VB. For example:
Option Explicit On
Option Strict On
Option Infer On

Imports MathNet.Numerics.LinearAlgebra.Double

Public Class myClass

Private Sub GetDiagonalFromQR()

            Dim tempVectorList As New List(Of DenseVector)

            'Code to populate list with DenseVectors here...

            Dim tempXMatrix As DenseMatrix = DenseMatrix.CreateFromColumns(tempVectorList)

            Dim diagonal() As Double = tempXMatrix.GramSchmidt.R.Diagonal.ToArray

        End Sub
End Class
This gives me an error when I have Option Strict On because the CreateFromColumns method is looking for a
System.Collections.Generic.IList(Of MathNet.Numerics.LinearAlgebra.Generic.Vector(Of Double))
instead.
Is there a way of getting round this? If I use Option Strict Off then the conversions between types are implicit but obviously this is bad practice.

Thanks for your help,
Andrew

New Post: Using Matrix types in VB

$
0
0
Yes, CreateFromColumns would be more flexible if instead of IList it used IEnumerable, which is covariant. We may want to change that in the future.

For now the following options come to mind that should all work (C#, I'm not fluent in VB.net but it should work the same way):
  • Declare your vector list with the base type instead (i.e. what the compiler suggests):
var vs = new List<Vector<double>>();
  • Convert the list to an array using ToArray, leveraging a small (although a bit nasty) trick around array covariance:
var m = Matrix.CreateFromColumns(vs.ToArray());
  • Cast properly, using Linq:
var m = Matrix.CreateFromColumns(vs.Cast<Vector<double>>().ToList());
  • Convert the list:
var m = Matrix.CreateFromColumns(vs.ConvertAll(x => (Vector<double>)x));
Thanks,
Christoph

New Post: Using Matrix types in VB

$
0
0
Thanks for your help - I'll have a go!

New Post: Problem in thin QR Solve

$
0
0
Hi,
I have found a problem when using the thin QR to solve a Least-Squares problem. Here's my test code:
Public Shared Function MathNetQRSolve(xArray(,) As Double, yColumn() As Double, useFull As Boolean) As Double()

        Dim QRType As LAGeneric.Factorization.QRMethod

        If useFull Then
            QRType = LAGeneric.Factorization.QRMethod.Full
        Else
            QRType = LAGeneric.Factorization.QRMethod.Thin
        End If

        Dim xMatrix As LAGeneric.Matrix(Of Double) = New DenseMatrix(xArray)
        Dim yVector As LAGeneric.Vector(Of Double) = New DenseVector(yColumn)

        Dim output As LAGeneric.Vector(Of Double)

        Try
            Dim tempQR As LAGeneric.Factorization.QR(Of Double) = xMatrix.QR(QRType)
            output = tempQR.Solve(yVector)

        Catch ex As Exception
            output = New SparseVector(yColumn.Count)
            MsgBox(ex.Message)
        End Try

        Return output.ToArray

    End Function
If I use the thin QR factorization then it throws an error, "All vectors must have the same dimensionality". The factorization itself is fine, it's just the solve method that doesn't work.

Thanks,
Andrew

New Post: Problem in thin QR Solve

$
0
0
Just having thought about it a little more, I think it's because for an M×N matrix:

Full QR Decomposition
Q is M×M
R is M×N

Thin QR Decomposition
Q is M×M
R is N×N (square matrix)

This means that when the solve method checks that the dimensions are the same then they won't be and that's where it throws the error.

New Post: Problem in thin QR Solve

$
0
0
yep, in DenseQR we are checking
if (MatrixR.RowCount != input.RowCount)
but we we should be using the Q matrix not R.

Interesting that this passed the unit tests. I'll update the tests and check in a fix.

New Post: Problem in thin QR Solve

$
0
0
Chris as merged the fix into the main branch. Thanks for reporting the error.

New Post: Problem in thin QR Solve

$
0
0
No problem. Does this mean that the fix is available in the latest download or do I need to download the source code and compile it myself?

I assume that you caught this one in the same fix, but I think the Gram-Schmidt decomposition also had the same problem.

New Post: Problem in thin QR Solve

$
0
0
For the moment you'll need to compile it yourself.

It didn't occur to me to check GS. It looks there is an issue with it - thanks!

New Post: Problem in thin QR Solve

$
0
0
(There have been quite a few fixes lately, so I'm considering a patch release soon, i.e. v2.4.1)

New Post: Problem using Native Linear Algebra Provider

$
0
0
Hello,

I'm having trouble getting the native linear algebra providers to work using the documentation here :
http://mathnetnumerics.codeplex.com/wikipage?title=Native%20Providers&referringTitle=Documentation
I'm using MKL, and while I was able to build the MKLWrapper project and grab the resulting MathNET.Numerics.MKL.dll, when I try to run my program and it hits a line that does any matrix operations (in my case, a .Divide) I get the following error :
An unhandled exception of type "System.DllNotFoundException' occurred in MathNet.Numerics.dll

Additional information: Unable to load DLL 'MathNET.Numerics.MKL.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
The MathNET.Numerics.MKL.dll is in the same directory as the MathNet.Numerics.dll I'm using in "References" (and out of frustration, I copied it to every other folder that any copy of MathNet.Numerics.dll happens to be in). The DLL was built in Release and x64 just like the MathNet.Numerics.dll, and the program I'm calling from.

Lots of googling has so far not given me much to go on. I'm not at all familiar with using unmanaged DLLs in a .NET project so it's very possible I'm missing something simple. Has anyone had experience with using MKL and have any suggestions on where I can look next?

Thanks,
Brian

New Post: Problem using Native Linear Algebra Provider

Viewing all 971 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>