(triple, m, n)
| 24 | return transMatrix |
| 25 | |
| 26 | def tripleToSparse(triple, m, n): |
| 27 | outMatrix = zeros([n, m]) |
| 28 | for pointTuple in triple: |
| 29 | mLocation = pointTuple[0] |
| 30 | nLocation = pointTuple[1] |
| 31 | value = pointTuple[2] |
| 32 | outMatrix[mLocation][nLocation] = value |
| 33 | return outMatrix |
| 34 | |
| 35 | def matrixTrans(matrix): |
| 36 | m, n = shape(matrix) |