Jun 22, 2011 at 11:04 AM
Edited Jun 22, 2011 at 11:07 AM

Hi,
I've been using mathnet.iridium as the basis of a regression program and I decided to update it to math.net numerics. The code (VB) that does the grunt work has been changed from
InputArray = XMatrix.CopyToArray 'Then passed to separate function
Dim
TempMatrix1 As Matrix
= Matrix.Create(InputArray).QRDecomposition.R
Dim
TempMatrix2 As Matrix
= Matrix.Create(InputArray).QRDecomposition.R
Dim XXT
As
Matrix
Matrix2.Transpose()
TempMatrix1 = TempMatrix1.Inverse()
TempMatrix2 = TempMatrix2.Inverse()
XXT = TempMatrix1 * TempMatrix2 'for calculating standard errors

to (and
thanks Marcus for the help on this)
Betas = Xmatrix.QR.Solve(YVector)
RMatrix=XMatrix.QR.R
XXT=RMatrix.TransposeThisAndMultiply(RMatrix).Inverse()

The only problem is that the program now
runs at half the speed as previously which I don't understand. The XMatrix that I'm testing with is 9000*100 (approx). Using Iridium it takes about 10 seconds to run but using Numerics it now takes about 20.
I'm
using ExcelDNA to port these functions into Excel where the user interrface is built and the matrices are all declared as type DenseMatrix.
I'm
a bit of a newbie to coding so I may just have done something daft, but if anyone can give me some advice on this I'd be grateful.
Another
interesting thing is that Iridium allows the inversion of the R Matrix from a QR decomposition, but Numerics doesn't. As R isn't square, I presume that Iridium defaults to calculating the Left or Right Inverse depending on whether for an m*n matrix m>n
(Left) or m<n (Right), but I'm not certain about this.
Thanks,
Andrew
Betas = XMatrix.Solve(YMatrix)
