MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / tripleToSparse

Function tripleToSparse

Target Offer/transSparseMatrix.py:26–33  ·  view source on GitHub ↗
(triple, m, n)

Source from the content-addressed store, hash-verified

24 return transMatrix
25
26def 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
35def matrixTrans(matrix):
36 m, n = shape(matrix)

Callers 1

matrixTransFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected