Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the MathNet equivalent of MATLAB solve C = A \ B

I've recently begun using MathNet to implement our linear algebra, however I'm having some trouble translation MATLAB functions to MathNet.

In MATLAB I often use the simple solve using the backslash operator:

C = A \ B

What is the equivalent of this in MathNet?

I get the same results in a small matrix using C = Inv(A) * B, but I don't know if the result is as precise.

like image 554
Bildsoe Avatar asked Feb 09 '12 09:02

Bildsoe


1 Answers

var C = A.QR().Solve(B); (using QR decomposition)

For square matrices also: var C = A.LU().Solve(B); (using LU decomposition)

like image 113
Christoph Rüegg Avatar answered Sep 28 '22 16:09

Christoph Rüegg