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

Function transTriple

Target Offer/transSparseMatrix.py:17–24  ·  view source on GitHub ↗
(triple)

Source from the content-addressed store, hash-verified

15 return triple
16
17def transTriple(triple):
18 m, n = shape(triple)
19 transMatrix = []
20 sortedIndex = array([m[1] for m in triple]).argsort()
21 for i in range(m):
22 tempArray = triple[sortedIndex[i]]
23 transMatrix.append([tempArray[1], tempArray[0], tempArray[2]])
24 return transMatrix
25
26def tripleToSparse(triple, m, n):
27 outMatrix = zeros([n, m])

Callers 1

matrixTransFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected