MCPcopy Create free account
hub / github.com/Huelse/SEAL-Python / get_diagonal

Function get_diagonal

examples/matrix_operations.py:9–30  ·  view source on GitHub ↗
(position, matrix)

Source from the content-addressed store, hash-verified

7
8
9def get_diagonal(position, matrix):
10 n = matrix.shape[0]
11 diagonal = np.zeros(n)
12
13 k = 0
14 i = 0
15 j = position
16 while i < n-position and j < n:
17 diagonal[k] = matrix[i][j]
18 i += 1
19 j += 1
20 k += 1
21
22 i = n - position
23 j = 0
24 while i < n and j < position:
25 diagonal[k] = matrix[i][j]
26 i += 1
27 j += 1
28 k += 1
29
30 return diagonal
31
32
33def get_all_diagonals(matrix):

Callers 1

get_all_diagonalsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected