Hi,
I have found a problem when using the thin QR to solve a Least-Squares problem. Here's my test code:
Thanks,
Andrew
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