Skip to content

Commit

Permalink
fixed some docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
smuecke committed Jul 13, 2023
1 parent 6e0b188 commit f3c7bf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 4 additions & 8 deletions qubolite/bitvec.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,10 @@ def _expr_normal_form(tokens):
def from_expression(expr: str):
"""Generate an array of bit vectors from a string
containing a bit vector expression. Such an expression
consists of a sequence of these symbols::
0 a constant 0
1 a constant 1
* all combinations of 0 and 1
[i] the same as the bit at index i
[!i] the inverse of the bit at index i
consists of a sequence of these symbols: ``0`` - a constant 0,
``1`` - a constant 1, ``*`` - all combinations of 0 and 1,
``[i]`` - the same as the bit at index i, ``[!i]`` - the
inverse of the bit at index i.
The last two symbols are called references, and ``i`` their
pointing index (counting from 0). A reference can only ever
Expand All @@ -184,7 +181,6 @@ def from_expression(expr: str):
... [1., 1., 0., 0.],
... [1., 0., 1., 1.],
... [1., 1., 1., 1.]])
"""
tokens = _expr_normal_form(list(_BITVEC_EXPR.findall(expr)))
n = len(tokens)
Expand Down
8 changes: 6 additions & 2 deletions qubolite/qubo.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,14 @@ def spectral_gap(self, return_optimum=False):
return sgap

def clamp(self, partial_assignment=None):
"""Create QUBO instance equivalent to this but with a subset of parameters fixed (_clamped_) to constant values.
"""Create QUBO instance equivalent to this but with a subset
of variables fixed (_clamped_) to constant values.
Args:
partial_assignment (dict, optional): Dictionary mapping variable indices (counting from 0) to constant values 0 or 1. Defaults to None, which does nothing and returns a copy of this QUBO instance.
partial_assignment (dict, optional): Dictionary mapping
variable indices (counting from 0) to constant values
0 or 1. Defaults to None, which does nothing and
returns a copy of this QUBO instance.
Returns:
qubo: Clamped QUBO instance.
Expand Down

0 comments on commit f3c7bf8

Please sign in to comment.