For starters, lets consider two different float values a
and b
and an integer d
. I would like to create a numpy.array
that contain all permutations of
(b, a, a, ..., a)
where the length of the vector is d+1
. For example, d=2
, I would like to get
a = 3.14
b = 2.71
numpy.array([
[b, a, a],
[a, b, a],
[a, a, b],
])
While this case could be quite easily generated by hand, more interesting to me are permutations of
(b, b, a, a, ..., a)
(b, c, a, a, ..., a)
(b, b, b, a, ..., a)
(where c
is a float different from a
and b
).
The first one would start off as
numpy.array([
[b, b, a, ..., a],
[b, a, b, ..., a],
...
[b, a, ..., a, b],
[a, b, b, a, ..., a],
...
])
Any hints?