Skip to content

Instantly share code, notes, and snippets.

@mutaku
Created March 14, 2017 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutaku/11162bd24982a83ce1c4e25128e30d4d to your computer and use it in GitHub Desktop.
Save mutaku/11162bd24982a83ce1c4e25128e30d4d to your computer and use it in GitHub Desktop.
In [20]: m = np.zeros((5, 5))
In [21]: for x in combinations(range(6), 2):
...: m[(x[0], x[1] - 1)] = 3
...:
In [22]: m
Out[22]:
array([[ 3., 3., 3., 3., 3.],
[ 0., 3., 3., 3., 3.],
[ 0., 0., 3., 3., 3.],
[ 0., 0., 0., 3., 3.],
[ 0., 0., 0., 0., 3.]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment