dwavesystems / dwavesystems/dwave-optimization

``set_state()`` method quietly accepts transposed array

Open
#490 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
31
Forks
36
Avg merge
16h 55m
Merged PRs (30d)
8

Description

```
>>> model = Model()
>>> x = model.integer((2, 5))
>>> with model.lock():
... model.states.resize(2)
... x.set_state(0, [[1, 2], [1, 3], [4, 1], [3, 2], [5, 5]])
... x.set_state(1, [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1]])
... print(x.state(1))
... print(x.state(0))
[[1. 2. 3. 4. 5.]
[5. 4. 3. 2. 1.]]
[[1. 2. 1. 3. 4.]
[1. 3. 2. 5. 5.]]
```

It's a nice "feature" to use but it will probably trip someone up.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.