矩阵的转置
数学定义:把矩阵A的行换成同序数的列得到的一个新矩阵,叫做A的转置矩阵.
Public Function Trans(Optional ByVal tMatrix As Matrix = Nothing) If tMatrix Is Nothing Then tMatrix = Me ‘参数为空,默认为自身转置 End If Dim tempMatrix As New Matrix(tMatrix.Col, tMatrix.Row) For i = 1 To tMatrix.Col For j = 1 To tMatrix.Row tempMatrix.Item(i, j) = tMatrix.Item(j, i) Next j Next i Return tempmatrix End Function
时间: 2024-10-20 11:55:21