Commit 9f538563 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

BlockState: improve initialization of array-valued parameter `b`

parent 1d8167da
......@@ -254,7 +254,9 @@ class BlockState(MCMCState, MultiflipMCMCState, MultilevelMCMCState,
# if a partition is available, we will incorporate it.
if isinstance(b, numpy.ndarray):
self.b = g.new_vp("int")
self.b.fa = b
ba = numpy.zeros(len(self.b.fa), dtype="int")
ba[:min(len(ba), len(b))] = b[:min(len(ba), len(b))]
self.b.fa = ba
self.b = b = g.own_property(b.copy(value_type="int32_t"))
if B is None:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment