是否有一种有效的内置方法将值从一个矩阵(例如double[,])复制到另一个矩阵?
换句话说,我正在寻找以下功能的替代品:
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;
}
Run Code Online (Sandbox Code Playgroud)