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.
