Is there an efficient built-in method that copies a value from one matrix (e.g. double[,]) to another?
In word order, I am looking for a replacement function below:
public static double[,]CloneMatrix(double[,] aMatrix)
{
var newMatrix = new double[aMatrix.GetLength(0),aMatrix.GetLength(1)];
for (int i = 0; i < aMatrix.GetLength(0); i++)
{
for (int j = 0; j < aMatrix.GetLength(1); j++)
{
newMatrix[i, j] = aMatrix[i, j];
}
}
return newMatrix;
}
source
share