This project has moved. For the latest updates, please go here.

DenseMatrix Multiplied with Scalar

Jun 21, 2011 at 7:32 PM
Edited Jun 21, 2011 at 7:33 PM

Hi,

I'm trying to multiply a DenseMatrix with a scalar as such:

Complex32 tau1 = new Complex32(0.1f, 0f);
M = M + Mold.Multiply(tau1);

where M an Mold each is a 3x3 denseMatrix()

Getting these errors from VS2010:

error CS0012: The type 'System.Numerics.BigInteger' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
error CS0266: Cannot implicitly convert type 'MathNet.Numerics.LinearAlgebra.Generic.Matrix<MathNet.Numerics.Complex32>' to 'MathNet.Numerics.LinearAlgebra.Complex32.DenseMatrix'. An explicit conversion exists (are you missing a cast?)

Can someone please give me advice on how to solve this?

 

Thx

 

 

 

Jun 22, 2011 at 2:09 PM

Hi,

Any of these should work:

M = M + (Mold * tau1);
M = (DenseMatrix)(M + Mold.Multiply(tau1));
M = M + (DenseMatrix)Mold.Multiply(tau1);

The problem is that Mold.Multiply(tau1) returns a Matrix<T> not a DenseMatrix.

Regards,
Marcus 

Jun 22, 2011 at 4:11 PM
Edited Jun 22, 2011 at 4:14 PM

Hi Marcus,

Thanks for helping out! I needed to include the system.Numerics and now it works!

Thx