MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / flatten

Function flatten

python/tests/kernel/test_assignments.py:733–743  ·  view source on GitHub ↗
(ls: list[list[int]])

Source from the content-addressed store, hash-verified

731
732 @cudaq.kernel
733 def flatten(ls: list[list[int]]) -> list[int]:
734 size = 0
735 for l1 in ls:
736 size += len(l1)
737 res = [0 for _ in range(size)]
738 idx = 0
739 for l2 in ls:
740 for i in l2:
741 res[idx] = i
742 idx += 1
743 return res
744
745 @cudaq.kernel
746 def test4() -> list[int]:

Callers 10

test4Function · 0.70
test5Function · 0.70
test6Function · 0.70
test7Function · 0.70
test8Function · 0.70
test9Function · 0.70
test10Function · 0.70
test1Function · 0.70
test2Function · 0.70
test3Function · 0.70

Calls 1

rangeFunction · 0.50

Tested by

no test coverage detected