Mathnet numerics 设置子矩阵和列的交互副本哪个更快
在我的MathNet.Numerics.LinearAlgebra用法中,我经常需要将矩阵的一列复制到另一个矩阵(行数相同)。让代码快速运行是至关重要的。是创建for循环并复制每个元素更快,还是应该使用SetSubMatrix()?例如: 哪个更快Mathnet numerics 设置子矩阵和列的交互副本哪个更快,mathnet-numerics,Mathnet Numerics,在我的MathNet.Numerics.LinearAlgebra用法中,我经常需要将矩阵的一列复制到另一个矩阵(行数相同)。让代码快速运行是至关重要的。是创建for循环并复制每个元素更快,还是应该使用SetSubMatrix()?例如: 哪个更快 for (int i = 0; i < matrixA.RowCount; ++i) { matrixA.At(i, myNewCol, matrixB.At(i, myOldCol)); } matrixA.SetSubMatrix
for (int i = 0; i < matrixA.RowCount; ++i)
{
matrixA.At(i, myNewCol, matrixB.At(i, myOldCol));
}
matrixA.SetSubMatrix(0, myNewCol, matrixB.SubMatrix(0, matrixB.RowCount, myOldCol, 1));