This project has moved and is read-only. For the latest updates, please go here.

How do I obtain efficient addition of weighted Complex DenseMatrices?

Sep 15, 2014 at 1:07 PM
I'm trying to perform the following operation efficiently with Complex dense matrices

resultsSumMatrix = weightA x aMatrix + weightB x bMatrix

My matrices are often 2000 x 2000. I currently perform the above operation as follows, which seems slow:
Complex[] aValues = aMatrix.Values;
Complex[] bValues = bMatrix.Values;
Complex[] resultValues = resultSumMatrix.Values;
int nValue = aValues.Length; 

for (int i = 0; i < nValue; i++)
      resultValues[i] = weightA*aValues[i] + weightB*bValues[i];
Are there any suggestions for getting faster performance? I find that writing native C++ for the above operation is tricky because CLR uses System.Numerics.Complex for complex numbers.