Solving for a (M x N) Matrix when N > M

(Jim R) #1

Hi, Newbie question here. We are trying to do Fluid Calculations and I set up a basic C# program to test out different scenarios, I’m running into an issue running a MxN matrix where N>M. For example a 4x5 Matrix. I know I am doing something wrong but I just can’t figure it out.

Here is the error:
An unhandled exception of type ‘System.ArgumentException’ occurred in MathNet.Numerics.dll

Additional information: Matrix dimensions must agree: 4x5.

Here is the code snip:
var M = Matrix.Build;
var V = Vector.Build;

        var m = M.DenseOfArray(new double[,] { {a,b,c,cc,ccc},
        var v = V.Dense(new double[] { e, i, n, w });
        var x = m.Solve(v);

Here are the values I am passing:
DenseMatrix 4x5-Double
1 1 1 1 1
0.036 0.0007 0.007 0.0027 0.066
0.125 0.09 0.96 0.18 0.95
0.032 0.032 0.36 0.136 0.79

DenseVector 4-Double

Any help would be appreciated.


Are you sure you really need it? If you have N > M, then you will have infinite number of solutions.

You can read about this in more detail here -

(Jim R) #3

Thank you! That makes sense. Not the answer I was hoping for but it still is an answer. At least I wasn’t going crazy lol.