Solve a System of Complex Equations

Mar 16, 2010 at 8:55 PM

Hi everyone,

I want to solve a system A*X = B, where A is a complex square matrix (nxn) and B is a complex vector (nx1).

Do you know how to solve this system using MathNet.Numerics?

What I did is :

MathNet.Numerics.Complex[ , ] A = new MathNet.Numerics.Complex[3,3]; //here n=3

MathNet.Numerics.Complex[ ] B = new MathNet.Numerics.Complex[3];

.

.

.

MathNet.Numerics.Algorithms.LinearAlgebra.ILinearAlgebraProvider<MathNet.Numerics.Complex> LU;

LU.LUSolve(1,A,B);

 

But as I noticed if I want to use LUSolve, the arguments can only be complex[ ] not complex [ , ].

 

Anyway, It would be appreciated if any of you show me how to resolve this problem either by correcting above routine or showing me a new way.

 

Thanks,

Faraz 

 

Mar 19, 2010 at 3:02 AM

I just noticed I have to declare A as an array of array like:

 

           MathNet.Numerics.Complex[][] A = new MathNet.Numerics.Complex [3][];
            for (int k = 0; k < 3; k++)
            {
                A[k] = new MathNet.Numerics.Complex[3];
            }

           MathNet.Numerics.Complex[ ] [ ] A = new MathNet.Numerics.Complex [3][ ];

            for (int k = 0; k < 3; k++)

            {

                A[k] = new MathNet.Numerics.Complex[3];

            }

 

But the problem still remains, it sounds somehow weird to me when in the API it said A should be a matrix but the defined it as an vector(i.e. [ ] ).  Anyway, when I put only one row of matrix A in like:

LU.LUSolve(1,A[1],B);

I am getting this error once I run the code:

"The method or operation is not implemented."


Is there any missing implementation in the source code?


Appreciated if you answer my questions.

 

Faraz