dwavesystems / dwavesystems/dimod

`BQM.is_variable()` and `BQM.is_scalar()` or similar

Open
#923 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
143
Forks
91
Avg merge
1h 24m
Merged PRs (30d)
3

Description

For requests like https://github.com/dwavesystems/dimod/issues/921, it would be nice to have some way of detecting whether a `BQM`/`QM` are scalars or single variables. Something like
```
def is_variable(self):
return self.num_variables == 1 and self.offset == 0 and self.is_linear()

def is_scalar(self):
return self.num_variables == 0
```

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.