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

Function sparseToTriple

Target Offer/multiSparse.py:6–13  ·  view source on GitHub ↗
(matrix)

Source from the content-addressed store, hash-verified

4
5from numpy import *
6def sparseToTriple(matrix):
7 m, n = shape(matrix)
8 triple = []
9 for i in range(m):
10 for j in range(n):
11 if matrix[i][j] != 0:
12 triple.append([i, j, matrix[i][j]])
13 return triple
14
15def multiTriple(tripleA, tripleB):
16 rowA = shape(tripleA)[0]

Callers 1

matrixMultipleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected